feat: use saveChatCompletion in handleChatStream to match handleChatGenerate (MYC-3962)#135
Conversation
…enerate (MYC-3962) Replace handleChatCompletion with saveChatCompletion in handleChatStream to: - Match the message persistence behavior of handleChatGenerate - Remove duplicate room creation (now handled in validateChatRequest) - Remove duplicate user message persistence (now handled in setupConversation) - Keep assistant message persistence with proper error handling Add tests for: - saveChatCompletion called with text from last assistant message - Fallback to responseMessage when no assistant messages - No call when stream is aborted - Error logging without throwing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 17. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…YC-3962) - Create getUiMessageText utility to extract text from UIMessage parts - Update handleChatStream to use getUiMessageText instead of inline logic - Update getLatestUserMessageText to use getUiMessageText for consistency - Add 6 unit tests for getUiMessageText Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Closing PR as requested |
Summary
handleChatCompletionwithsaveChatCompletioninhandleChatStreamto match/api/chat/generatebehaviorvalidateChatRequest->setupConversation)Test plan
handleChatStream(11 tests)onFinishcallback:saveChatCompletionwith text from last assistant messageresponseMessageas fallback when no assistant messagessaveChatCompletionwhen stream is abortedsaveChatCompletionfails🤖 Generated with Claude Code