feat: allow send image only

This commit is contained in:
Dogtiti
2024-10-08 21:31:01 +08:00
parent 2bac174e6f
commit 7d55a6d0e4
2 changed files with 13 additions and 16 deletions

View File

@@ -337,22 +337,16 @@ export const useChatStore = createPersistStore(
if (attachImages && attachImages.length > 0) {
mContent = [
{
type: "text",
text: userContent,
},
...(userContent
? [{ type: "text" as const, text: userContent }]
: []),
...attachImages.map((url) => ({
type: "image_url" as const,
image_url: { url },
})),
];
mContent = mContent.concat(
attachImages.map((url) => {
return {
type: "image_url",
image_url: {
url: url,
},
};
}),
);
}
let userMessage: ChatMessage = createMessage({
role: "user",
content: mContent,