import { ChatStore, ChatStoreMessage } from "./app"; import { calculate_token_length } from "./chatgpt"; import { Tr } from "./translate"; interface Props { chat: ChatStoreMessage; chatStore: ChatStore; setChatStore: (cs: ChatStore) => void; setShowEdit: (se: boolean) => void; } export function EditMessageDetail({ chat, chatStore, setChatStore, setShowEdit, }: Props) { if (typeof chat.content !== "object") return
error
; return (
event.stopPropagation()} > {chat.content.map((mdt, index) => (
{mdt.type === "text" ? ( ) : ( <> { window.open(mdt.image_url?.url, "_blank"); }} /> { if (typeof chat.content === "string") return; const obj = chat.content[index].image_url; if (obj === undefined) return; obj.detail = obj.detail === "high" ? "low" : "high"; chat.token = calculate_token_length(chat.content); setChatStore({ ...chatStore }); }} > )}
))}
); }