mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-09-10 06:47:51 +08:00
feat: model provider refactor done
This commit is contained in:
25
app/client/core/shim.ts
Normal file
25
app/client/core/shim.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { getClientConfig } from "@/app/config/client";
|
||||
|
||||
if (!(window.fetch as any).__hijacked__) {
|
||||
let _fetch = window.fetch;
|
||||
|
||||
function fetch(...args: Parameters<typeof _fetch>) {
|
||||
const { isApp } = getClientConfig() || {};
|
||||
|
||||
let fetch: typeof _fetch = _fetch;
|
||||
|
||||
if (isApp) {
|
||||
try {
|
||||
fetch = window.__TAURI__!.http.fetch;
|
||||
} catch (e) {
|
||||
fetch = _fetch;
|
||||
}
|
||||
}
|
||||
|
||||
return fetch(...args);
|
||||
}
|
||||
|
||||
fetch.__hijacked__ = true;
|
||||
|
||||
window.fetch = fetch;
|
||||
}
|
Reference in New Issue
Block a user