mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-03 16:46:40 +08:00
commit
85328cb35b
@ -31,6 +31,9 @@ declare global {
|
|||||||
// google only
|
// google only
|
||||||
GOOGLE_API_KEY?: string;
|
GOOGLE_API_KEY?: string;
|
||||||
GOOGLE_URL?: string;
|
GOOGLE_URL?: string;
|
||||||
|
|
||||||
|
// google tag manager
|
||||||
|
GTM_ID?: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
app/global.d.ts
vendored
1
app/global.d.ts
vendored
@ -19,6 +19,7 @@ declare interface Window {
|
|||||||
};
|
};
|
||||||
fs: {
|
fs: {
|
||||||
writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
|
writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
|
||||||
|
writeTextFile(path: string, data: string): Promise<void>;
|
||||||
};
|
};
|
||||||
notification: {
|
notification: {
|
||||||
requestPermission(): Promise<Permission>;
|
requestPermission(): Promise<Permission>;
|
||||||
|
11
app/utils.ts
11
app/utils.ts
@ -8,10 +8,12 @@ export function trimTopic(topic: string) {
|
|||||||
// Fix an issue where double quotes still show in the Indonesian language
|
// Fix an issue where double quotes still show in the Indonesian language
|
||||||
// This will remove the specified punctuation from the end of the string
|
// This will remove the specified punctuation from the end of the string
|
||||||
// and also trim quotes from both the start and end if they exist.
|
// and also trim quotes from both the start and end if they exist.
|
||||||
return topic
|
return (
|
||||||
|
topic
|
||||||
// fix for gemini
|
// fix for gemini
|
||||||
.replace(/^["“”*]+|["“”*]+$/g, "")
|
.replace(/^["“”*]+|["“”*]+$/g, "")
|
||||||
.replace(/[,。!?”“"、,.!?*]*$/, "");
|
.replace(/[,。!?”“"、,.!?*]*$/, "")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function copyToClipboard(text: string) {
|
export async function copyToClipboard(text: string) {
|
||||||
@ -57,10 +59,7 @@ export async function downloadAs(text: string, filename: string) {
|
|||||||
|
|
||||||
if (result !== null) {
|
if (result !== null) {
|
||||||
try {
|
try {
|
||||||
await window.__TAURI__.fs.writeBinaryFile(
|
await window.__TAURI__.fs.writeTextFile(result, text);
|
||||||
result,
|
|
||||||
new Uint8Array([...text].map((c) => c.charCodeAt(0))),
|
|
||||||
);
|
|
||||||
showToast(Locale.Download.Success);
|
showToast(Locale.Download.Success);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
showToast(Locale.Download.Failed);
|
showToast(Locale.Download.Failed);
|
||||||
|
Loading…
Reference in New Issue
Block a user