From e9c3e14985d4222fe681ae54d99bc43ae060294f Mon Sep 17 00:00:00 2001 From: troyeguo <13820674+troyeguo@users.noreply.github.com> Date: Thu, 13 Aug 2026 17:28:41 +0800 Subject: [PATCH] refactor: improve formatting of promise return types in aiRequest and chatStream functions --- src/utils/request/common.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/request/common.ts b/src/utils/request/common.ts index 3660a3de..4ccba4a4 100644 --- a/src/utils/request/common.ts +++ b/src/utils/request/common.ts @@ -69,7 +69,12 @@ export const aiRequest = async ( method: "GET" | "POST", headers: Record, body?: string -): Promise<{ ok: boolean; status: number; statusText: string; body: string }> => { +): Promise<{ + ok: boolean; + status: number; + statusText: string; + body: string; +}> => { if (isElectron) { return await window.electronAPI.invoke("ai-request", { url, @@ -118,8 +123,7 @@ export const chatStream = async ( return new Promise<{ done: boolean }>((resolve, reject) => { const ipcRenderer = window.electronAPI; const streamId = - typeof crypto !== "undefined" && - typeof crypto.randomUUID === "function" + typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : Math.random().toString(36).slice(2) + Date.now().toString(36);