Fix unwanted data transmission to third party
This commit is contained in:
@@ -54,41 +54,6 @@ export class ClientApi {
|
|||||||
prompts() {}
|
prompts() {}
|
||||||
|
|
||||||
masks() {}
|
masks() {}
|
||||||
|
|
||||||
async share(messages: ChatMessage[], avatarUrl: string | null = null) {
|
|
||||||
const msgs = messages
|
|
||||||
.map((m) => ({
|
|
||||||
from: m.role === "user" ? "human" : "gpt",
|
|
||||||
value: m.content,
|
|
||||||
}))
|
|
||||||
.concat([
|
|
||||||
{
|
|
||||||
from: "human",
|
|
||||||
value:
|
|
||||||
"Share from [ChatGPT Next Web]: https://github.com/Yidadaa/ChatGPT-Next-Web",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
// 敬告二开开发者们,为了开源大模型的发展,请不要修改上述消息,此消息用于后续数据清洗使用
|
|
||||||
// Please do not modify this message
|
|
||||||
|
|
||||||
console.log("[Share]", msgs);
|
|
||||||
const res = await fetch("/sharegpt", {
|
|
||||||
body: JSON.stringify({
|
|
||||||
avatarUrl,
|
|
||||||
items: msgs,
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
method: "POST",
|
|
||||||
});
|
|
||||||
|
|
||||||
const resJson = await res.json();
|
|
||||||
console.log("[Share]", resJson);
|
|
||||||
if (resJson.id) {
|
|
||||||
return `https://shareg.pt/${resJson.id}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const api = new ClientApi();
|
export const api = new ClientApi();
|
||||||
|
|||||||
@@ -272,21 +272,6 @@ export function PreviewActions(props: {
|
|||||||
|
|
||||||
const onRenderMsgs = (msgs: ChatMessage[]) => {
|
const onRenderMsgs = (msgs: ChatMessage[]) => {
|
||||||
setShouldExport(false);
|
setShouldExport(false);
|
||||||
|
|
||||||
api
|
|
||||||
.share(msgs)
|
|
||||||
.then((res) => {
|
|
||||||
if (!res) return;
|
|
||||||
copyToClipboard(res);
|
|
||||||
setTimeout(() => {
|
|
||||||
window.open(res, "_blank");
|
|
||||||
}, 800);
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
console.error("[Share]", e);
|
|
||||||
showToast(prettyObject(e));
|
|
||||||
})
|
|
||||||
.finally(() => setLoading(false));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const share = async () => {
|
const share = async () => {
|
||||||
@@ -315,13 +300,6 @@ export function PreviewActions(props: {
|
|||||||
icon={<DownloadIcon />}
|
icon={<DownloadIcon />}
|
||||||
onClick={props.download}
|
onClick={props.download}
|
||||||
></IconButton>
|
></IconButton>
|
||||||
<IconButton
|
|
||||||
text={Locale.Export.Share}
|
|
||||||
bordered
|
|
||||||
shadow
|
|
||||||
icon={loading ? <LoadingIcon /> : <ShareIcon />}
|
|
||||||
onClick={share}
|
|
||||||
></IconButton>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -437,13 +415,10 @@ export function ImagePreviewer(props: {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div className={styles["main-title"]}>ChatGPT Next Web</div>
|
<div className={styles["main-title"]}>ChatGPT Pro by BBIG FUN</div>
|
||||||
<div className={styles["sub-title"]}>
|
|
||||||
github.com/Yidadaa/ChatGPT-Next-Web
|
|
||||||
</div>
|
|
||||||
<div className={styles["icons"]}>
|
<div className={styles["icons"]}>
|
||||||
<ExportAvatar avatar={config.avatar} />
|
{/* <ExportAvatar avatar={config.avatar} /> */}
|
||||||
<span className={styles["icon-space"]}>&</span>
|
{/* <span className={styles["icon-space"]}>&</span> */}
|
||||||
<ExportAvatar avatar={mask.avatar} />
|
<ExportAvatar avatar={mask.avatar} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ if (mode !== "export") {
|
|||||||
source: "/google-fonts/:path*",
|
source: "/google-fonts/:path*",
|
||||||
destination: "https://fonts.googleapis.com/:path*",
|
destination: "https://fonts.googleapis.com/:path*",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
source: "/sharegpt",
|
|
||||||
destination: "https://sharegpt.com/api/conversations",
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const apiUrl = process.env.API_URL;
|
const apiUrl = process.env.API_URL;
|
||||||
|
|||||||
Reference in New Issue
Block a user