feat: add local model gateway and console tabs

This commit is contained in:
lofyer
2026-10-12 14:21:13 +08:00
parent 9fa8f3e762
commit ec2c90d208
46 changed files with 3491 additions and 1120 deletions
+15
View File
@@ -0,0 +1,15 @@
export async function sharingRequest<T>(
path: string,
signal?: AbortSignal,
method = 'GET'
): Promise<T> {
const init: RequestInit = { signal }
if (method !== 'GET') init.method = method
const response = await fetch(`/api/v1/sharing${path}`, init)
const payload = await response.json().catch(() => null) as { code?: string; message?: string; requestId?: string } | null
if (!response.ok) {
const details = [payload?.code, payload?.requestId ? `请求 ID:${payload.requestId}` : ''].filter(Boolean).join(' · ')
throw new Error(`${payload?.message ?? `HTTP ${response.status}`}${details ? `(${details})` : ''}`)
}
return payload as T
}