From 680100801f7fb2b2a63fad7f5698632dd7d7d010 Mon Sep 17 00:00:00 2001 From: lencx Date: Sat, 17 Dec 2022 21:30:45 +0800 Subject: [PATCH 1/3] fix: tray window style optimization (#39) --- UPDATE_LOG.md | 5 +++++ src-tauri/src/assets/cmd.js | 15 ++++++++++++--- src/view/LanguageModel/index.tsx | 12 ++++++++---- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/UPDATE_LOG.md b/UPDATE_LOG.md index f2bda9b..38d0ab8 100644 --- a/UPDATE_LOG.md +++ b/UPDATE_LOG.md @@ -1,5 +1,10 @@ # UPDATE LOG +## v0.4.1 + +fix: +- tray window style optimization + ## v0.4.0 feat: diff --git a/src-tauri/src/assets/cmd.js b/src-tauri/src/assets/cmd.js index 97cb6bc..2bfe285 100644 --- a/src-tauri/src/assets/cmd.js +++ b/src-tauri/src/assets/cmd.js @@ -7,7 +7,6 @@ function init() { } .chat-model-cmd-list { position: absolute; - width: 400px; bottom: 60px; max-height: 100px; overflow: auto; @@ -31,13 +30,17 @@ function init() { } .chat-model-cmd-list .cmd-item b { display: inline-block; - width: 120px; + width: 100px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; border-radius: 4px; margin-right: 10px; color: #2a2a2a; } .chat-model-cmd-list .cmd-item i { - width: 270px; + width: 100%; + max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -64,6 +67,12 @@ async function cmdTip() { const modelDom = document.createElement('div'); modelDom.classList.add('chat-model-cmd-list'); + + // fix: tray window + if (__TAURI_METADATA__.__currentWindow.label === 'tray') { + modelDom.style.bottom = '40px'; + } + document.querySelector('form').appendChild(modelDom); const itemDom = (v) => `
/${v.cmd}${v.act}
`; const searchInput = document.querySelector('form textarea'); diff --git a/src/view/LanguageModel/index.tsx b/src/view/LanguageModel/index.tsx index d9a3b2f..0ce0bb2 100644 --- a/src/view/LanguageModel/index.tsx +++ b/src/view/LanguageModel/index.tsx @@ -2,6 +2,7 @@ import { useState, useRef, useEffect } from 'react'; import { Table, Button, Modal, message } from 'antd'; import { invoke } from '@tauri-apps/api'; +import useInit from '@/hooks/useInit'; import useChatModel from '@/hooks/useChatModel'; import useColumns from '@/hooks/useColumns'; import useData from '@/hooks/useData'; @@ -30,6 +31,11 @@ export default function LanguageModel() { } }, [opInfo.opType, formRef]); + useInit(async () => { + const path = await chatModelPath(); + setChatModelPath(path); + }) + const hide = () => { setVisible(false); opInfo.resetRecord(); @@ -53,10 +59,8 @@ export default function LanguageModel() { }) }; - const handleOpenFile = async () => { - const path = await chatModelPath(); - setChatModelPath(path); - invoke('open_file', { path }); + const handleOpenFile = () => { + invoke('open_file', { path: modelPath }); }; const modalTitle = `${({ new: 'Create', edit: 'Edit' })[opInfo.opType]} Language Model`; From 7505311a2cb8f89541c41aac51ebd16f17fb7eb4 Mon Sep 17 00:00:00 2001 From: lencx Date: Sat, 17 Dec 2022 21:31:26 +0800 Subject: [PATCH 2/3] v0.4.1 --- src-tauri/tauri.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b2a8956..4717277 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "package": { "productName": "ChatGPT", - "version": "0.4.0" + "version": "0.4.1" }, "tauri": { "allowlist": { From 4366b8ee8a945832e2ecb2e69c8aa4a1220b11de Mon Sep 17 00:00:00 2001 From: lencx Date: Sat, 17 Dec 2022 21:33:23 +0800 Subject: [PATCH 3/3] readme --- README-ZH_CN.md | 6 +++--- README.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README-ZH_CN.md b/README-ZH_CN.md index 3e64e9a..d29f192 100644 --- a/README-ZH_CN.md +++ b/README-ZH_CN.md @@ -22,9 +22,9 @@ **最新版:** -- `Mac`: [ChatGPT_0.4.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.4.0/ChatGPT_0.4.0_x64.dmg) -- `Linux`: [chat-gpt_0.4.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.4.0/chat-gpt_0.4.0_amd64.deb) -- `Windows`: [ChatGPT_0.4.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.4.0/ChatGPT_0.4.0_x64_en-US.msi) +- `Mac`: [ChatGPT_0.4.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.4.1/ChatGPT_0.4.1_x64.dmg) +- `Linux`: [chat-gpt_0.4.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.4.1/chat-gpt_0.4.1_amd64.deb) +- `Windows`: [ChatGPT_0.4.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.4.1/ChatGPT_0.4.1_x64_en-US.msi) [其他版本...](https://github.com/lencx/ChatGPT/releases) diff --git a/README.md b/README.md index 5e3e5dc..7b7476c 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ **Latest:** -- `Mac`: [ChatGPT_0.4.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.4.0/ChatGPT_0.4.0_x64.dmg) -- `Linux`: [chat-gpt_0.4.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.4.0/chat-gpt_0.4.0_amd64.deb) -- `Windows`: [ChatGPT_0.4.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.4.0/ChatGPT_0.4.0_x64_en-US.msi) +- `Mac`: [ChatGPT_0.4.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.4.1/ChatGPT_0.4.1_x64.dmg) +- `Linux`: [chat-gpt_0.4.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.4.1/chat-gpt_0.4.1_amd64.deb) +- `Windows`: [ChatGPT_0.4.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.4.1/ChatGPT_0.4.1_x64_en-US.msi) [Other version...](https://github.com/lencx/ChatGPT/releases)