Compare commits

...

4 Commits

Author SHA1 Message Date
lencx
7505311a2c v0.4.1 2022-12-17 21:31:26 +08:00
lencx
680100801f fix: tray window style optimization (#39) 2022-12-17 21:30:45 +08:00
lencx
ee0836cb07 readme 2022-12-17 20:04:50 +08:00
lencx
91cebe82db Merge pull request #38 from lencx/dev 2022-12-17 18:12:09 +08:00
5 changed files with 28 additions and 9 deletions

View File

@@ -75,6 +75,7 @@ In the chatgpt text input area, type a character starting with `/` to bring up t
- Common shortcut keys - Common shortcut keys
- System tray hover window - System tray hover window
- Powerful menu items - Powerful menu items
- Shortcut command typing chatgpt prompt
### MenuItem ### MenuItem
@@ -103,7 +104,7 @@ In the chatgpt text input area, type a character starting with `/` to bring up t
## TODO ## TODO
- Web access capability ([#20](https://github.com/lencx/ChatGPT/issues/20)) - Web access capability ([#20](https://github.com/lencx/ChatGPT/issues/20))
- Shortcut command typing chatgpt prompt - `Control Center` - Feature Enhancements
- ... - ...
## 👀 Preview ## 👀 Preview

View File

@@ -1,5 +1,10 @@
# UPDATE LOG # UPDATE LOG
## v0.4.1
fix:
- tray window style optimization
## v0.4.0 ## v0.4.0
feat: feat:

View File

@@ -7,7 +7,6 @@ function init() {
} }
.chat-model-cmd-list { .chat-model-cmd-list {
position: absolute; position: absolute;
width: 400px;
bottom: 60px; bottom: 60px;
max-height: 100px; max-height: 100px;
overflow: auto; overflow: auto;
@@ -31,13 +30,17 @@ function init() {
} }
.chat-model-cmd-list .cmd-item b { .chat-model-cmd-list .cmd-item b {
display: inline-block; display: inline-block;
width: 120px; width: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border-radius: 4px; border-radius: 4px;
margin-right: 10px; margin-right: 10px;
color: #2a2a2a; color: #2a2a2a;
} }
.chat-model-cmd-list .cmd-item i { .chat-model-cmd-list .cmd-item i {
width: 270px; width: 100%;
max-width: 200px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@@ -64,6 +67,12 @@ async function cmdTip() {
const modelDom = document.createElement('div'); const modelDom = document.createElement('div');
modelDom.classList.add('chat-model-cmd-list'); 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); document.querySelector('form').appendChild(modelDom);
const itemDom = (v) => `<div class="cmd-item" data-prompt="${encodeURIComponent(v.prompt)}"><b>/${v.cmd}</b><i>${v.act}</i></div>`; const itemDom = (v) => `<div class="cmd-item" data-prompt="${encodeURIComponent(v.prompt)}"><b>/${v.cmd}</b><i>${v.act}</i></div>`;
const searchInput = document.querySelector('form textarea'); const searchInput = document.querySelector('form textarea');

View File

@@ -7,7 +7,7 @@
}, },
"package": { "package": {
"productName": "ChatGPT", "productName": "ChatGPT",
"version": "0.4.0" "version": "0.4.1"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@@ -2,6 +2,7 @@ import { useState, useRef, useEffect } from 'react';
import { Table, Button, Modal, message } from 'antd'; import { Table, Button, Modal, message } from 'antd';
import { invoke } from '@tauri-apps/api'; import { invoke } from '@tauri-apps/api';
import useInit from '@/hooks/useInit';
import useChatModel from '@/hooks/useChatModel'; import useChatModel from '@/hooks/useChatModel';
import useColumns from '@/hooks/useColumns'; import useColumns from '@/hooks/useColumns';
import useData from '@/hooks/useData'; import useData from '@/hooks/useData';
@@ -30,6 +31,11 @@ export default function LanguageModel() {
} }
}, [opInfo.opType, formRef]); }, [opInfo.opType, formRef]);
useInit(async () => {
const path = await chatModelPath();
setChatModelPath(path);
})
const hide = () => { const hide = () => {
setVisible(false); setVisible(false);
opInfo.resetRecord(); opInfo.resetRecord();
@@ -53,10 +59,8 @@ export default function LanguageModel() {
}) })
}; };
const handleOpenFile = async () => { const handleOpenFile = () => {
const path = await chatModelPath(); invoke('open_file', { path: modelPath });
setChatModelPath(path);
invoke('open_file', { path });
}; };
const modalTitle = `${({ new: 'Create', edit: 'Edit' })[opInfo.opType]} Language Model`; const modalTitle = `${({ new: 'Create', edit: 'Edit' })[opInfo.opType]} Language Model`;