refactor: improve formatting of promise return types in aiRequest and chatStream functions

This commit is contained in:
troyeguo committed 2026-08-13 17:28:41 +08:00
1 parent 44f70a58e8
commit e9c3e14985
1 file changed
+7 -3
+7 -3
View File
@@ -69,7 +69,12 @@ export const aiRequest = async (
method: "GET" | "POST",
headers: Record<string, string>,
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);