Skip to content

feat: Migrate Literary Chat to WebSockets (Flask-SocketIO) - #964

Merged
devanshi14malhotra merged 5 commits into
devanshi14malhotra:mainfrom
diksha78dev:fix/issue-877
May 29, 2026
Merged

devanshi14malhotra merged 5 commits into
devanshi14malhotra:mainfrom
diksha78dev:fix/issue-877

Conversation

@diksha78dev

Copy link
Copy Markdown
Contributor

Migrates the "Literary Chat" (Elara the bookseller) from a blocking REST API to real-time WebSockets using Flask-SocketIO.

Changes:

  • Backend: Added Flask-SocketIO to serve WebSockets. Created @socketio.on('chat_message') in app.py and implemented generator functions in ai_service.py (generate_chat_response_stream) to chunk and stream LLM outputs from Gemini, Groq, and OpenAI.
  • Frontend: Integrated the Socket.IO CDN script into chat.html. Upgraded ChatInterface to emit socket events and incrementally render streamed chat_stream chunks directly to the UI, providing immediate visual feedback.
  • Resilience: The frontend retains a graceful fallback to the legacy HTTP REST fetch if the WebSocket connection drops or cannot be established.

Closes #877

@netlify

netlify Bot commented May 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for bibliodrift-dm ready!

Name Link
🔨 Latest commit 36b3033
🔍 Latest deploy log https://app.netlify.com/projects/bibliodrift-dm/deploys/6a196b5f72f2c5000810dd1a
😎 Deploy Preview https://deploy-preview-964--bibliodrift-dm.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@devanshi14malhotra devanshi14malhotra added level3 10 points NSoC'26 For issues and PRs which are a part of the Nexus Spring of Code open source event level:intermediate GSSoC'26 intermediate level PR/issue labels May 29, 2026
@devanshi14malhotra
devanshi14malhotra merged commit 0c4e77b into devanshi14malhotra:main May 29, 2026
4 checks passed
@devanshi14malhotra devanshi14malhotra added the gssoc:approved PR has been reviewed and is eligible for GSSoC points (for GSSoC'26) label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR has been reviewed and is eligible for GSSoC points (for GSSoC'26) level:intermediate GSSoC'26 intermediate level PR/issue level3 10 points NSoC'26 For issues and PRs which are a part of the Nexus Spring of Code open source event

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend/Feature]: Migrate Literary Chat to WebSockets (Flask-SocketIO)

2 participants