diff --git a/docker-compose.yml b/docker-compose.yml index 848f36a90e..4c658d7493 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -115,7 +115,7 @@ services: # ── Profile: cliproxyapi (CLIProxyAPI as sidecar) ───────────────── cliproxyapi: container_name: cliproxyapi - image: ghcr.io/router-for-me/cliproxyapi:latest + image: ghcr.io/router-for-me/cliproxyapi:v6.9.7 restart: unless-stopped ports: - "${CLIPROXYAPI_PORT:-8317}:${CLIPROXYAPI_PORT:-8317}" diff --git a/src/app/(dashboard)/dashboard/cli-tools/components/CliproxyapiToolCard.tsx b/src/app/(dashboard)/dashboard/cli-tools/components/CliproxyapiToolCard.tsx index 9f3ad3d576..62f0e49d14 100644 --- a/src/app/(dashboard)/dashboard/cli-tools/components/CliproxyapiToolCard.tsx +++ b/src/app/(dashboard)/dashboard/cli-tools/components/CliproxyapiToolCard.tsx @@ -32,19 +32,25 @@ export default function CliproxyapiToolCard({ isExpanded, onToggle }) { const fetchStatus = useCallback(async () => { try { const res = await fetch("/api/version-manager/status"); + if (!res.ok) return; const data = await res.json(); const entry = Array.isArray(data) ? data.find((t: ToolState) => t.tool === "cliproxyapi") : null; setToolState(entry || null); - } catch {} + } catch (err) { + console.error("Failed to fetch CLIProxyAPI status:", err); + } }, []); const fetchUpdateInfo = useCallback(async () => { try { const res = await fetch("/api/version-manager/check-update?tool=cliproxyapi"); + if (!res.ok) return; setUpdateInfo(await res.json()); - } catch {} + } catch (err) { + console.error("Failed to fetch CLIProxyAPI update info:", err); + } }, []); useEffect(() => { diff --git a/src/lib/db/upstreamProxy.ts b/src/lib/db/upstreamProxy.ts index fdad87e73c..c306482b23 100644 --- a/src/lib/db/upstreamProxy.ts +++ b/src/lib/db/upstreamProxy.ts @@ -74,14 +74,19 @@ export function validateProxyUrl( } function rowToConfig(record: Record): UpstreamProxyConfig { + let mapping: Record | null = null; + if (record.cliproxyapi_model_mapping && typeof record.cliproxyapi_model_mapping === "string") { + try { + mapping = JSON.parse(record.cliproxyapi_model_mapping); + } catch { + mapping = null; + } + } return { id: record.id as number, providerId: record.provider_id as string, mode: record.mode as string, - cliproxyapiModelMapping: - record.cliproxyapi_model_mapping && typeof record.cliproxyapi_model_mapping === "string" - ? JSON.parse(record.cliproxyapi_model_mapping) - : null, + cliproxyapiModelMapping: mapping, nativePriority: record.native_priority as number, cliproxyapiPriority: record.cliproxyapi_priority as number, enabled: record.enabled === 1 || record.enabled === true,