Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Another Fix (#78)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
H0llyW00dzZ authored Nov 10, 2023
1 parent df653b9 commit 717f829
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
6 changes: 6 additions & 0 deletions app/components/exporter.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@
}
}

&-system {
.body {
background-color: var(--white);
}
}

&-user {
flex-direction: row-reverse;

Expand Down
18 changes: 12 additions & 6 deletions app/components/exporter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
12 changes: 9 additions & 3 deletions app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 717f829

Please sign in to comment.