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

render generated images inline with the message #706

Merged
merged 12 commits into from
Oct 4, 2024
Merged

Conversation

snopoke
Copy link
Collaborator

@snopoke snopoke commented Oct 4, 2024

Description

This updates the message processing and rendering to insert generated images as inline image links into the output markdown.

The markdown rendered will then render them as images.

Also fix for DIMAGI-BOTS-FA

User Impact

Images are displayed in the message. This only applies to web chat when using Assistants to generate images.

Demo

image

Docs

NA

@snopoke snopoke requested a review from SmittieC October 4, 2024 10:25
Copy link

sentry-io bot commented Oct 4, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: apps/utils/markdown.py

Function Unhandled Issue
getLink ValueError: not enough values to unpack (expected 4, got 1) /a/{team_slug}/experiments/e/{experiment_id}/session/{s...
Event Count: 1

Did you find this useful? React with a 👍 or 👎

SmittieC
SmittieC previously approved these changes Oct 4, 2024
Copy link
Collaborator

@SmittieC SmittieC left a comment

Choose a reason for hiding this comment

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

cool

This makes it more universal and also updates the code to include the file extension in the Django file which is used when downloading the file.
SmittieC
SmittieC previously approved these changes Oct 4, 2024
Copy link
Collaborator

@SmittieC SmittieC left a comment

Choose a reason for hiding this comment

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

This is quite cool, thanks. Do you think we should make the image a bit smaller? Not sure how easy that would be.

@snopoke
Copy link
Collaborator Author

snopoke commented Oct 4, 2024

This is quite cool, thanks. Do you think we should make the image a bit smaller? Not sure how easy that would be.

Perhaps but I'm considering this out of scope for now. We could potentially implement it using markdown without resizing the image itself: https://stackoverflow.com/a/21242579

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 67.85714% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/assistants/sync.py 21.42% 11 Missing ⚠️
apps/utils/markdown.py 30.00% 7 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

@snopoke snopoke requested a review from SmittieC October 4, 2024 12:20
@snopoke snopoke merged commit def8349 into main Oct 4, 2024
4 checks passed
@snopoke snopoke deleted the sk/inline-images branch October 4, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants