Skip to content

feat: Allow chat switching during active streams with background notifications #957

@RostyslavManko

Description

@RostyslavManko

Description

We need to enhance the chat stream handling to allow users to switch between chats without interrupting active streams. Currently, switching chats stops the stream and uploads everything to the database. We should refactor this to allow users to switch chats freely and only show a notification when a stream finishes in a different chat.

Objective

Our goal is to improve the chat experience by:

  1. Allowing users to switch between chats without interrupting active streams
  2. Showing notifications when streams finish in background chats
  3. Maintaining proper state management for multiple active streams

Actions and Considerations (ACC):

Stream Management:

  • Modify useChatHandler to support background streams
    • Create a state to track active streams per chat
    • Remove handleStopMessage from chat switching
    • Implement proper cleanup only when necessary

Notification System:

  • Add stream completion notifications
    • Show toast notification when stream finishes in background
    • Include chat name in notification
    • Add option to switch to completed chat

Database Integration:

  • Optimize stream handling
    • Update chat state only when stream completes
    • Ensure proper message saving
    • Handle interrupted streams gracefully

Expected Outcomes:

  • Users can switch between chats without interrupting streams
  • Notifications appear when streams complete in background chats
  • Proper state management for multiple active streams
  • Improved user experience similar to ChatGPT

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions