import { useState } from "preact/hooks"; import { ChatStore } from "./app"; import { MessageDetail } from "./chatgpt"; import { Tr } from "./translate"; interface Props { chatStore: ChatStore; setChatStore: (cs: ChatStore) => void; images: MessageDetail[]; setShowAddImage: (se: boolean) => void; setImages: (images: MessageDetail[]) => void; } interface ImageResponse { url?: string; b64_json?: string; revised_prompt: string; } export function AddImage({ chatStore, setChatStore, setShowAddImage, setImages, images, }: Props) { const [enableHighResolution, setEnableHighResolution] = useState(true); const [imageGenPrompt, setImageGenPrompt] = useState(""); const [imageGenModel, setImageGenModel] = useState("dall-e-3"); const [imageGenN, setImageGenN] = useState(1); const [imageGenQuality, setImageGEnQuality] = useState("standard"); const [imageGenResponseFormat, setImageGenResponseFormat] = useState("b64_json"); const [imageGenSize, setImageGenSize] = useState("1024x1024"); const [imageGenStyle, setImageGenStyle] = useState("vivid"); const [imageGenGenerating, setImageGenGenerating] = useState(false); useState("b64_json"); return (
{ setShowAddImage(false); }} >
{ event.stopPropagation(); }} >

Add Images

{ setEnableHighResolution(!enableHighResolution); }} > {chatStore.image_gen_api && chatStore.image_gen_key && (

Generate Image