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.

This commit is contained in:
decolua
2026-03-23 12:29:48 +07:00
parent 4496bf96c8
commit 8df8b94180
2 changed files with 6 additions and 3 deletions

View File

@@ -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";

View File

@@ -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" },