feat(assets): add DeepSeek assistant with streaming results and voice input

This commit is contained in:
shishengliang
2026-09-23 14:16:36 +08:00
parent 822aabf2ca
commit 0c4a9bcd05
14 changed files with 3355 additions and 3 deletions
+6 -1
View File
@@ -6,7 +6,7 @@ export function setTokenGetter(fn: () => string | null) {
tokenGetter = fn;
}
export async function fetchJson<T>(url: string, options?: RequestInit): Promise<T> {
export async function fetchAuthenticated(url: string, options?: RequestInit): Promise<Response> {
const token = tokenGetter();
const res = await fetch(url, {
...options,
@@ -19,6 +19,11 @@ export async function fetchJson<T>(url: string, options?: RequestInit): Promise<
window.dispatchEvent(new CustomEvent('auth:unauthorized'));
throw new Error('Unauthorized');
}
return res;
}
export async function fetchJson<T>(url: string, options?: RequestInit): Promise<T> {
const res = await fetchAuthenticated(url, options);
if (!res.ok) throw new Error(`API error: ${res.status} ${res.statusText}`);
return res.json();
}