forked from XiaoMo/ChatGPT-Next-Web
Merge pull request #2405 from Yidadaa/bugfix-0716
fix: #2367 do not copy in async callback after sharing to ShareGPT
This commit is contained in:
commit
13424a893e
@ -3,7 +3,7 @@ import { NextRequest, NextResponse } from "next/server";
|
|||||||
export const OPENAI_URL = "api.openai.com";
|
export const OPENAI_URL = "api.openai.com";
|
||||||
const DEFAULT_PROTOCOL = "https";
|
const DEFAULT_PROTOCOL = "https";
|
||||||
const PROTOCOL = process.env.PROTOCOL || DEFAULT_PROTOCOL;
|
const PROTOCOL = process.env.PROTOCOL || DEFAULT_PROTOCOL;
|
||||||
const BASE_URL = process.env.BASE_URL || OPENAI_URL; // ?? 仅在 undefined 时候才转向后者,但是环境变量大家都不会去注释掉变量,因此最好用 ||
|
const BASE_URL = process.env.BASE_URL || OPENAI_URL;
|
||||||
const DISABLE_GPT4 = !!process.env.DISABLE_GPT4;
|
const DISABLE_GPT4 = !!process.env.DISABLE_GPT4;
|
||||||
|
|
||||||
export async function requestOpenai(req: NextRequest) {
|
export async function requestOpenai(req: NextRequest) {
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
Modal,
|
Modal,
|
||||||
Select,
|
Select,
|
||||||
showImageModal,
|
showImageModal,
|
||||||
|
showModal,
|
||||||
showToast,
|
showToast,
|
||||||
} from "./ui-lib";
|
} from "./ui-lib";
|
||||||
import { IconButton } from "./button";
|
import { IconButton } from "./button";
|
||||||
@ -287,7 +288,30 @@ export function PreviewActions(props: {
|
|||||||
.share(msgs)
|
.share(msgs)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!res) return;
|
if (!res) return;
|
||||||
copyToClipboard(res);
|
showModal({
|
||||||
|
title: Locale.Export.Share,
|
||||||
|
children: [
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={res}
|
||||||
|
key="input"
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
maxWidth: "unset",
|
||||||
|
}}
|
||||||
|
readOnly
|
||||||
|
onClick={(e) => e.currentTarget.select()}
|
||||||
|
></input>,
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
<IconButton
|
||||||
|
icon={<CopyIcon />}
|
||||||
|
text={Locale.Chat.Actions.Copy}
|
||||||
|
key="copy"
|
||||||
|
onClick={() => copyToClipboard(res)}
|
||||||
|
/>,
|
||||||
|
],
|
||||||
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.open(res, "_blank");
|
window.open(res, "_blank");
|
||||||
}, 800);
|
}, 800);
|
||||||
|
Loading…
Reference in New Issue
Block a user