import { useContext, useState } from "react"; import { ChatStore } from "@/types/chatstore"; import { MessageDetail } from "@/chatgpt"; import { Tr } from "@/translate"; import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "@/components/ui/drawer"; import { Button } from "./components/ui/button"; import { PenIcon, XIcon } from "lucide-react"; import { Checkbox } from "./components/ui/checkbox"; import { Label } from "./components/ui/label"; import { Textarea } from "./components/ui/textarea"; import { Separator } from "./components/ui/separator"; import { AppContext } from "./pages/App"; interface Props { images: MessageDetail[]; showAddImage: boolean; setShowAddImage: (se: boolean) => void; setImages: (images: MessageDetail[]) => void; } interface ImageResponse { url?: string; b64_json?: string; revised_prompt: string; } export function AddImage({ showAddImage, setShowAddImage, setImages, images, }: Props) { const ctx = useContext(AppContext); if (ctx === null) return <>; 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 (
Add Images
setEnableHighResolution(checked === true) } />
{ctx.chatStore.image_gen_api && ctx.chatStore.image_gen_key && (

Generate Image