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:
@@ -20,6 +20,9 @@ function convertMessages(messages, tools, model) {
|
|||||||
let pendingImages = [];
|
let pendingImages = [];
|
||||||
let currentRole = null;
|
let currentRole = null;
|
||||||
|
|
||||||
|
// Only Claude models support images in Kiro
|
||||||
|
const supportsImages = model && model.toLowerCase().includes("claude");
|
||||||
|
|
||||||
const flushPending = () => {
|
const flushPending = () => {
|
||||||
if (currentRole === "user") {
|
if (currentRole === "user") {
|
||||||
const content = pendingUserContent.join("\n\n").trim() || "continue";
|
const content = pendingUserContent.join("\n\n").trim() || "continue";
|
||||||
@@ -112,7 +115,7 @@ function convertMessages(messages, tools, model) {
|
|||||||
for (const c of msg.content) {
|
for (const c of msg.content) {
|
||||||
if (c.type === "text" || c.text) {
|
if (c.type === "text" || c.text) {
|
||||||
textParts.push(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
|
// OpenAI format: image_url.url with data URI
|
||||||
const url = c.image_url?.url || "";
|
const url = c.image_url?.url || "";
|
||||||
const base64Match = url.match(/^data:([^;]+);base64,(.+)$/);
|
const base64Match = url.match(/^data:([^;]+);base64,(.+)$/);
|
||||||
@@ -124,7 +127,7 @@ function convertMessages(messages, tools, model) {
|
|||||||
// Kiro only supports base64 — fallback to URL text
|
// Kiro only supports base64 — fallback to URL text
|
||||||
textParts.push(`[Image: ${url}]`);
|
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
|
// Claude format: source.type = "base64", source.media_type, source.data
|
||||||
if (c.source?.type === "base64" && c.source?.data) {
|
if (c.source?.type === "base64" && c.source?.data) {
|
||||||
const mediaType = c.source.media_type || "image/png";
|
const mediaType = c.source.media_type || "image/png";
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const navItems = [
|
|||||||
{ href: "/dashboard/endpoint", label: "Endpoint", icon: "api" },
|
{ href: "/dashboard/endpoint", label: "Endpoint", icon: "api" },
|
||||||
{ href: "/dashboard/providers", label: "Providers", icon: "dns" },
|
{ href: "/dashboard/providers", label: "Providers", icon: "dns" },
|
||||||
{ href: "/dashboard/proxy-pools", label: "Proxy Pools", icon: "lan" },
|
{ 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/combos", label: "Combos", icon: "layers" },
|
||||||
{ href: "/dashboard/usage", label: "Usage", icon: "bar_chart" },
|
{ href: "/dashboard/usage", label: "Usage", icon: "bar_chart" },
|
||||||
{ href: "/dashboard/quota", label: "Quota Tracker", icon: "data_usage" },
|
{ href: "/dashboard/quota", label: "Quota Tracker", icon: "data_usage" },
|
||||||
|
|||||||
Reference in New Issue
Block a user