mirror of
https://github.com/lencx/ChatGPT.git
synced 2026-02-06 13:57:04 +00:00
chore: optim
This commit is contained in:
parent
ffef57e934
commit
171ac94f77
26
AWESOME.md
26
AWESOME.md
@ -1,26 +0,0 @@
|
||||
# Awesome ChatGPT
|
||||
|
||||
- [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) - This repo includes ChatGPT prompt curation to use ChatGPT better.
|
||||
- [Awesome ChatGPT](https://github.com/humanloop/awesome-chatgpt) - Curated list of awesome tools, demos, docs for ChatGPT and GPT-3
|
||||
|
||||
## Extension
|
||||
|
||||
`Browser`
|
||||
|
||||
- [ChatGPT Export and Share](https://github.com/liady/ChatGPT-pdf) - A Chrome extension for downloading your ChatGPT history to PNG, PDF or creating a sharable link
|
||||
- [ChatGPT for Google](https://github.com/wong2/chat-gpt-google-extension) - A browser extension to display ChatGPT response alongside Google Search results
|
||||
- [ChatGPT Extension](https://github.com/kazuki-sf/ChatGPT_Extension) - ChatGPT Extension is a really simple Chrome Extension (manifest v3) that you can access OpenAI's ChatGPT from anywhere on the web.
|
||||
- [ChatGPT-Google](https://github.com/ZohaibAhmed/ChatGPT-Google) - Chrome Extension that Integrates ChatGPT (Unofficial) into Google Search
|
||||
|
||||
`VSCode`
|
||||
|
||||
- [ChatGPT Extension for VSCode](https://github.com/mpociot/chatgpt-vscode) - A VSCode extension that allows you to use ChatGPT
|
||||
|
||||
`Bot`
|
||||
|
||||
- [ChatGPT Telegram Bot](https://github.com/altryne/chatGPT-telegram-bot) - This is a very early attempt at having chatGPT work within a telegram bot
|
||||
|
||||
## Tools
|
||||
|
||||
- [commitgpt](https://github.com/RomanHotsiy/commitgpt) - Automatically generate commit messages using ChatGPT
|
||||
- [ShareGPT](https://sharegpt.com/) - ShareGPT: Share your wildest ChatGPT conversations with one click.
|
||||
@ -1,5 +1,11 @@
|
||||
# UPDATE LOG
|
||||
|
||||
## v0.10.2
|
||||
|
||||
Fix:
|
||||
|
||||
- PNG and PDF buttons do not work (https://github.com/lencx/ChatGPT/issues/274)
|
||||
|
||||
## v0.10.1
|
||||
|
||||
Fix:
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
# ChatGPT Model
|
||||
|
||||
- [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts)
|
||||
@ -81,6 +81,7 @@ pub fn init() -> Menu {
|
||||
CustomMenuItem::new("control_center".to_string(), "Control Center")
|
||||
.accelerator("CmdOrCtrl+Shift+P")
|
||||
.into(),
|
||||
CustomMenuItem::new("app_website".to_string(), "ChatGPT User's Guide").into(),
|
||||
MenuItem::Separator.into(),
|
||||
stay_on_top_menu.into(),
|
||||
#[cfg(target_os = "macos")]
|
||||
@ -143,7 +144,6 @@ pub fn init() -> Menu {
|
||||
.into(),
|
||||
CustomMenuItem::new("clear_conf".to_string(), "Clear Config").into(),
|
||||
MenuItem::Separator.into(),
|
||||
CustomMenuItem::new("awesome".to_string(), "Awesome ChatGPT").into(),
|
||||
CustomMenuItem::new("buy_coffee".to_string(), "Buy lencx a coffee").into(),
|
||||
]),
|
||||
);
|
||||
@ -247,7 +247,13 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
||||
"inject_script" => open(&app, script_path),
|
||||
"go_conf" => utils::open_file(utils::app_root()),
|
||||
"clear_conf" => utils::clear_conf(&app),
|
||||
"awesome" => open(&app, conf::AWESOME_URL.to_string()),
|
||||
"app_website" => window::cmd::wa_window(
|
||||
app,
|
||||
"app_website".into(),
|
||||
"ChatGPT User's Guide".into(),
|
||||
conf::APP_WEBSITE.into(),
|
||||
None,
|
||||
),
|
||||
"buy_coffee" => open(&app, conf::BUY_COFFEE.to_string()),
|
||||
"popup_search" => {
|
||||
let app_conf = AppConf::read();
|
||||
@ -396,22 +402,29 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
||||
// --- SystemTray Menu
|
||||
pub fn tray_menu() -> SystemTray {
|
||||
if cfg!(target_os = "macos") {
|
||||
SystemTray::new().with_menu(
|
||||
SystemTrayMenu::new()
|
||||
.add_item(CustomMenuItem::new(
|
||||
"control_center".to_string(),
|
||||
"Control Center",
|
||||
))
|
||||
.add_native_item(SystemTrayMenuItem::Separator)
|
||||
.add_item(CustomMenuItem::new(
|
||||
"show_dock_icon".to_string(),
|
||||
"Show Dock Icon",
|
||||
))
|
||||
let mut tray_menu = SystemTrayMenu::new()
|
||||
.add_item(CustomMenuItem::new(
|
||||
"control_center".to_string(),
|
||||
"Control Center",
|
||||
))
|
||||
.add_native_item(SystemTrayMenuItem::Separator);
|
||||
|
||||
if AppConf::read().hide_dock_icon {
|
||||
tray_menu = tray_menu.add_item(CustomMenuItem::new(
|
||||
"show_dock_icon".to_string(),
|
||||
"Show Dock Icon",
|
||||
));
|
||||
} else {
|
||||
tray_menu = tray_menu
|
||||
.add_item(CustomMenuItem::new(
|
||||
"hide_dock_icon".to_string(),
|
||||
"Hide Dock Icon",
|
||||
))
|
||||
.add_item(CustomMenuItem::new("show_core".to_string(), "Show ChatGPT"))
|
||||
.add_item(CustomMenuItem::new("show_core".to_string(), "Show ChatGPT"));
|
||||
}
|
||||
|
||||
SystemTray::new().with_menu(
|
||||
tray_menu
|
||||
.add_native_item(SystemTrayMenuItem::Separator)
|
||||
.add_item(CustomMenuItem::new("quit".to_string(), "Quit ChatGPT")),
|
||||
)
|
||||
@ -440,17 +453,19 @@ pub fn tray_handler(handle: &AppHandle, event: SystemTrayEvent) {
|
||||
let app_conf = AppConf::read();
|
||||
|
||||
if !app_conf.hide_dock_icon {
|
||||
let core_win = handle.get_window("core").unwrap();
|
||||
core_win.minimize().unwrap();
|
||||
if let Some(core_win) = handle.get_window("core") {
|
||||
core_win.minimize().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
let tray_win = handle.get_window("tray").unwrap();
|
||||
tray_win.move_window(Position::TrayCenter).unwrap();
|
||||
if let Some(tray_win) = handle.get_window("tray") {
|
||||
tray_win.move_window(Position::TrayCenter).unwrap();
|
||||
|
||||
if tray_win.is_visible().unwrap() {
|
||||
tray_win.hide().unwrap();
|
||||
} else {
|
||||
tray_win.show().unwrap();
|
||||
if tray_win.is_visible().unwrap() {
|
||||
tray_win.hide().unwrap();
|
||||
} else {
|
||||
tray_win.show().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
|
||||
@ -472,13 +487,14 @@ pub fn tray_handler(handle: &AppHandle, event: SystemTrayEvent) {
|
||||
}
|
||||
}
|
||||
"show_core" => {
|
||||
let core_win = app.get_window("core").unwrap();
|
||||
let tray_win = app.get_window("tray").unwrap();
|
||||
if !core_win.is_visible().unwrap() {
|
||||
core_win.show().unwrap();
|
||||
core_win.set_focus().unwrap();
|
||||
tray_win.hide().unwrap();
|
||||
}
|
||||
if let Some(core_win) = app.get_window("core") {
|
||||
let tray_win = app.get_window("tray").unwrap();
|
||||
if !core_win.is_visible().unwrap() {
|
||||
core_win.show().unwrap();
|
||||
core_win.set_focus().unwrap();
|
||||
tray_win.hide().unwrap();
|
||||
}
|
||||
};
|
||||
}
|
||||
"quit" => std::process::exit(0),
|
||||
_ => (),
|
||||
|
||||
@ -11,6 +11,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
||||
let handle = app.app_handle();
|
||||
|
||||
tauri::async_runtime::spawn(async move {
|
||||
info!("stepup_tray");
|
||||
window::tray_window(&handle);
|
||||
});
|
||||
|
||||
@ -56,6 +57,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
||||
} else {
|
||||
&url
|
||||
};
|
||||
info!("main_window: {}", link);
|
||||
let mut main_win = WindowBuilder::new(&app, "core", WindowUrl::App(link.into()))
|
||||
.title("ChatGPT")
|
||||
.resizable(true)
|
||||
|
||||
@ -130,7 +130,7 @@ pub mod cmd {
|
||||
}
|
||||
|
||||
#[command]
|
||||
pub async fn wa_window(
|
||||
pub fn wa_window(
|
||||
app: tauri::AppHandle,
|
||||
label: String,
|
||||
title: String,
|
||||
@ -148,16 +148,13 @@ pub mod cmd {
|
||||
.build()
|
||||
.unwrap();
|
||||
});
|
||||
} else {
|
||||
if !win.clone().unwrap().is_visible().unwrap() {
|
||||
win.clone().unwrap().show().unwrap();
|
||||
}
|
||||
if let Some(v) = win {
|
||||
if !v.is_visible().unwrap() {
|
||||
v.show().unwrap();
|
||||
}
|
||||
win
|
||||
.clone()
|
||||
.unwrap()
|
||||
.eval("window.location.reload()")
|
||||
.unwrap();
|
||||
win.unwrap().set_focus().unwrap();
|
||||
v.eval("window.location.reload()").unwrap();
|
||||
v.set_focus().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,9 +8,9 @@ use tauri::TitleBarStyle;
|
||||
|
||||
use crate::utils::{app_root, create_file, exists};
|
||||
|
||||
pub const APP_WEBSITE: &str = "https://lencx.github.io/app/";
|
||||
pub const ISSUES_URL: &str = "https://github.com/lencx/ChatGPT/issues";
|
||||
pub const UPDATE_LOG_URL: &str = "https://github.com/lencx/ChatGPT/blob/main/UPDATE_LOG.md";
|
||||
pub const AWESOME_URL: &str = "https://github.com/lencx/ChatGPT/blob/main/AWESOME.md";
|
||||
pub const BUY_COFFEE: &str = "https://www.buymeacoffee.com/lencx";
|
||||
pub const GITHUB_PROMPTS_CSV_URL: &str =
|
||||
"https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv";
|
||||
|
||||
@ -9,6 +9,7 @@ mod utils;
|
||||
|
||||
use app::{cmd, fs_extra, gpt, menu, setup, window};
|
||||
use conf::AppConf;
|
||||
use log::info;
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
use tauri_plugin_log::{
|
||||
fern::colors::{Color, ColoredLevelConfig},
|
||||
|
||||
@ -156,25 +156,25 @@ pub async fn get_data(
|
||||
pub fn run_check_update(app: AppHandle<Wry>, silent: bool, has_msg: Option<bool>) {
|
||||
info!("run_check_update: silent={} has_msg={:?}", silent, has_msg);
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let result = app.updater().check().await;
|
||||
let update_resp = result.unwrap();
|
||||
if update_resp.is_update_available() {
|
||||
if silent {
|
||||
tauri::async_runtime::spawn(async move {
|
||||
silent_install(app, update_resp).await.unwrap();
|
||||
});
|
||||
} else {
|
||||
tauri::async_runtime::spawn(async move {
|
||||
prompt_for_install(app, update_resp).await.unwrap();
|
||||
});
|
||||
}
|
||||
} else if let Some(v) = has_msg {
|
||||
if v {
|
||||
tauri::api::dialog::message(
|
||||
app.app_handle().get_window("core").as_ref(),
|
||||
"ChatGPT",
|
||||
"Your ChatGPT is up to date",
|
||||
);
|
||||
if let Ok(update_resp) = app.updater().check().await {
|
||||
if update_resp.is_update_available() {
|
||||
if silent {
|
||||
tauri::async_runtime::spawn(async move {
|
||||
silent_install(app, update_resp).await.unwrap();
|
||||
});
|
||||
} else {
|
||||
tauri::async_runtime::spawn(async move {
|
||||
prompt_for_install(app, update_resp).await.unwrap();
|
||||
});
|
||||
}
|
||||
} else if let Some(v) = has_msg {
|
||||
if v {
|
||||
tauri::api::dialog::message(
|
||||
app.app_handle().get_window("core").as_ref(),
|
||||
"ChatGPT",
|
||||
"Your ChatGPT is up to date",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user