дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
Images sent to an agent were dropped from the conversation: the user message kept only text and file chips. User entries now record their images and show them as thumbnails that open full size; composer thumbnails open the same preview. Editing a sent message keeps its images (removable) and rerunning from it sends them again.
23 рядки
774 B
TypeScript
23 рядки
774 B
TypeScript
import type { AgentImage } from "@/bindings";
|
|
import { useTx } from "@/platform/i18n";
|
|
import { Dialog } from "@/ui";
|
|
import styles from "./ImagePreview.module.css";
|
|
|
|
export const imageSrc = (img: AgentImage) => `data:${img.mimeType};base64,${img.data}`;
|
|
|
|
/** The full image in a dialog; `null` keeps it closed. */
|
|
export function ImagePreview({ image, onClose }: { image: AgentImage | null; onClose: () => void }) {
|
|
const tx = useTx();
|
|
return (
|
|
<Dialog
|
|
open={image !== null}
|
|
onClose={onClose}
|
|
title={image?.name ?? tx("Image")}
|
|
width="min(90vw, 1000px)"
|
|
buttons={[{ label: tx("Close"), role: "cancel" }]}
|
|
>
|
|
{image && <img className={styles.full} src={imageSrc(image)} alt={image.name ?? tx("Image")} />}
|
|
</Dialog>
|
|
);
|
|
}
|