mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-25 00:46:11 +08:00
hotfix for plugin runtime
This commit is contained in:
@@ -320,9 +320,12 @@ export function adapter(config: Record<string, unknown>) {
|
|||||||
const fetchUrl = params
|
const fetchUrl = params
|
||||||
? `${path}?${new URLSearchParams(params as any).toString()}`
|
? `${path}?${new URLSearchParams(params as any).toString()}`
|
||||||
: path;
|
: path;
|
||||||
return fetch(fetchUrl as string, { ...rest, responseType: "text" })
|
return fetch(fetchUrl as string, { ...rest, responseType: "text" }).then(
|
||||||
.then((res) => res.text())
|
(res) => {
|
||||||
.then((data) => ({ data }));
|
const { status, headers } = res;
|
||||||
|
return res.text().then((data) => ({ status, headers, data }));
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function safeLocalStorage(): {
|
export function safeLocalStorage(): {
|
||||||
|
@@ -222,7 +222,10 @@ export function stream(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const content = JSON.stringify(res.data);
|
let content = res.data;
|
||||||
|
try {
|
||||||
|
content = JSON.stringify(res.data);
|
||||||
|
} catch (e) {}
|
||||||
if (res.status >= 300) {
|
if (res.status >= 300) {
|
||||||
return Promise.reject(content);
|
return Promise.reject(content);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user