-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[editor] Image Output Rendering (#744)
# [editor] Image Output Rendering Get image output rendering with the updated output types, handling both file_uri and base64 encoding. ## Testing: - Tested both dall-e-2 and 3 models to ensure outputs render, toggle between uri/base64 and raw JSON: https://github.com/lastmile-ai/aiconfig/assets/5060851/0f73b765-d509-4305-a3bd-98ddb3005ff9 - Made sure the gpt4-v input rendering still works with updated MimeTypeRenderer component: <img width="1329" alt="Screenshot 2024-01-03 at 4 31 52 PM" src="https://github.com/lastmile-ai/aiconfig/assets/5060851/3ee6c82c-d393-41d3-9698-7e17a4a456dc">
- Loading branch information
Showing
4 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
python/src/aiconfig/editor/client/src/components/MimeTypeRenderer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { memo } from "react"; | ||
import { Image } from "@mantine/core"; | ||
|
||
type Props = { | ||
mimeType?: string; | ||
content: string; | ||
}; | ||
|
||
export default memo(function MimeTypeRenderer({ mimeType, content }: Props) { | ||
const mimetype = (mimeType ?? "text/plain").split("/", 1)[0]; // MIME type without subtype | ||
switch (mimetype) { | ||
case "image": | ||
// TODO: Figure out base64 encoding | ||
return <Image alt="Attachment image" src={content} maw={300} />; | ||
default: // "text" | ||
return <span>{content}</span>; | ||
} | ||
}); |
18 changes: 0 additions & 18 deletions
18
.../src/aiconfig/editor/client/src/components/prompt/prompt_input/attachments/Attachment.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters