diff --git a/app/api/google/[...path]/route.ts b/app/api/google/[...path]/route.ts index 869bd507638..ebd19289129 100644 --- a/app/api/google/[...path]/route.ts +++ b/app/api/google/[...path]/route.ts @@ -101,19 +101,14 @@ export const POST = handle; export const runtime = "edge"; export const preferredRegion = [ - "arn1", "bom1", - "cdg1", "cle1", "cpt1", - "dub1", - "fra1", "gru1", "hnd1", "iad1", "icn1", "kix1", - "lhr1", "pdx1", "sfo1", "sin1", diff --git a/app/constant.ts b/app/constant.ts index 53d47540ac6..8f251814088 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -107,7 +107,9 @@ export const SUMMARIZE_MODEL = "gpt-3.5-turbo"; export const KnowledgeCutOffDate: Record = { default: "2021-09", + "gpt-4-turbo-preview": "2023-04", "gpt-4-1106-preview": "2023-04", + "gpt-4-0125-preview": "2023-04", "gpt-4-vision-preview": "2023-04", }; @@ -166,6 +168,15 @@ export const DEFAULT_MODELS = [ providerType: "openai", }, }, + { + name: "gpt-4-turbo-preview", + available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, { name: "gpt-4-1106-preview", available: true, @@ -175,6 +186,15 @@ export const DEFAULT_MODELS = [ providerType: "openai", }, }, + { + name: "gpt-4-0125-preview", + available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, { name: "gpt-4-vision-preview", available: true, diff --git a/app/store/mask.ts b/app/store/mask.ts index 36349284b52..4befeeef556 100644 --- a/app/store/mask.ts +++ b/app/store/mask.ts @@ -47,10 +47,23 @@ export const useMaskStore = createPersistStore( const masks = get().masks; // 检查要导入的项目是否重复 for (let existingMask of Object.values(masks)) { - if (existingMask.name === mask?.name && - JSON.stringify(existingMask.context) === JSON.stringify(mask?.context)) { - console.log("A mask with the same name and context already exists."); - return existingMask; + if (existingMask.name === mask?.name) { + if ( + JSON.stringify(existingMask.context) === + JSON.stringify(mask?.context) + ) { + console.log( + "A mask with the same name and context already exists.", + ); + return existingMask; + } else { + // 只有name重复,给name加上今天的日期和时间 + let now = new Date(); + let year = String(now.getFullYear()).slice(-2); // 获取年份的最后两位 + mask.name = `${mask.name}@${year}-${ + now.getMonth() + 1 + }-${now.getDate()}@${now.getHours()}:${now.getMinutes()}`; + } } } const id = nanoid(); diff --git a/app/utils.ts b/app/utils.ts index f83d06d1958..e41dfa1fddd 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -6,7 +6,9 @@ export function trimTopic(topic: string) { // Fix an issue where double quotes still show in the Indonesian language // 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. - return topic.replace(/^["“”]+|["“”]+$/g, "").replace(/[,。!?”“"、,.!?]*$/, ""); + return topic + .replace(/^["“”]+|["“”]+$/g, "") + .replace(/[,。!?”“"、,.!?]*$/, ""); } export async function copyToClipboard(text: string) { @@ -40,8 +42,8 @@ export async function downloadAs(text: string, filename: string) { defaultPath: `${filename}`, filters: [ { - name: `${filename.split('.').pop()} files`, - extensions: [`${filename.split('.').pop()}`], + name: `${filename.split(".").pop()} files`, + extensions: [`${filename.split(".").pop()}`], }, { name: "All Files", @@ -56,7 +58,7 @@ export async function downloadAs(text: string, filename: string) { // result, // new Uint8Array([...text].map((c) => c.charCodeAt(0))) // ); - // 修复客户端导出json时的乱码现象 + // 修复客户端导出json时的乱码现象 const encoder = new TextEncoder(); const data = encoder.encode(text); await window.__TAURI__.fs.writeBinaryFile(result, new Uint8Array(data)); @@ -73,15 +75,15 @@ export async function downloadAs(text: string, filename: string) { "href", "data:text/plain;charset=utf-8," + encodeURIComponent(text), ); - element.setAttribute("download", filename); + element.setAttribute("download", filename); - element.style.display = "none"; - document.body.appendChild(element); + element.style.display = "none"; + document.body.appendChild(element); - element.click(); + element.click(); - document.body.removeChild(element); -} + document.body.removeChild(element); + } } export function readFromFile() { return new Promise((res, rej) => { @@ -216,8 +218,8 @@ export function getCSSVar(varName: string) { export function isMacOS(): boolean { if (typeof window !== "undefined") { let userAgent = window.navigator.userAgent.toLocaleLowerCase(); - const macintosh = /iphone|ipad|ipod|macintosh/.test(userAgent) - return !!macintosh + const macintosh = /iphone|ipad|ipod|macintosh/.test(userAgent); + return !!macintosh; } - return false + return false; }