mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-03 08:36:39 +08:00
fix sd
This commit is contained in:
parent
b874a82fab
commit
6d01e6fb93
@ -10,7 +10,7 @@ export async function handle(
|
|||||||
console.log("[Stability] params ", params);
|
console.log("[Stability] params ", params);
|
||||||
|
|
||||||
if (req.method === "OPTIONS") {
|
if (req.method === "OPTIONS") {
|
||||||
return NextResponse.json({ body: "OK" }, { status: 200 });
|
return NextResponse.json({ body: "OK" }, { status: 200 } as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
@ -44,7 +44,7 @@ export async function handle(
|
|||||||
if (authResult.error) {
|
if (authResult.error) {
|
||||||
return NextResponse.json(authResult, {
|
return NextResponse.json(authResult, {
|
||||||
status: 401,
|
status: 401,
|
||||||
});
|
} as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bearToken = req.headers.get("Authorization") ?? "";
|
const bearToken = req.headers.get("Authorization") ?? "";
|
||||||
@ -60,7 +60,7 @@ export async function handle(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
status: 401,
|
status: 401,
|
||||||
},
|
} as any,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,19 +79,20 @@ export async function handle(
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
duplex: "half",
|
duplex: "half",
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
};
|
} as any;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(fetchUrl, fetchOptions);
|
const res = await fetch(fetchUrl, fetchOptions);
|
||||||
// to prevent browser prompt for credentials
|
// // to prevent browser prompt for credentials
|
||||||
const newHeaders = new Headers(res.headers);
|
|
||||||
newHeaders.delete("www-authenticate");
|
// const newHeaders = new Headers(res.headers);
|
||||||
// to disable nginx buffering
|
// newHeaders.delete("www-authenticate");
|
||||||
newHeaders.set("X-Accel-Buffering", "no");
|
// // to disable nginx buffering
|
||||||
|
// newHeaders.set("X-Accel-Buffering", "no");
|
||||||
|
|
||||||
return new Response(res.body, {
|
return new Response(res.body, {
|
||||||
status: res.status,
|
status: res.status,
|
||||||
statusText: res.statusText,
|
statusText: res.statusText,
|
||||||
headers: newHeaders,
|
// headers: newHeaders,
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
|
@ -163,6 +163,8 @@ export function Sd() {
|
|||||||
className={styles["img"]}
|
className={styles["img"]}
|
||||||
src={item.img_data}
|
src={item.img_data}
|
||||||
alt={item.id}
|
alt={item.id}
|
||||||
|
width={130}
|
||||||
|
height={130}
|
||||||
onClick={(e) =>
|
onClick={(e) =>
|
||||||
showImageModal(
|
showImageModal(
|
||||||
item.img_data,
|
item.img_data,
|
||||||
|
@ -292,17 +292,18 @@ export function SideBar(props: { className?: string }) {
|
|||||||
{/* }}*/}
|
{/* }}*/}
|
||||||
{/* shadow*/}
|
{/* shadow*/}
|
||||||
{/*/>*/}
|
{/*/>*/}
|
||||||
{/*<IconButton*/}
|
<IconButton
|
||||||
{/* icon={<DiscoveryIcon />}*/}
|
icon={<DiscoveryIcon />}
|
||||||
{/* text={shouldNarrow ? undefined : Locale.Discovery.Name}*/}
|
text={shouldNarrow ? undefined : Locale.Discovery.Name}
|
||||||
{/* className={styles["sidebar-bar-button"]}*/}
|
className={styles["sidebar-bar-button"]}
|
||||||
{/* onClick={() => setShowPluginSelector(true)}*/}
|
onClick={() => setShowPluginSelector(true)}
|
||||||
{/* shadow*/}
|
shadow
|
||||||
{/*/>*/}
|
/>
|
||||||
</div>
|
</div>
|
||||||
{showPluginSelector && (
|
{showPluginSelector && (
|
||||||
<Selector
|
<Selector
|
||||||
items={[
|
items={
|
||||||
|
[
|
||||||
{
|
{
|
||||||
title: "👇 Please select the plugin you need to use",
|
title: "👇 Please select the plugin you need to use",
|
||||||
value: "-",
|
value: "-",
|
||||||
@ -314,7 +315,8 @@ export function SideBar(props: { className?: string }) {
|
|||||||
value: item.path,
|
value: item.path,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
]}
|
] as any
|
||||||
|
}
|
||||||
onClose={() => setShowPluginSelector(false)}
|
onClose={() => setShowPluginSelector(false)}
|
||||||
onSelection={(s) => {
|
onSelection={(s) => {
|
||||||
navigate(s[0], { state: { fromHome: true } });
|
navigate(s[0], { state: { fromHome: true } });
|
||||||
|
@ -88,7 +88,7 @@ export const useSdStore = createPersistStore<
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
body: formData,
|
body: formData,
|
||||||
})
|
} as RequestInit)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((resData) => {
|
.then((resData) => {
|
||||||
if (resData.errors && resData.errors.length > 0) {
|
if (resData.errors && resData.errors.length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user