Skip to content

Conversation

@sweetmantech
Copy link
Contributor

Summary

  • Replace handleChatCompletion with saveChatCompletion in handleChatStream to match /api/chat/generate behavior
  • Remove duplicate room creation and user message persistence (now handled in validateChatRequest -> setupConversation)
  • Keep assistant message persistence with proper error handling (non-critical, logs errors but doesn't fail the request)

Test plan

  • Unit tests pass for handleChatStream (11 tests)
  • New tests added for message persistence in onFinish callback:
    • Calls saveChatCompletion with text from last assistant message
    • Uses responseMessage as fallback when no assistant messages
    • Does not call saveChatCompletion when stream is aborted
    • Logs error but does not throw when saveChatCompletion fails
  • All 564 tests pass

🤖 Generated with Claude Code

…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 <[email protected]>
@cursor
Copy link

cursor bot commented Jan 19, 2026

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.

@vercel
Copy link

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
recoup-api Ready Ready Preview Jan 19, 2026 6:47pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants