Skip to content

Streaming responses not working in real-time #16

@dokterbob

Description

@dokterbob

Problem

The streaming implementation is parsing Server-Sent Events from LangServe but messages still arrive all at once instead of word-by-word streaming.

Current Behavior

  • ❌ AI responses appear as complete messages instantly
  • ✅ LangServe backend properly streams via /chatbot/stream endpoint
  • ✅ SSE parsing logic implemented in Socket.IO server
  • ✅ Frontend ready to receive streaming chunks

Expected Behavior

  • ✅ AI responses should appear word-by-word in real-time
  • ✅ User should see typing indicator during generation
  • ✅ Streaming should work when "Enable Streaming" checkbox is checked

Technical Details

LangServe Backend Output (Working)

The backend correctly streams:

event: data
data: "Hello"

event: data  
data: " How"

event: data
data: " can"

Current Implementation

  • Socket.IO server in vite.config.ts parses SSE events
  • Emits message_chunk events for each word
  • Frontend handles streaming with agent_response_start/complete

Investigation Needed

  1. Verify SSE parsing logic handles multi-line chunks correctly
  2. Check if Socket.IO emission timing is correct
  3. Debug frontend streaming state management
  4. Test with different message lengths and types

Reproduction Steps

  1. Start both backend (uv run serve) and frontend (pnpm dev)
  2. Create conversation with endpoint selected
  3. Ensure "Enable Streaming" is checked
  4. Send message like "Write a short poem"
  5. Observe: Message appears all at once instead of streaming

Environment

  • LangServe backend: FastAPI + OpenAI
  • Frontend: SvelteKit + Socket.IO + Vite
  • Development mode with Vite plugin integration

Related

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions