mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
fix(cliproxyapi): address remaining Kilo review issues
- Wrap JSON.parse in try/catch in rowToConfig (upstreamProxy.ts) - Add error logging to empty catch blocks in CliproxyapiToolCard - Pin Docker image to v6.9.7 instead of :latest
This commit is contained in:
@@ -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}"
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -74,14 +74,19 @@ export function validateProxyUrl(
|
||||
}
|
||||
|
||||
function rowToConfig(record: Record<string, unknown>): UpstreamProxyConfig {
|
||||
let mapping: Record<string, unknown> | 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,
|
||||
|
||||
Reference in New Issue
Block a user