mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e86bf42cc1 | ||
|
|
09b8643d99 | ||
|
|
c07fd1e0b8 | ||
|
|
4366b8ee8a | ||
|
|
7505311a2c | ||
|
|
680100801f | ||
|
|
ee0836cb07 | ||
|
|
91cebe82db |
@@ -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)
|
- `Mac`: [ChatGPT_0.4.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.4.2/ChatGPT_0.4.2_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)
|
- `Linux`: [chat-gpt_0.4.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.4.2/chat-gpt_0.4.2_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)
|
- `Windows`: [ChatGPT_0.4.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.4.2/ChatGPT_0.4.2_x64_en-US.msi)
|
||||||
|
|
||||||
[其他版本...](https://github.com/lencx/ChatGPT/releases)
|
[其他版本...](https://github.com/lencx/ChatGPT/releases)
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
**Latest:**
|
**Latest:**
|
||||||
|
|
||||||
- `Mac`: [ChatGPT_0.4.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.4.0/ChatGPT_0.4.0_x64.dmg)
|
- `Mac`: [ChatGPT_0.4.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.4.2/ChatGPT_0.4.2_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)
|
- `Linux`: [chat-gpt_0.4.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.4.2/chat-gpt_0.4.2_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)
|
- `Windows`: [ChatGPT_0.4.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.4.2/ChatGPT_0.4.2_x64_en-US.msi)
|
||||||
|
|
||||||
[Other version...](https://github.com/lencx/ChatGPT/releases)
|
[Other version...](https://github.com/lencx/ChatGPT/releases)
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
# UPDATE LOG
|
# UPDATE LOG
|
||||||
|
|
||||||
|
## v0.4.2
|
||||||
|
|
||||||
|
add chatgpt log (path: `~/.chatgpt/chatgpt.log`)
|
||||||
|
|
||||||
|
## v0.4.1
|
||||||
|
|
||||||
|
fix:
|
||||||
|
- tray window style optimization
|
||||||
|
|
||||||
## v0.4.0
|
## v0.4.0
|
||||||
|
|
||||||
feat:
|
feat:
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ serde_json = "1.0"
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tauri = { version = "1.2.2", features = ["api-all", "devtools", "system-tray", "updater"] }
|
tauri = { version = "1.2.2", features = ["api-all", "devtools", "system-tray", "updater"] }
|
||||||
tauri-plugin-positioner = { version = "1.0.4", features = ["system-tray"] }
|
tauri-plugin-positioner = { version = "1.0.4", features = ["system-tray"] }
|
||||||
|
log = "0.4.17"
|
||||||
|
|
||||||
|
[dependencies.tauri-plugin-log]
|
||||||
|
git = "https://github.com/tauri-apps/tauri-plugin-log"
|
||||||
|
branch = "dev"
|
||||||
|
features = ["colored"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# by default Tauri runs in production mode
|
||||||
|
|||||||
@@ -70,4 +70,4 @@ pub fn get_chat_model() -> serde_json::Value {
|
|||||||
let path = utils::chat_root().join("chat.model.json");
|
let path = utils::chat_root().join("chat.model.json");
|
||||||
let content = fs::read_to_string(path).unwrap_or_else(|_| r#"{"data":[]}"#.to_string());
|
let content = fs::read_to_string(path).unwrap_or_else(|_| r#"{"data":[]}"#.to_string());
|
||||||
serde_json::from_str(&content).unwrap()
|
serde_json::from_str(&content).unwrap()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use tauri::{
|
use tauri::{
|
||||||
AboutMetadata, AppHandle, CustomMenuItem, Manager, Menu, MenuItem, Submenu, SystemTray,
|
AboutMetadata, AppHandle, CustomMenuItem, Manager, Menu, MenuItem, Submenu, SystemTray,
|
||||||
SystemTrayEvent, SystemTrayMenu, WindowMenuEvent, SystemTrayMenuItem,
|
SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem, WindowMenuEvent,
|
||||||
};
|
};
|
||||||
use tauri_plugin_positioner::{on_tray_event, Position, WindowExt};
|
use tauri_plugin_positioner::{on_tray_event, Position, WindowExt};
|
||||||
|
|
||||||
@@ -138,6 +138,10 @@ pub fn init() -> Menu {
|
|||||||
let help_menu = Submenu::new(
|
let help_menu = Submenu::new(
|
||||||
"Help",
|
"Help",
|
||||||
Menu::new()
|
Menu::new()
|
||||||
|
.add_item(CustomMenuItem::new(
|
||||||
|
"chatgpt_log".to_string(),
|
||||||
|
"ChatGPT Log",
|
||||||
|
))
|
||||||
.add_item(CustomMenuItem::new("update_log".to_string(), "Update Log"))
|
.add_item(CustomMenuItem::new("update_log".to_string(), "Update Log"))
|
||||||
.add_item(CustomMenuItem::new("report_bug".to_string(), "Report Bug"))
|
.add_item(CustomMenuItem::new("report_bug".to_string(), "Report Bug"))
|
||||||
.add_item(
|
.add_item(
|
||||||
@@ -226,6 +230,7 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
|||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
// Help
|
// Help
|
||||||
|
"chatgpt_log" => utils::open_file(utils::chat_root().join("chatgpt.log")),
|
||||||
"update_log" => open(&app, conf::UPDATE_LOG_URL.to_string()),
|
"update_log" => open(&app, conf::UPDATE_LOG_URL.to_string()),
|
||||||
"report_bug" => open(&app, conf::ISSUES_URL.to_string()),
|
"report_bug" => open(&app, conf::ISSUES_URL.to_string()),
|
||||||
"dev_tools" => {
|
"dev_tools" => {
|
||||||
@@ -240,11 +245,20 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
|||||||
pub fn tray_menu() -> SystemTray {
|
pub fn tray_menu() -> SystemTray {
|
||||||
SystemTray::new().with_menu(
|
SystemTray::new().with_menu(
|
||||||
SystemTrayMenu::new()
|
SystemTrayMenu::new()
|
||||||
.add_item(CustomMenuItem::new("control_center".to_string(), "Control Center"))
|
.add_item(CustomMenuItem::new(
|
||||||
.add_item(CustomMenuItem::new("show_dock_icon".to_string(), "Show Dock Icon"))
|
"control_center".to_string(),
|
||||||
.add_item(CustomMenuItem::new("hide_dock_icon".to_string(), "Hide Dock Icon"))
|
"Control Center",
|
||||||
|
))
|
||||||
|
.add_item(CustomMenuItem::new(
|
||||||
|
"show_dock_icon".to_string(),
|
||||||
|
"Show Dock Icon",
|
||||||
|
))
|
||||||
|
.add_item(CustomMenuItem::new(
|
||||||
|
"hide_dock_icon".to_string(),
|
||||||
|
"Hide Dock Icon",
|
||||||
|
))
|
||||||
.add_native_item(SystemTrayMenuItem::Separator)
|
.add_native_item(SystemTrayMenuItem::Separator)
|
||||||
.add_item(CustomMenuItem::new("quit".to_string(), "Quit ChatGPT"))
|
.add_item(CustomMenuItem::new("quit".to_string(), "Quit ChatGPT")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,25 +290,19 @@ pub fn tray_handler(handle: &AppHandle, event: SystemTrayEvent) {
|
|||||||
"control_center" => app.get_window("main").unwrap().show().unwrap(),
|
"control_center" => app.get_window("main").unwrap().show().unwrap(),
|
||||||
"restart" => tauri::api::process::restart(&handle.env()),
|
"restart" => tauri::api::process::restart(&handle.env()),
|
||||||
"show_dock_icon" => {
|
"show_dock_icon" => {
|
||||||
ChatConfJson::amend(
|
ChatConfJson::amend(&serde_json::json!({ "hide_dock_icon": false }), Some(app))
|
||||||
&serde_json::json!({ "hide_dock_icon": false }),
|
.unwrap();
|
||||||
Some(app),
|
}
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
},
|
|
||||||
"hide_dock_icon" => {
|
"hide_dock_icon" => {
|
||||||
let chat_conf = conf::ChatConfJson::get_chat_conf();
|
let chat_conf = conf::ChatConfJson::get_chat_conf();
|
||||||
if !chat_conf.hide_dock_icon {
|
if !chat_conf.hide_dock_icon {
|
||||||
ChatConfJson::amend(
|
ChatConfJson::amend(&serde_json::json!({ "hide_dock_icon": true }), Some(app))
|
||||||
&serde_json::json!({ "hide_dock_icon": true }),
|
.unwrap();
|
||||||
Some(app),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"quit" => std::process::exit(0),
|
"quit" => std::process::exit(0),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
|||||||
.initialization_script(include_str!("../assets/export.js"))
|
.initialization_script(include_str!("../assets/export.js"))
|
||||||
.initialization_script(include_str!("../assets/cmd.js"))
|
.initialization_script(include_str!("../assets/cmd.js"))
|
||||||
.user_agent(&chat_conf.ua_window)
|
.user_agent(&chat_conf.ua_window)
|
||||||
.build().unwrap();
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
WindowBuilder::new(&app, "core", WindowUrl::App(url.into()))
|
WindowBuilder::new(&app, "core", WindowUrl::App(url.into()))
|
||||||
@@ -51,7 +52,8 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
|||||||
.initialization_script(include_str!("../assets/export.js"))
|
.initialization_script(include_str!("../assets/export.js"))
|
||||||
.initialization_script(include_str!("../assets/cmd.js"))
|
.initialization_script(include_str!("../assets/cmd.js"))
|
||||||
.user_agent(&chat_conf.ua_window)
|
.user_agent(&chat_conf.ua_window)
|
||||||
.build().unwrap();
|
.build()
|
||||||
|
.unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
src-tauri/src/assets/cmd.js
vendored
15
src-tauri/src/assets/cmd.js
vendored
@@ -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');
|
||||||
|
|||||||
@@ -9,13 +9,29 @@ mod utils;
|
|||||||
|
|
||||||
use app::{cmd, menu, setup};
|
use app::{cmd, menu, setup};
|
||||||
use conf::{ChatConfJson, ChatState};
|
use conf::{ChatConfJson, ChatState};
|
||||||
|
use tauri::api::path;
|
||||||
|
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, LogTarget, LoggerBuilder};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
ChatConfJson::init();
|
ChatConfJson::init();
|
||||||
let chat_conf = ChatConfJson::get_chat_conf();
|
let chat_conf = ChatConfJson::get_chat_conf();
|
||||||
let context = tauri::generate_context!();
|
let context = tauri::generate_context!();
|
||||||
|
let colors = ColoredLevelConfig::default();
|
||||||
|
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
// https://github.com/tauri-apps/tauri/pull/2736
|
||||||
|
.plugin(
|
||||||
|
LoggerBuilder::new()
|
||||||
|
.with_colors(colors)
|
||||||
|
.targets([
|
||||||
|
// LogTarget::LogDir,
|
||||||
|
// LOG PATH: ~/.chatgpt/ChatGPT.log
|
||||||
|
LogTarget::Folder(path::home_dir().unwrap().join(".chatgpt")),
|
||||||
|
LogTarget::Stdout,
|
||||||
|
LogTarget::Webview,
|
||||||
|
])
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
.manage(ChatState::default(chat_conf))
|
.manage(ChatState::default(chat_conf))
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
cmd::drag_window,
|
cmd::drag_window,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use log::info;
|
||||||
use std::{
|
use std::{
|
||||||
fs::{self, File},
|
fs::{self, File},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
@@ -48,6 +49,7 @@ pub fn user_script() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn open_file(path: PathBuf) {
|
pub fn open_file(path: PathBuf) {
|
||||||
|
info!("open_file: {}", path.to_string_lossy());
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
Command::new("open").arg("-R").arg(path).spawn().unwrap();
|
Command::new("open").arg("-R").arg(path).spawn().unwrap();
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "ChatGPT",
|
"productName": "ChatGPT",
|
||||||
"version": "0.4.0"
|
"version": "0.4.2"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
|||||||
12
src/view/LanguageModel/index.tsx
vendored
12
src/view/LanguageModel/index.tsx
vendored
@@ -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`;
|
||||||
|
|||||||
Reference in New Issue
Block a user