-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Message attachments #148
base: main
Are you sure you want to change the base?
Message attachments #148
Conversation
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.
@brichet Thank you for working on this while I was away! Left some feedback below.
export interface IChatMessage<T = IUser, U = IAttachment> { | ||
type: 'msg'; | ||
body: string; | ||
id: string; | ||
time: number; | ||
sender: T; | ||
attachments?: U[]; |
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.
Does it make sense to type attachments
as a generic type argument if we're providing an interface (IAttachment
)? This allows any generic type U
, including primitives like number
or boolean
which may not be handled by the backend.
I think it makes sense to require attachments to all be dictionaries and enforce an interface:
export interface IChatMessage<T = IUser, U = IAttachment> { | |
type: 'msg'; | |
body: string; | |
id: string; | |
time: number; | |
sender: T; | |
attachments?: U[]; | |
export interface IChatMessage<T = IUser> { | |
type: 'msg'; | |
body: string; | |
id: string; | |
time: number; | |
sender: T; | |
attachments?: IAttachment[]; |
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.
This interface is reused in jupyterlab-chat
packages with the IYmessage
. In this case, it is only an id of an attachment (same as the users), to avoid saving several time the same attachment in the final document.
d3cfaae
to
a96b7e5
Compare
Thanks for the review @dlqqq, I addressed some of your comments. I'll take a look at an alternative to |
Co-authored-by: David L. Qiu <[email protected]>
Co-authored-by: David L. Qiu <[email protected]>
2658548
to
f9f5a6b
Compare
packages/jupyter-chat/src/model.ts
Outdated
/** | ||
* A signal emitting when the input attachments changed. | ||
*/ | ||
readonly inputAttachmentsChanges?: ISignal<IChatModel, IAttachment[]>; |
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.
Maybe with the following spelling, similar to the names of other signals?
readonly inputAttachmentsChanges?: ISignal<IChatModel, IAttachment[]>; | |
readonly inputAttachmentsChanged?: ISignal<IChatModel, IAttachment[]>; |
The recurrent failing test do not fails locally. And strangely, it constantly fails at opening the chat, which is done in other tests with the same chat file... |
Draft implementation of #147
EDIT:
Updating the screen-cast
record-2025-02-13_11.04.21.webm
There is now a lite deployment in the built doc including a simple extension with a chat panel. I updated it to allow attachments https://jupyter-chat--148.org.readthedocs.build/en/148/lite/lab/index.html