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

Chat backend #40

Merged
merged 8 commits into from
Apr 8, 2023
Merged

Chat backend #40

merged 8 commits into from
Apr 8, 2023

Conversation

3coins
Copy link
Collaborator

@3coins 3coins commented Apr 7, 2023

Summary

This PR incudes the changes for the backend API for the chat feature. There are two main components.

  1. A WebSocket handler for receiving chat requests, processing them and broadcasting the response to all clients. The WebSocket also takes care of broadcasting the chat request to other clients.
  2. A history API that provides the message history to the clients. This also includes a delete API to clear the history.

API Details

GET /api/ai/chats

Consumes and broadcasts messages

GET /api/ai/chats/history

Returns message history

DELETE /api/ai/chats/history

Clears the chat history

@3coins 3coins added the enhancement New feature or request label Apr 7, 2023
@3coins 3coins requested a review from dlqqq April 7, 2023 22:05
Copy link
Member

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

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

@3coins This looks great! See the comments I left. Also, you should exclude all frontend changes with the exception of src/chat_handler.ts to minimize merge conflicts. The easiest way to do this would be to run:

git checkout main -- <path-to-file>

For each file that doesn't exist on main, you will get an error like so:

% git checkout main -- packages/jupyter-ai/src/components/chat.tsx
error: pathspec 'packages/jupyter-ai/src/components/chat.tsx' did not match any file(s) known to git

In which case, you should just run git rm <path-to-file>.

packages/jupyter-ai/src/chat_handler.ts Outdated Show resolved Hide resolved
packages/jupyter-ai/src/chat_handler.ts Show resolved Hide resolved
packages/jupyter-ai/src/chat_handler.ts Outdated Show resolved Hide resolved
@3coins 3coins marked this pull request as ready for review April 8, 2023 01:33
@3coins 3coins requested a review from dlqqq April 8, 2023 01:33
Copy link
Member

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

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

Great work! 👍

@dlqqq dlqqq merged commit bae1734 into jupyterlab:main Apr 8, 2023
@welcome
Copy link

welcome bot commented Apr 8, 2023

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

This was referenced Apr 8, 2023
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* implement chat UI

* WIP: Chat backend

* Working version with reply

* Working chat backend with websocket

* Fixed error

* Added types for messages

* Aligned with main branch, removed chat UI components.

* Removed yarn.lock updates

---------

Co-authored-by: David L. Qiu <david@qiu.dev>
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* implement chat UI

* WIP: Chat backend

* Working version with reply

* Working chat backend with websocket

* Fixed error

* Added types for messages

* Aligned with main branch, removed chat UI components.

* Removed yarn.lock updates

---------

Co-authored-by: David L. Qiu <david@qiu.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants