diff --git a/apps/desktop/src/components/right-panel/hooks/useChatLogic.ts b/apps/desktop/src/components/right-panel/hooks/useChatLogic.ts index bf159b67a2..344ae20bb9 100644 --- a/apps/desktop/src/components/right-panel/hooks/useChatLogic.ts +++ b/apps/desktop/src/components/right-panel/hooks/useChatLogic.ts @@ -77,6 +77,7 @@ export function useChatLogic({ messages: Message[], currentUserMessage?: string, mentionedContent?: Array<{ id: string; type: string; label: string }>, + modelId?: string, ) => { const refetchResult = await sessionData.refetch(); let freshSessionData = refetchResult.data; @@ -113,6 +114,7 @@ export function useChatLogic({ date: currentDateTime, participants: participants, event: eventInfo, + modelId: modelId, }); const conversationHistory: Array<{ @@ -308,7 +310,7 @@ export function useChatLogic({ const { textStream } = streamText({ model, - messages: await prepareMessageHistory(messages, content, mentionedContent), + messages: await prepareMessageHistory(messages, content, mentionedContent, model.modelId), ...(type === "HyprLocal" && { tools: { update_progress: tool({ inputSchema: z.any() }), @@ -316,7 +318,9 @@ export function useChatLogic({ }), ...((type !== "HyprLocal" && (model.modelId === "gpt-4.1" || model.modelId === "openai/gpt-4.1" - || model.modelId === "anthropic/claude-4-sonnet")) && { + || model.modelId === "anthropic/claude-4-sonnet" + || model.modelId === "openai/gpt-4o" + || model.modelId === "gpt-4o")) && { stopWhen: stepCountIs(3), tools: { search_sessions_multi_keywords: tool({ diff --git a/crates/template/assets/ai_chat_system.jinja b/crates/template/assets/ai_chat_system.jinja index 36e63a1361..db68957d67 100644 --- a/crates/template/assets/ai_chat_system.jinja +++ b/crates/template/assets/ai_chat_system.jinja @@ -144,6 +144,7 @@ Your response would mostly be either of the two formats: " +{% if modelId == "gpt-4.1" or modelId == "openai/gpt-4.1" or modelId == "anthropic/claude-4-sonnet" or modelId == "openai/gpt-4o" or modelId == "gpt-4o"%} [Tool Calling] Here are available tools that you can call to get more information. {important} not all models have access to all tools. If you can't call a tool, tell user that your model doesn't have access, so try switching to a different model like gpt-4.1 or claude 4 sonnet. @@ -156,3 +157,4 @@ Here are available tools that you can call to get more information. (what you should do) : "It seems that for the keyword 'product', there are notes 'Q1 Meeting', 'Apple Client Meeting','Daily all handes'....It seems taht (your analysis and insights + references - where the information came from)" {% endif %} +{% endif %}