Compare commits

..

9 Commits
dev ... main

Author SHA1 Message Date
lencx
73d3b145ad Merge pull request #723 from cauyxy/main 2023-03-28 11:56:48 +08:00
Xinyu Yang
ac60dbd5ee Change tray window position position
Change tray window position from center to fixed center on left click event
2023-03-28 11:26:25 +08:00
lencx
e99ba830d8 Merge pull request #697 from shengwusuoxi/shengwusuoxi-patch-1 2023-03-26 00:53:39 +08:00
Luke Tang
a6b4e7fa82 Update release.yml 2023-03-23 14:11:03 +08:00
lencx
8453be3e9d Merge pull request #660 from lencx/doc 2023-03-19 19:46:36 +08:00
lencx
e919ff9f38 readme 2023-03-19 19:43:55 +08:00
lencx
dd86fb9dbe Update README.md 2023-03-19 18:33:04 +08:00
lencx
6adb6e3989 Update README-ZH_CN.md 2023-03-09 09:16:07 +08:00
lencx
a56356995e Update README.md 2023-03-09 09:10:19 +08:00
4 changed files with 85 additions and 211 deletions

View File

@@ -20,7 +20,7 @@ jobs:
os: macos-latest
arch: x86_64
target: x86_64-apple-darwin
- buid: macos
- build: macos
os: macos-latest
arch: aarch64
target: aarch64-apple-darwin

View File

@@ -262,4 +262,4 @@ yarn build
## License
Apache License
AGPL-3.0 License

165
README.md
View File

