-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Willy/sidebar #1779
Willy/sidebar #1779
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.
Please provide a link to documentation PR describing the feature, so I have some spec to evaluate it against. :)
Also see other comments, mostly to add a bit of docstrings explaining what's going on.
id: str | ||
threadId: Optional[str] | ||
type: ElementType | ||
chainlitKey: Optional[str] | ||
path: Optional[str] |
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.
What does path here mean?
Having comments here on the meaning of these fields would improve developer experience.
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.
path is the local path of the element, a developer can load an image from path or url for instance.
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.
Great, having that in a comment would help other devs!
backend/chainlit/element.py
Outdated
chainlit_key=_dict.get("id"), | ||
display="inline", | ||
mime=type, | ||
def from_dict(cls, _dict: ElementDict): |
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.
Normally, _
-prefixed variables signify private scope. Hence, I would recommend using a semantic name (to prevent using reserved dict). Something like e_dict
?
backend/chainlit/element.py
Outdated
|
||
# Image handling (excluding SVG which is treated as a file) | ||
if type == "image" and "svg" not in mime_type: | ||
return Image(size="medium", **common_params) # type: ignore |
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.
Why ignore typing here?
In case we ignore the type checker, I think:
- We should have a good reason for it.
- We should add a comment describing the reason.
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.
mypy is not happy with the ** decomposition in the class instantiation
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 PR doesn't included in the |
Still not fixed in the |
No description provided.