fix: preserve upstream model errors and native request parameters

This commit is contained in:
Agent Workbench Dev
2026-11-01 22:05:08 +08:00
parent 02cefd0498
commit 97c8dde70d
35 changed files with 816 additions and 75 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ export async function api<T>(path: string, input?: unknown,method?:string): Prom
...(input === undefined ? {} : { body: JSON.stringify(input) }),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error || '请求失败,请重试。');
if (!response.ok) throw Object.assign(new Error(body.error || '请求失败,请重试。'), { status: response.status, diagnostic: body.diagnostic ?? null });
return body as T;
}
export async function exportSession(id: string) {