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.
This commit is contained in:
Danny Avila 2025-12-12 03:33:10 -05:00
parent 7842bcc6e0
commit 58520017c7
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -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);
}