From 0d50a179aa5af11d4cafe955e6b2a345eb592dfc Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 19 Dec 2025 12:07:06 +0800 Subject: [PATCH] fix: skip image parts for DeepSeek to avoid unknown variant "image_url" --- app/api/chat/route.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index cc844658..e2374d34 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -355,12 +355,17 @@ ${userInputText} ] // Add image parts back - for (const filePart of fileParts) { - contentParts.push({ - type: "image", - image: filePart.url, - mimeType: filePart.mediaType, - }) + const allowImages = + typeof modelId === "string" && + !modelId.toLowerCase().includes("deepseek") + if (allowImages) { + for (const filePart of fileParts) { + contentParts.push({ + type: "image", + image: filePart.url, + mimeType: filePart.mediaType, + }) + } } enhancedMessages = [