Skip to content
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

Add a websocket for streaming from the chat UI #679

Merged
merged 32 commits into from Apr 3, 2024

Conversation

sabaimran
Copy link
Collaborator

Incoming

  • Setup websocket from the chat web UI in order to show people incremental status updates while a query is in progress
  • Update the front-end and back-end code to better manage the state over this connection and interpret the query/responses

- Add a db model for Agents, attaching them to conversations
- When an agent is added to a conversation, override the system prompt to tweak the instructions
- Agents can be configured with prompt modification, model specification, a profile picture, and other things
- Admin-configured models will not be editable by individual users
- Add unit tests to verify agent behavior. Unit tests demonstrate imperfect adherence to prompt specifications
- Add a page to view all agents
- Add slugs to manage agents
- Add a view to view single agent
- Display active agent when in chat window
- Fix post-login redirect issue
- Convert to a model of calling the search API directly with a function call (rather than using the API method)
- Gracefully handle websocket connection disconnects
- Ensure that the rest of the response is still saved, as it is currently, if the user disconects from the client
- Setup unchangeable context at the beginning of the session when the connection is established (like location, username, etc)
…a a socket to the server

- Move some common methods into separate functions to make the UI components more efficient
- The normal HTTP-based chat connection will still work and serves as a fallback if the websocket is unavailable
@sabaimran sabaimran added the upgrade New feature or request label Mar 20, 2024
@sabaimran sabaimran requested a review from debanjum March 20, 2024 09:45
Copy link
Collaborator

@debanjum debanjum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments but looks good otherwise!

src/khoj/routers/api_chat.py Show resolved Hide resolved
src/khoj/routers/api_chat.py Show resolved Hide resolved
src/khoj/routers/api_chat.py Outdated Show resolved Hide resolved
src/khoj/routers/api_chat.py Show resolved Hide resolved
src/khoj/interface/web/chat.html Show resolved Hide resolved
src/khoj/interface/web/chat.html Outdated Show resolved Hide resolved
src/khoj/interface/web/chat.html Show resolved Hide resolved
src/khoj/interface/web/chat.html Show resolved Hide resolved
Base automatically changed from features/add-agents-ui to features/full-integration-agents March 26, 2024 12:43
Base automatically changed from features/full-integration-agents to master March 28, 2024 06:31
@sabaimran sabaimran merged commit 9c42c8b into master Apr 3, 2024
9 checks passed
@sabaimran sabaimran deleted the features/chat-socket-streaming branch April 3, 2024 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upgrade New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants