-
Notifications
You must be signed in to change notification settings - Fork 10
Add WebSocket streaming for real-time responses #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hi @kartikeyg0104, Thank you for contributing. I have some general feedback:
|
|
Thank you so much for your feedback, Sir! I really appreciate the suggestion about using a feature branch, and I’ll make sure to follow this practice in future pull requests to maintain a clean history and avoid conflicts with updates in the main branch. As for the frontend, I missed connecting the WebSocket functionality to the frontend. I’ll work on integrating and testing the WebSocket connection and include the necessary changes in a follow-up commit. |
berviantoleo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned before, it looks like your PR descriptions and the actual changes are not matched.
Please at least, add the testing code or the front end code. Any codes that's not related to the purpose of the PR shouldn't be mentioned here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to add these files into .gitignores.
| except WebSocketDisconnect: | ||
| pass | ||
| except Exception as e: | ||
| await websocket.send_text(json.dumps({"error": str(e)})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't send the error to the client. We may log it, but please send a general error text.
Add WebSocket streaming for real-time responses
Description
This pull request introduces WebSocket streaming functionality to the AI Chatbot plugin. The new feature enables token-by-token streaming of responses, improving responsiveness and user experience. This is particularly beneficial for local LLM setups, as it allows real-time output rendering in the frontend.
Changes Made
Backend Updates:
/sessions/{session_id}/streaminchatbot-core/api/routes/chatbot.py.chatbot-core/api/models/llama_cpp_provider.pyandchatbot-core/api/services/chat_service.py.Frontend Demo:
websocket_demo.htmlto showcase real-time streaming in a simple chat interface.Test Scripts:
test_websocket_simple.py,test_streaming_direct.py) to verify WebSocket functionality.Updated
.gitignore:Testing Done
Benefits