From 8df8b941802cf6a629af972c113129bdc0494fde Mon Sep 17 00:00:00 2001 From: decolua Date: Mon, 23 Mar 2026 12:29:48 +0700 Subject: [PATCH] Enhance image support in Kiro for Claude models. Update the message conversion logic to conditionally handle image types based on model capabilities. Additionally, hide the Basic Chat option in the sidebar for a cleaner UI. --- open-sse/translator/request/openai-to-kiro.js | 7 +++++-- src/shared/components/Sidebar.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/open-sse/translator/request/openai-to-kiro.js b/open-sse/translator/request/openai-to-kiro.js index 7cea2195..f07259ca 100644 --- a/open-sse/translator/request/openai-to-kiro.js +++ b/open-sse/translator/request/openai-to-kiro.js @@ -20,6 +20,9 @@ function convertMessages(messages, tools, model) { let pendingImages = []; let currentRole = null; + // Only Claude models support images in Kiro + const supportsImages = model && model.toLowerCase().includes("claude"); + const flushPending = () => { if (currentRole === "user") { const content = pendingUserContent.join("\n\n").trim() || "continue"; @@ -112,7 +115,7 @@ function convertMessages(messages, tools, model) { for (const c of msg.content) { if (c.type === "text" || c.text) { textParts.push(c.text || ""); - } else if (c.type === "image_url") { + } else if (supportsImages && c.type === "image_url") { // OpenAI format: image_url.url with data URI const url = c.image_url?.url || ""; const base64Match = url.match(/^data:([^;]+);base64,(.+)$/); @@ -124,7 +127,7 @@ function convertMessages(messages, tools, model) { // Kiro only supports base64 — fallback to URL text textParts.push(`[Image: ${url}]`); } - } else if (c.type === "image") { + } else if (supportsImages && c.type === "image") { // Claude format: source.type = "base64", source.media_type, source.data if (c.source?.type === "base64" && c.source?.data) { const mediaType = c.source.media_type || "image/png"; diff --git a/src/shared/components/Sidebar.js b/src/shared/components/Sidebar.js index 2448f370..67c4195e 100644 --- a/src/shared/components/Sidebar.js +++ b/src/shared/components/Sidebar.js @@ -13,7 +13,7 @@ const navItems = [ { href: "/dashboard/endpoint", label: "Endpoint", icon: "api" }, { href: "/dashboard/providers", label: "Providers", icon: "dns" }, { href: "/dashboard/proxy-pools", label: "Proxy Pools", icon: "lan" }, - { href: "/dashboard/basic-chat", label: "Basic Chat", icon: "chat" }, + // { href: "/dashboard/basic-chat", label: "Basic Chat", icon: "chat" }, // Hidden { href: "/dashboard/combos", label: "Combos", icon: "layers" }, { href: "/dashboard/usage", label: "Usage", icon: "bar_chart" }, { href: "/dashboard/quota", label: "Quota Tracker", icon: "data_usage" },