mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 07:36:39 +08:00
fix: export method
This commit is contained in:
parent
7d446cc7f8
commit
64c7fa9cbf
@ -367,12 +367,12 @@ export function Chat(props: {
|
|||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
<IconButton
|
<IconButton
|
||||||
key="exportPng"
|
key="exportJpeg"
|
||||||
icon={<ExportImage />}
|
icon={<ExportImage />}
|
||||||
bordered
|
bordered
|
||||||
text={Locale.Chat.Actions.ExportImage}
|
text={Locale.Chat.Actions.ExportImage}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
dataUrl.current && exportPng(topic, dataUrl.current);
|
dataUrl.current && exportJpeg(topic, dataUrl.current);
|
||||||
}}
|
}}
|
||||||
/>,
|
/>,
|
||||||
],
|
],
|
||||||
@ -632,11 +632,13 @@ function showMemoryPrompt(session: ChatSession) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportPng(topic: string, dataURL: string) {
|
function exportJpeg(topic: string, dataURL: string) {
|
||||||
const a = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
a.href = dataURL;
|
link.href = dataURL;
|
||||||
a.download = `${topic}-${new Date().toLocaleString()}.jpg`;
|
link.download = `${topic}-${new Date().toLocaleString()}.jpg`;
|
||||||
a.click();
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
const useHasHydrated = () => {
|
const useHasHydrated = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user