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

Willy/sidebar #1779

Merged
merged 8 commits into from
Jan 23, 2025
Merged

Willy/sidebar #1779

merged 8 commits into from
Jan 23, 2025

Conversation

willydouhard
Copy link
Collaborator

No description provided.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. backend Pertains to the Python backend. frontend Pertains to the frontend. labels Jan 22, 2025
Copy link
Collaborator

@dokterbob dokterbob left a 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]
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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!

chainlit_key=_dict.get("id"),
display="inline",
mime=type,
def from_dict(cls, _dict: ElementDict):
Copy link
Collaborator

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?


# 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
Copy link
Collaborator

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:

  1. We should have a good reason for it.
  2. We should add a comment describing the reason.

Copy link
Collaborator Author

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's probably because common_params isn't typed. Or, actually, a bit of a loss on the side of mypy.

image

backend/chainlit/element.py Show resolved Hide resolved
backend/chainlit/element.py Outdated Show resolved Hide resolved
backend/chainlit/sidebar.py Show resolved Hide resolved
@willydouhard willydouhard merged commit ead5429 into main Jan 23, 2025
9 checks passed
@willydouhard willydouhard deleted the willy/sidebar branch January 23, 2025 19:31
@ilkersigirci
Copy link

This PR doesn't included in the 2.0.6 release. I guess there is a merge issue here FYI @willydouhard @dokterbob

@ilkersigirci
Copy link

ilkersigirci commented Jan 28, 2025

Still not fixed in the 2.0.603 release, hence sidebar still can't be used. Please, look at this @willydouhard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Pertains to the Python backend. frontend Pertains to the frontend. size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants