From 717f829ca6c97fa5d9eff7d777653a12812e9b66 Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Sat, 11 Nov 2023 02:58:34 +0700 Subject: [PATCH] Another Fix (#78) * Refactor UI/UX Page [+] refactor(exporter.tsx): remove unnecessary system message in JsonPreviewer component * Fix Locales Language Summarizing [+] fix(en.ts): Fix UI translation for "Summarizing" to provide a clearer description * Add Styles UI Page [Exporter] [+] chore(exporter.module.scss): add new styles for .exporter-system.body * Fix Client App [Tauri] [+] fix(exporter.tsx): fix issue with saving files in client app [Tauri] when there is a ':' in the dialog [+] fix(utils.ts): fix issue with saving files in client app [Tauri] when there is a ':' in the dialog --- app/components/exporter.module.scss | 6 ++++++ app/components/exporter.tsx | 18 ++++++++++++------ app/locales/en.ts | 2 +- app/utils.ts | 12 +++++++++--- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/app/components/exporter.module.scss b/app/components/exporter.module.scss index c2046ffc09d..ed6289f175f 100644 --- a/app/components/exporter.module.scss +++ b/app/components/exporter.module.scss @@ -197,6 +197,12 @@ } } + &-system { + .body { + background-color: var(--white); + } + } + &-user { flex-direction: row-reverse; diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx index 60a2eca0498..211b44464c6 100644 --- a/app/components/exporter.tsx +++ b/app/components/exporter.tsx @@ -447,8 +447,13 @@ export function ImagePreviewer(props: { if (isMobile || (isApp && window.__TAURI__)) { if (isApp && window.__TAURI__) { + /** + * Fixed Tauri client app + * Resolved the issue where files couldn't be saved when there was a `:` in the dialog. + */ + const fileName = props.topic.replace(/:/g, ''); const result = await window.__TAURI__.dialog.save({ - defaultPath: `${props.topic}.png`, + defaultPath: `${fileName}.png`, filters: [ { name: "PNG Files", @@ -607,8 +612,13 @@ export function MarkdownPreviewer(props: { if (isApp && window.__TAURI__) { try { + const fileName = props.topic.replace(/:/g, ''); const result = await window.__TAURI__.dialog.save({ - defaultPath: `${props.topic}.md`, + /** + * Fixed Tauri client app + * Resolved the issue where files couldn't be saved when there was a `:` in the dialog. + */ + defaultPath: `${fileName}.md`, filters: [ { name: "MD Files", @@ -662,10 +672,6 @@ export function JsonPreviewer(props: { }) { const msgs = { messages: [ - { - role: "system", - content: `${Locale.FineTuned.Sysmessage} ${props.topic}`, - }, ...props.messages.map((m) => ({ role: m.role, content: m.content, diff --git a/app/locales/en.ts b/app/locales/en.ts index 1b6e31282d1..eb8b633fe8b 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -81,7 +81,7 @@ const en: LocaleType = { UI: { MasksSuccess: "Successfully updated session of masks", MasksFail: "Failed to update session of masks", - Summarizing: "正在总结当前会话的内容", + Summarizing: "Summarizing a current session of this conversation", SummarizeSuccess: "Successfully summarize session of this chat", SummarizeFail: "Failed to summarize session of this chat", }, diff --git a/app/utils.ts b/app/utils.ts index f69929c747d..3b53311249b 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -42,12 +42,18 @@ export async function downloadAs(text: object, filename: string) { try { if (window.__TAURI__) { + /** + * Fixed client app [Tauri] + * Resolved the issue where files couldn't be saved when there was a `:` in the dialog. + **/ + const fileName = filename.replace(/:/g, ''); + const fileExtension = fileName.split('.').pop(); const result = await window.__TAURI__.dialog.save({ - defaultPath: `${filename}`, + defaultPath: `${fileName}`, filters: [ { - name: `${filename.split('.').pop()} files`, - extensions: [`${filename.split('.').pop()}`], + name: `${fileExtension} files`, + extensions: [`${fileExtension}`], }, { name: "All Files",