From 58520017c7e78100f91b61686f122c27bf804974 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Fri, 12 Dec 2025 03:33:10 -0500 Subject: [PATCH] refactor: Simplify initial response handling in useChatFunctions - Removed unnecessary pre-initialization of content types in the initial response, allowing for dynamic content creation based on incoming delta events. This change enhances flexibility in handling various content types in the chat flow. --- client/src/hooks/Chat/useChatFunctions.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/client/src/hooks/Chat/useChatFunctions.ts b/client/src/hooks/Chat/useChatFunctions.ts index ad1e0dd2e6..c51d4453c7 100644 --- a/client/src/hooks/Chat/useChatFunctions.ts +++ b/client/src/hooks/Chat/useChatFunctions.ts @@ -283,22 +283,7 @@ export default function useChatFunctions({ } } } else { - // Assistants endpoint uses nested format: { type: 'text', text: { value: 'content' } } - // Agents and other endpoints use flat format: { type: 'text', text: 'content' } - if (isAssistantsEndpoint(endpoint)) { - initialResponse.content = [ - { - type: ContentTypes.TEXT, - [ContentTypes.TEXT]: { - value: '', - }, - }, - ]; - } else { - // Don't pre-initialize content type - let incoming delta events - // create content parts dynamically (supports think, text, etc.) - initialResponse.content = []; - } + initialResponse.content = []; } setShowStopButton(true); }