@@ -84,27 +84,11 @@ sudo xattr -r -d com.apple.quarantine /YOUR_PATH/ChatGPT.app
<!-- tr-download-end -->
## 📢 Announcement
### ChatGPT Prompts!
This is a major and exciting update. It works like a `Telegram bot command` and helps you quickly populate custom models to make chatgpt work the way you want it to. This project has taken a lot of my spare time, so if it helps you, please help spread the word or star it would be a great encouragement to me. I hope I can keep updating it and adding more interesting features.
### How does it work?
## ChatGPT Prompts!
You can look at **[awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts)** to find interesting features to import into the app. You can also use `Sync Prompts` to sync all in one click, and if you don't want certain prompts to appear in your slash commands, you can disable them.
![chatgpt cmd](./assets/chatgpt-cmd.png)
![chatgpt sync prompts](./assets/chatgpt-sync-prompts.png)
<!-- After the data import is done, you can restart the app to make the configuration take effect (`Menu -> Preferences -> Restart ChatGPT`). -->
- In the chatgpt text input area, type a character starting with `/` to bring up the command prompt, press the spacebar, and it will fill the input area with the text associated with the command by default (note: if it contains multiple command prompts, it will only select the first one as the fill, you can keep typing until the first prompted command is the one you want, then press the spacebar.
- Or use the mouse to click on one of the multiple commands). When the fill is complete, you simply press the Enter key.
- Under the slash command, use the tab key to modify the contents of the `{q}` tag (only single changes are supported [#54](https://github.com/lencx/ChatGPT/issues/54)). Use the keyboard `` (arrow up) and `` (arrow down) keys to select the slash command.
![chatgpt](assets/chatgpt.gif)
![chatgpt-cmd](assets/chatgpt-cmd.gif)
## ✨ Features
@@ -120,150 +104,13 @@ You can look at **[awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt
- Customize global shortcuts ([#108](https://github.com/lencx/ChatGPT/issues/108))
- Pop-up Search ([#122](https://github.com/lencx/ChatGPT/issues/122) mouse selected content, no more than 400 characters): The application is built using Tauri, and due to its security restrictions, some of the action buttons will not work, so we recommend going to your browser.
## #️⃣ MenuItem
## ❤️ Sponsors
- **Preferences**
- `Theme` - `Light`, `Dark`, `System` (Only macOS and Windows are supported).
- `Stay On Top`: The window is stay on top of other windows.
- `Titlebar`: Whether to display the titlebar, supported by macOS only.
- `Hide Dock Icon` ([#35](https://github.com/lencx/ChatGPT/issues/35)): Hide application icons from the Dock(support macOS only).
- Right-click on the SystemTray to open the menu, then click `Show Dock Icon` in the menu item to re-display the application icon in the Dock (`SystemTrayMenu -> Show Dock Icon`).
- `Inject Script`: Using scripts to modify pages.
- `Control Center`: The control center of ChatGPT application, it will give unlimited imagination to the application.
- `Theme`, `Stay On Top`, `Titlebar`, ...
- `User Agent` ([#17](https://github.com/lencx/ChatGPT/issues/17)): Custom `user agent`, which may be required in some scenarios. The default value is the empty string.
- `Switch Origin` ([#14](https://github.com/lencx/ChatGPT/issues/14)): Switch the site source address, the default is `https://chat.openai.com`, please make sure the mirror site UI is the same as the original address. Otherwise, some functions may not be available.
- `Go to Config`: Open the configuration file directory (`path: ~/.chatgpt/*`).
- `Clear Config`: Clear the configuration file (`path: ~/.chatgpt/*`), dangerous operation, please backup the data in advance.
- `Restart ChatGPT`: Restart the application, for example: the program is stuck or the injection script can take effect by restarting the application after editing.
- `Awesome ChatGPT`: Recommended Related Resources.
- **Edit** - `Undo`, `Redo`, `Cut`, `Copy`, `SelectAll`, ...
- **View** - `Go Back`, `Go Forward`, `Scroll to Top of Screen`, `Scroll to Bottom of Screen`, `Refresh the Screen`, ...
- **Help**
- `Update Log`: ChatGPT changelog.
- `Report Bug`: Report a bug or give feedback.
- `Toggle Developer Tools`: Developer debugging tools.
### **ChatGPT-Powered Email Finding & Outreach at Scale**
## ⚙️ Application Configuration
[FinalScout](https://finalscout.com/?utm_source=github&utm_medium=lencx&utm_campaign=chatgpt): Extract valid email addresses from LinkedIn & craft tailored emails based on LinkedIn profile with ChatGPT, guaranteeing up to 98% email deliverability. Scale your outreach efforts and connect with potential customers or clients like never before. [Begin automating your email finding and writing process](https://finalscout.com/?utm_source=github&utm_medium=lencx&utm_campaign=chatgpt)
| Platform | Path |
| -------- | ------------------------- |
| Linux | `/home/lencx/.chatgpt` |
| macOS | `/Users/lencx/.chatgpt` |
| Windows | `C:\Users\lencx\.chatgpt` |
- `[.chatgpt]` - Application configuration root folder
- `chat.conf.json` - Preferences configuration
- `chat.awesome.json` - Custom URL lists, similar to browser bookmarks. Any URL can be used as the main window or tray window (**Control Conter -> Awesome**)
- `chat.model.json` - prompts configurationcontains three parts:
- `user_custom` - Requires manual data entry (**Control Conter -> Language Model -> User Custom**)
- `sync_prompts` - Synchronizing data from [f/awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts) (**Control Conter -> Language Model -> Sync Prompts**)
- `sync_custom` - Synchronize custom json and csv file data, support local and remote (**Control Conter -> Language Model -> Sync Custom**)
- `chat.model.cmd.json` - Filtered (whether to enable) and sorted slash commands
- `[cache_model]` - Caching model data
- `chatgpt_prompts.json` - Cache `sync_prompts` data
- `user_custom.json` - Cache `user_custom` data
- `ae6cf32a6f8541b499d6bfe549dbfca3.json` - Randomly generated file names, cache `sync_custom` data
- `4f695d3cfbf8491e9b1f3fab6d85715c.json` - Randomly generated file names, cache `sync_custom` data
- `bd1b96f15a1644f7bd647cc53073ff8f.json` - Randomly generated file names, cache `sync_custom` data
### Sync Custom
Currently, only JSON and CSV are supported for synchronizing custom files, and the following formats need to be met, otherwise the application will be abnormal
`JSON format:`
```json
[
{
"cmd": "a",
"act": "aa",
"prompt": "aaa aaa aaa"
},
{
"cmd": "b",
"act": "bb",
"prompt": "bbb bbb bbb"
}
]
```
`CSV format`
```csv
"cmd","act","prompt"
"a","aa","aaa aaa aaa"
"b","bb","bbb bbb bbb"
```
## 📌 TODO
<!-- - Web access capability ([#20](https://github.com/lencx/ChatGPT/issues/20)) -->
- `Control Center` enhancement
- `Pop-up Search` enhancement
- ...
## 👀 Preview
<img width="320" src="./assets/install.png" alt="install"> <img width="320" src="./assets/chatgpt-popup-search.png" alt="popup search">
<img width="320" src="./assets/chatgpt-control-center-general.png" alt="control center"> <img width="320" src="./assets/chatgpt-export.png" alt="export">
<img width="320" src="./assets/chatgpt-dalle2-tray.png" alt="dalle2 tray"> <img width="320" src="./assets/auto-update.png" alt="auto update">
## ❓FAQ
### Can't open ChatGPT
If you cannot open the application after the upgrade, please try to clear the configuration file, which is in the `~/.chatgpt/*` directory.
### Out of sync login status between multiple windows
If you have already logged in in the main window, but the system tray window shows that you are not logged in, you can fix it by restarting the application (`Menu -> Preferences -> Restart ChatGPT`).
### Is it safe?
It's safe, just a wrapper for [OpenAI ChatGPT](https://chat.openai.com) website, no other data transfer exists (you can check the source code).
### Developer cannot be verified?
- [Open a Mac app from an unidentified developer](https://support.apple.com/en-sg/guide/mac-help/mh40616/mac)
---
### How do I build it?
#### PreInstall
- [Rust (Required)](https://www.rust-lang.org/)
- [Node.js (Required)](https://nodejs.org/)
- [VS Code (Optional)](https://code.visualstudio.com/)
- [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
- [tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode)
#### Start
```bash
# step1:
git clone https://github.com/lencx/ChatGPT.git
# step2:
cd ChatGPT
# step3: install deps
yarn
# step4:
yarn dev
# step5:
# bundle path: src-tauri/target/release/bundle
yarn build
```
- [The distDir configuration is set to "../dist" but this path doesn't exist.](https://github.com/lencx/ChatGPT/discussions/180)
- [Error A public key has been found, but no private key. Make sure to set TAURI_PRIVATE_KEY environment variable.](https://github.com/lencx/ChatGPT/discussions/182)
## ❤️ Thanks
## Thanks
- The core implementation of the share button code was copied from the [@liady](https://github.com/liady) extension with some modifications.
- Thanks to the [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) repository for inspiring the custom command function for this application.
@@ -282,4 +129,4 @@ yarn build
## License
Apache License
AGPL-3.0 License

View File

@@ -22,8 +22,8 @@ pub fn init() -> Menu {
#[cfg(target_os = "macos")]
MenuItem::About(name.into(), AboutMetadata::default()).into(),
#[cfg(not(target_os = "macos"))]
CustomMenuItem::new("about", "About ChatGPT").into(),
CustomMenuItem::new("check_update", "Check for Updates").into(),
CustomMenuItem::new("about".to_string(), "About ChatGPT").into(),
CustomMenuItem::new("check_update".to_string(), "Check for Updates").into(),
MenuItem::Services.into(),
MenuItem::Hide.into(),
MenuItem::HideOthers.into(),
@@ -33,24 +33,25 @@ pub fn init() -> Menu {
]),
);
let stay_on_top = CustomMenuItem::new("stay_on_top", "Stay On Top").accelerator("CmdOrCtrl+T");
let stay_on_top =
CustomMenuItem::new("stay_on_top".to_string(), "Stay On Top").accelerator("CmdOrCtrl+T");
let stay_on_top_menu = if app_conf.stay_on_top {
stay_on_top.selected()
} else {
stay_on_top
};
let theme_light = CustomMenuItem::new("theme_light", "Light");
let theme_dark = CustomMenuItem::new("theme_dark", "Dark");
let theme_system = CustomMenuItem::new("theme_system", "System");
let theme_light = CustomMenuItem::new("theme_light".to_string(), "Light");
let theme_dark = CustomMenuItem::new("theme_dark".to_string(), "Dark");
let theme_system = CustomMenuItem::new("theme_system".to_string(), "System");
let is_dark = app_conf.clone().theme_check("dark");
let is_system = app_conf.clone().theme_check("system");
let update_prompt = CustomMenuItem::new("update_prompt", "Prompt");
let update_silent = CustomMenuItem::new("update_silent", "Silent");
// let _update_disable = CustomMenuItem::new("update_disable", "Disable");
let update_prompt = CustomMenuItem::new("update_prompt".to_string(), "Prompt");
let update_silent = CustomMenuItem::new("update_silent".to_string(), "Silent");
// let _update_disable = CustomMenuItem::new("update_disable".to_string(), "Disable");
let popup_search = CustomMenuItem::new("popup_search", "Pop-up Search");
let popup_search = CustomMenuItem::new("popup_search".to_string(), "Pop-up Search");
let popup_search_menu = if app_conf.popup_search {
popup_search.selected()
} else {
@@ -58,7 +59,7 @@ pub fn init() -> Menu {
};
#[cfg(target_os = "macos")]
let titlebar = CustomMenuItem::new("titlebar", "Titlebar").accelerator("CmdOrCtrl+B");
let titlebar = CustomMenuItem::new("titlebar".to_string(), "Titlebar").accelerator("CmdOrCtrl+B");
#[cfg(target_os = "macos")]
let titlebar_menu = if app_conf.titlebar {
titlebar.selected()
@@ -66,7 +67,7 @@ pub fn init() -> Menu {
titlebar
};
let system_tray = CustomMenuItem::new("system_tray", "System Tray");
let system_tray = CustomMenuItem::new("system_tray".to_string(), "System Tray");
let system_tray_menu = if app_conf.tray {
system_tray.selected()
} else {
@@ -77,7 +78,7 @@ pub fn init() -> Menu {
let preferences_menu = Submenu::new(
"Preferences",
Menu::with_items([
CustomMenuItem::new("control_center", "Control Center")
CustomMenuItem::new("control_center".to_string(), "Control Center")
.accelerator("CmdOrCtrl+Shift+P")
.into(),
MenuItem::Separator.into(),
@@ -85,9 +86,9 @@ pub fn init() -> Menu {
#[cfg(target_os = "macos")]
titlebar_menu.into(),
#[cfg(target_os = "macos")]
CustomMenuItem::new("hide_dock_icon", "Hide Dock Icon").into(),
CustomMenuItem::new("hide_dock_icon".to_string(), "Hide Dock Icon").into(),
system_tray_menu.into(),
CustomMenuItem::new("inject_script", "Inject Script")
CustomMenuItem::new("inject_script".to_string(), "Inject Script")
.accelerator("CmdOrCtrl+J")
.into(),
MenuItem::Separator.into(),
@@ -132,18 +133,18 @@ pub fn init() -> Menu {
.into(),
MenuItem::Separator.into(),
popup_search_menu.into(),
CustomMenuItem::new("sync_prompts", "Sync Prompts").into(),
CustomMenuItem::new("sync_prompts".to_string(), "Sync Prompts").into(),
MenuItem::Separator.into(),
CustomMenuItem::new("go_conf", "Go to Config")
CustomMenuItem::new("go_conf".to_string(), "Go to Config")
.accelerator("CmdOrCtrl+Shift+G")
.into(),
CustomMenuItem::new("restart", "Restart ChatGPT")
CustomMenuItem::new("restart".to_string(), "Restart ChatGPT")
.accelerator("CmdOrCtrl+Shift+R")
.into(),
CustomMenuItem::new("clear_conf", "Clear Config").into(),
CustomMenuItem::new("clear_conf".to_string(), "Clear Config").into(),
MenuItem::Separator.into(),
CustomMenuItem::new("nofwl", "NoFWL Desktop Application").into(),
CustomMenuItem::new("buy_coffee", "Buy lencx a coffee").into(),
CustomMenuItem::new("nofwl".to_string(), "NoFWL Desktop Application").into(),
CustomMenuItem::new("buy_coffee".to_string(), "Buy lencx a coffee").into(),
]),
);
@@ -162,28 +163,38 @@ pub fn init() -> Menu {
let view_menu = Submenu::new(
"View",
Menu::new()
.add_item(CustomMenuItem::new("go_back", "Go Back").accelerator("CmdOrCtrl+["))
.add_item(CustomMenuItem::new("go_forward", "Go Forward").accelerator("CmdOrCtrl+]"))
.add_item(CustomMenuItem::new("go_back".to_string(), "Go Back").accelerator("CmdOrCtrl+["))
.add_item(
CustomMenuItem::new("scroll_top", "Scroll to Top of Screen").accelerator("CmdOrCtrl+Up"),
CustomMenuItem::new("go_forward".to_string(), "Go Forward").accelerator("CmdOrCtrl+]"),
)
.add_item(
CustomMenuItem::new("scroll_bottom", "Scroll to Bottom of Screen")
CustomMenuItem::new("scroll_top".to_string(), "Scroll to Top of Screen")
.accelerator("CmdOrCtrl+Up"),
)
.add_item(
CustomMenuItem::new("scroll_bottom".to_string(), "Scroll to Bottom of Screen")
.accelerator("CmdOrCtrl+Down"),
)
.add_native_item(MenuItem::Separator)
.add_item(CustomMenuItem::new("zoom_0", "Zoom to Actual Size").accelerator("CmdOrCtrl+0"))
.add_item(CustomMenuItem::new("zoom_out", "Zoom Out").accelerator("CmdOrCtrl+-"))
.add_item(CustomMenuItem::new("zoom_in", "Zoom In").accelerator("CmdOrCtrl+Plus"))
.add_item(
CustomMenuItem::new("zoom_0".to_string(), "Zoom to Actual Size").accelerator("CmdOrCtrl+0"),
)
.add_item(CustomMenuItem::new("zoom_out".to_string(), "Zoom Out").accelerator("CmdOrCtrl+-"))
.add_item(CustomMenuItem::new("zoom_in".to_string(), "Zoom In").accelerator("CmdOrCtrl+Plus"))
.add_native_item(MenuItem::Separator)
.add_item(CustomMenuItem::new("reload", "Refresh the Screen").accelerator("CmdOrCtrl+R")),
.add_item(
CustomMenuItem::new("reload".to_string(), "Refresh the Screen").accelerator("CmdOrCtrl+R"),
),
);
let window_menu = Submenu::new(
"Window",
Menu::new()
.add_item(CustomMenuItem::new("app_website", "ChatGPT User's Guide"))
.add_item(CustomMenuItem::new("dalle2", "DALL·E 2"))
.add_item(CustomMenuItem::new(
"app_website".to_string(),
"ChatGPT User's Guide",
))
.add_item(CustomMenuItem::new("dalle2".to_string(), "DALL·E 2"))
.add_native_item(MenuItem::Separator)
.add_native_item(MenuItem::Minimize)
.add_native_item(MenuItem::Zoom),
@@ -192,11 +203,15 @@ pub fn init() -> Menu {
let help_menu = Submenu::new(
"Help",
Menu::new()
.add_item(CustomMenuItem::new("chatgpt_log", "ChatGPT Log"))
.add_item(CustomMenuItem::new("update_log", "Update Log"))
.add_item(CustomMenuItem::new("report_bug", "Report Bug"))
.add_item(CustomMenuItem::new(
"chatgpt_log".to_string(),
"ChatGPT 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("dev_tools", "Toggle Developer Tools").accelerator("CmdOrCtrl+Shift+I"),
CustomMenuItem::new("dev_tools".to_string(), "Toggle Developer Tools")
.accelerator("CmdOrCtrl+Shift+I"),
),
);
@@ -233,7 +248,7 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
// Preferences
"control_center" => window::cmd::control_window(app),
"restart" => tauri::api::process::restart(&app.env()),
"inject_script" => open(&app, &script_path),
"inject_script" => open(&app, script_path),
"go_conf" => utils::open_file(utils::app_root()),
"clear_conf" => utils::clear_conf(&app),
"app_website" => window::cmd::wa_window(
@@ -243,8 +258,8 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
conf::APP_WEBSITE.into(),
None,
),
"nofwl" => open(&app, conf::NOFWL_APP),
"buy_coffee" => open(&app, conf::BUY_COFFEE),
"nofwl" => open(&app, conf::NOFWL_APP.to_string()),
"buy_coffee" => open(&app, conf::BUY_COFFEE.to_string()),
"popup_search" => {
let app_conf = AppConf::read();
let popup_search = !app_conf.popup_search;
@@ -379,8 +394,8 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
.unwrap(),
// Help
"chatgpt_log" => utils::open_file(utils::app_root().join("chatgpt.log")),
"update_log" => open(&app, conf::UPDATE_LOG_URL),
"report_bug" => open(&app, conf::ISSUES_URL),
"update_log" => open(&app, conf::UPDATE_LOG_URL.to_string()),
"report_bug" => open(&app, conf::ISSUES_URL.to_string()),
"dev_tools" => {
win.open_devtools();
win.close_devtools();
@@ -393,29 +408,41 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
pub fn tray_menu() -> SystemTray {
if cfg!(target_os = "macos") {
let mut tray_menu = SystemTrayMenu::new()
.add_item(CustomMenuItem::new("control_center", "Control Center"))
.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", "Show 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", "Hide Dock Icon"))
.add_item(CustomMenuItem::new("show_core", "Show Window"));
.add_item(CustomMenuItem::new(
"hide_dock_icon".to_string(),
"Hide Dock Icon",
))
.add_item(CustomMenuItem::new("show_core".to_string(), "Show Window"));
}
SystemTray::new().with_menu(
tray_menu
.add_native_item(SystemTrayMenuItem::Separator)
.add_item(CustomMenuItem::new("quit", "Quit")),
.add_item(CustomMenuItem::new("quit".to_string(), "Quit")),
)
} else {
SystemTray::new().with_menu(
SystemTrayMenu::new()
.add_item(CustomMenuItem::new("control_center", "Control Center"))
.add_item(CustomMenuItem::new("show_core", "Show Window"))
.add_item(CustomMenuItem::new(
"control_center".to_string(),
"Control Center",
))
.add_item(CustomMenuItem::new("show_core".to_string(), "Show Window"))
.add_native_item(SystemTrayMenuItem::Separator)
.add_item(CustomMenuItem::new("quit", "Quit")),
.add_item(CustomMenuItem::new("quit".to_string(), "Quit")),
)
}
}
@@ -437,7 +464,7 @@ pub fn tray_handler(handle: &AppHandle, event: SystemTrayEvent) {
}
if let Some(tray_win) = handle.get_window("tray") {
tray_win.move_window(Position::TrayCenter).unwrap();
tray_win.move_window(Position::TrayFixedCenter).unwrap();
if tray_win.is_visible().unwrap() {
tray_win.hide().unwrap();
@@ -481,6 +508,6 @@ pub fn tray_handler(handle: &AppHandle, event: SystemTrayEvent) {
}
}
pub fn open(app: &AppHandle, path: &str) {
pub fn open(app: &AppHandle, path: String) {
tauri::api::shell::open(&app.shell_scope(), path, None).unwrap();
}