diff --git a/src/hooks/use-chat.ts b/src/hooks/use-chat.ts index d92fce9..876c434 100644 --- a/src/hooks/use-chat.ts +++ b/src/hooks/use-chat.ts @@ -26,8 +26,6 @@ export interface ChatMessage { isLoading?: boolean; /** Tool calls in progress or completed during this assistant turn */ toolCalls?: ToolStatus[]; - /** Structured content blocks for multi-turn context (sent to API) */ - contentBlocks?: any[]; /** Clickable entity suggestions for disambiguation */ suggestions?: EntitySuggestion[]; } @@ -115,10 +113,12 @@ export function useChat(context?: ChatContext) { setIsLoading(true); try { - // Build message history for the API, preserving structured content blocks + // Build message history for the API — send plain text only. + // Tool interactions are resolved server-side within a single request, + // so we never send tool_use/tool_result blocks back in history. const apiMessages = [...messages, userMsg].map((m) => ({ role: m.role, - content: m.contentBlocks || m.content, + content: m.content, })); abortRef.current = new AbortController(); @@ -194,10 +194,6 @@ export function useChat(context?: ChatContext) { provider: data.provider, isLoading: false, suggestions: data.suggestions, - // Store structured blocks for multi-turn context - contentBlocks: data.content - ? [{ type: "text", text: data.content }] - : undefined, } : m )