From 9be58f3eb4217b00073a954262ac4e5b970806f3 Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Mon, 30 Sep 2024 01:30:20 +0800 Subject: [PATCH] fix ts error --- app/client/platforms/alibaba.ts | 2 +- app/client/platforms/baidu.ts | 2 +- app/client/platforms/bytedance.ts | 2 +- app/client/platforms/google.ts | 2 +- app/client/platforms/iflytek.ts | 2 +- app/client/platforms/tencent.ts | 2 +- app/store/sync.ts | 2 +- app/utils/chat.ts | 2 +- app/utils/stream.ts | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/client/platforms/alibaba.ts b/app/client/platforms/alibaba.ts index 727e3aebf..86229a147 100644 --- a/app/client/platforms/alibaba.ts +++ b/app/client/platforms/alibaba.ts @@ -179,7 +179,7 @@ export class QwenApi implements LLMApi { controller.signal.onabort = finish; fetchEventSource(chatPath, { - fetch, + fetch: fetch as any, ...chatPayload, async onopen(res) { clearTimeout(requestTimeoutId); diff --git a/app/client/platforms/baidu.ts b/app/client/platforms/baidu.ts index 4f3294d5e..2511a696b 100644 --- a/app/client/platforms/baidu.ts +++ b/app/client/platforms/baidu.ts @@ -198,7 +198,7 @@ export class ErnieApi implements LLMApi { controller.signal.onabort = finish; fetchEventSource(chatPath, { - fetch, + fetch: fetch as any, ...chatPayload, async onopen(res) { clearTimeout(requestTimeoutId); diff --git a/app/client/platforms/bytedance.ts b/app/client/platforms/bytedance.ts index 279be815f..000a9e278 100644 --- a/app/client/platforms/bytedance.ts +++ b/app/client/platforms/bytedance.ts @@ -166,7 +166,7 @@ export class DoubaoApi implements LLMApi { controller.signal.onabort = finish; fetchEventSource(chatPath, { - fetch, + fetch: fetch as any, ...chatPayload, async onopen(res) { clearTimeout(requestTimeoutId); diff --git a/app/client/platforms/google.ts b/app/client/platforms/google.ts index 7a74dd4f3..dcf300a0f 100644 --- a/app/client/platforms/google.ts +++ b/app/client/platforms/google.ts @@ -214,7 +214,7 @@ export class GeminiProApi implements LLMApi { controller.signal.onabort = finish; fetchEventSource(chatPath, { - fetch, + fetch: fetch as any, ...chatPayload, async onopen(res) { clearTimeout(requestTimeoutId); diff --git a/app/client/platforms/iflytek.ts b/app/client/platforms/iflytek.ts index 07bfeda58..de638829e 100644 --- a/app/client/platforms/iflytek.ts +++ b/app/client/platforms/iflytek.ts @@ -150,7 +150,7 @@ export class SparkApi implements LLMApi { controller.signal.onabort = finish; fetchEventSource(chatPath, { - fetch, + fetch: fetch as any, ...chatPayload, async onopen(res) { clearTimeout(requestTimeoutId); diff --git a/app/client/platforms/tencent.ts b/app/client/platforms/tencent.ts index 28f5b56f2..3610fac0a 100644 --- a/app/client/platforms/tencent.ts +++ b/app/client/platforms/tencent.ts @@ -178,7 +178,7 @@ export class HunyuanApi implements LLMApi { controller.signal.onabort = finish; fetchEventSource(chatPath, { - fetch, + fetch: fetch as any, ...chatPayload, async onopen(res) { clearTimeout(requestTimeoutId); diff --git a/app/store/sync.ts b/app/store/sync.ts index c53a7a82a..8477c1e4b 100644 --- a/app/store/sync.ts +++ b/app/store/sync.ts @@ -25,7 +25,7 @@ export type SyncStore = GetStoreState; const DEFAULT_SYNC_STATE = { provider: ProviderType.WebDAV, useProxy: true, - proxyUrl: ApiPath.Cors, + proxyUrl: ApiPath.Cors as string, webdav: { endpoint: "", diff --git a/app/utils/chat.ts b/app/utils/chat.ts index 359b2c53e..254cef401 100644 --- a/app/utils/chat.ts +++ b/app/utils/chat.ts @@ -288,7 +288,7 @@ export function stream( REQUEST_TIMEOUT_MS, ); fetchEventSource(chatPath, { - fetch: tauriFetch, + fetch: tauriFetch as any, ...chatPayload, async onopen(res) { clearTimeout(requestTimeoutId); diff --git a/app/utils/stream.ts b/app/utils/stream.ts index 625ecea1f..e8850fcba 100644 --- a/app/utils/stream.ts +++ b/app/utils/stream.ts @@ -63,7 +63,7 @@ export function fetch(url: string, options?: RequestInit): Promise { }) .then((u: Function) => (unlisten = u)); - const headers = { + const headers: Record = { Accept: "application/json, text/plain, */*", "Accept-Language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7", "User-Agent": navigator.userAgent,