Ideally I would keep the array of Attachment on the chat history so the attachments would be rendered by the PreviewAttachment component, but I noticed that doing that results in a overuse of tokens. Apparently the models keep processing those attachments for every follow up message, even when the follow up user messages only has texts (I only tested this with OpenAI's models but I believe this behaviour is not model-specific).
So this approach appends a markdown by the end of the text to render the images, and a new CSS class on globals.css makes it a little nicer.
Fixes #475
Ideally I would keep the array of
Attachment
on the chat history so the attachments would be rendered by thePreviewAttachment
component, but I noticed that doing that results in a overuse of tokens. Apparently the models keep processing those attachments for every follow up message, even when the follow up user messages only has texts (I only tested this with OpenAI's models but I believe this behaviour is not model-specific).So this approach appends a markdown by the end of the text to render the images, and a new CSS class on
globals.css
makes it a little nicer.Before:
After:
If the image is tall:
Multiple images: