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 model to the chat panel #1

Merged
merged 6 commits into from
Mar 15, 2024
Merged

Conversation

brichet
Copy link
Collaborator

@brichet brichet commented Feb 29, 2024

This PR adds a model to the chat, which must be used to implement a chat panel.

It also provides a websocket handler extending this model, as one possible implementation of the model.

The idea of this change is to be able to create a CRDT model (based on this model) in jupyter_collaboration.

@brichet brichet marked this pull request as draft February 29, 2024 10:45
Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Thanks for doing this @brichet !

This looks all good to me. I only have a small comment/suggestion/question concerning the method namings in the base ChatModel

src/model.ts Outdated
* @param message - the message to send.
* @returns whether the message has been sent or not, or nothing if not needed.
*/
sendMessage(
Copy link
Member

Choose a reason for hiding this comment

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

Just a naming question. I'm wondering if addMessage would be better.

In my mind, in this place we're changing the chat model to add a new message into it. Whether it is "sent" is entirely to the chatmodel implementation detail.

Suggested change
sendMessage(
addMessage(

Copy link
Member

Choose a reason for hiding this comment

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

When looking into implementing a CRDT-based chat, we'd add a message to the data structure. The sending of the changes would not be handled by the chat implementation.

Copy link
Member

Choose a reason for hiding this comment

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

So I wouldn't make the base ChatModel depend on ChatService, it seems to me ChatService would be an implementation detail of the websocket chat implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it seems to me ChatService would be an implementation detail of the websocket chat implementation?

It is true for part of it, but some of the types/interfaces are more generics and used by the view.
I will split it, to import only the required types.

@brichet brichet added the enhancement New feature or request label Mar 4, 2024
@brichet brichet marked this pull request as ready for review March 15, 2024 15:12
@brichet brichet merged commit 9cc64e2 into jupyterlab:main Mar 15, 2024
5 of 6 checks passed
@brichet brichet deleted the add_chat_model branch March 15, 2024 16:03
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