fix issues and web search info

This commit is contained in:
Thomas G. Lopes 2025-06-18 15:40:08 +01:00
parent 8fdffd36b7
commit 5c9ad4a4f8
4 changed files with 8 additions and 1 deletions

View file

@ -101,6 +101,7 @@ export const createAndAddMessage = mutation({
})
)
),
web_search_enabled: v.optional(v.boolean()),
},
handler: async (
ctx,

View file

@ -294,7 +294,7 @@ ${attachedRules.map((r) => `- ${r.name}: ${r.rule}`).join('\n')}`,
}
// Check if web search is enabled for the last user message
const lastUserMessage = messages.filter(m => m.role === 'user').pop();
const lastUserMessage = messages.filter((m) => m.role === 'user').pop();
const webSearchEnabled = lastUserMessage?.web_search_enabled ?? false;
const modelId = webSearchEnabled ? `${model.model_id}:online` : model.model_id;
@ -331,6 +331,7 @@ ${attachedRules.map((r) => `- ${r.name}: ${r.rule}`).join('\n')}`,
content: '',
role: 'assistant',
session_token: sessionToken,
web_search_enabled: webSearchEnabled,
}),
(e) => `Failed to create assistant message: ${e}`
);

View file

@ -37,6 +37,7 @@
import { callCancelGeneration } from '../api/cancel-generation/call.js';
import ModelPicker from './model-picker.svelte';
import AppSidebar from '$lib/components/app-sidebar.svelte';
import { cn } from '$lib/utils/utils.js';
const client = useConvexClient();

View file

@ -93,6 +93,10 @@
{#if message.model_id !== undefined}
<span class="text-muted-foreground text-xs">{message.model_id}</span>
{/if}
{#if message.web_search_enabled}
<span class="text-muted-foreground text-xs"> Web search enabled </span>
{/if}
{#if message.cost_usd !== undefined}
<span class="text-muted-foreground text-xs">
${message.cost_usd.toFixed(6)}