diff --git a/src/chatbox.tsx b/src/chatbox.tsx index 7716f05..373cf16 100644 --- a/src/chatbox.tsx +++ b/src/chatbox.tsx @@ -607,7 +607,7 @@ export default function ChatBOX(props: { {image.type === "image_url" && ( )} @@ -647,7 +647,16 @@ export default function ChatBOX(props: { if (!image_url) { return; } - setImages([...images, { type: "image_url", image_url }]); + setImages([ + ...images, + { + type: "image_url", + image_url: { + url: image_url, + detail: "low", + }, + }, + ]); }} > Add from URL @@ -673,7 +682,10 @@ export default function ChatBOX(props: { ...images, { type: "image_url", - image_url: String(base64data), + image_url: { + url: String(base64data), + detail: "low", + }, }, ]); }; @@ -690,7 +702,7 @@ export default function ChatBOX(props: { {image.type === "image_url" && ( )} @@ -700,7 +712,10 @@ export default function ChatBOX(props: { if (!image_url) { return; } - images[index].image_url = image_url; + images[index].image_url = { + url: image_url, + detail: "low", + }; setImages([...images]); }} > diff --git a/src/chatgpt.ts b/src/chatgpt.ts index 0646c4b..b213ad6 100644 --- a/src/chatgpt.ts +++ b/src/chatgpt.ts @@ -1,7 +1,12 @@ +export interface ImageURL { + url: string; + detail: "low" | "high"; +} + export interface MessageDetail { type: "text" | "image_url"; text?: string; - image_url?: string; + image_url?: ImageURL; } export interface Message { role: "system" | "user" | "assistant" | "function"; diff --git a/src/message.tsx b/src/message.tsx index cb243f5..657e38c 100644 --- a/src/message.tsx +++ b/src/message.tsx @@ -69,18 +69,23 @@ function EditMessage(props: EditMessageProps) { <> { - window.open(mdt.image_url, "_blank"); + window.open(mdt.image_url?.url, "_blank"); }} />