mirror of
https://github.com/lencx/ChatGPT.git
synced 2024-10-01 01:06:13 -04:00
readme
This commit is contained in:
parent
389e00a5e0
commit
e4be2bc2f3
@ -34,18 +34,18 @@
|
||||
|
||||
Easily install with _[Homebrew](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
|
||||
|
||||
~~~ sh
|
||||
```sh
|
||||
brew tap lencx/chatgpt https://github.com/lencx/ChatGPT.git
|
||||
brew install --cask chatgpt --no-quarantine
|
||||
~~~
|
||||
```
|
||||
|
||||
Also, if you keep a _[Brewfile](https://github.com/Homebrew/homebrew-bundle#usage)_, you can add something like this:
|
||||
|
||||
~~~ rb
|
||||
```rb
|
||||
repo = "lencx/chatgpt"
|
||||
tap repo, "https://github.com/#{repo}.git"
|
||||
cask "popcorn-time", args: { "no-quarantine": true }
|
||||
~~~
|
||||
```
|
||||
|
||||
## 📢 公告
|
||||
|
||||
@ -62,7 +62,7 @@ cask "popcorn-time", args: { "no-quarantine": true }
|
||||
|
||||
项目会维护一份常用命令,您也可以直接将 [chat.model.json](https://github.com/lencx/ChatGPT/blob/main/chat.model.json) 复制到你的本地目录 `~/.chatgpt/chat.model.json`。
|
||||
|
||||
在 ChatGPT 文本输入区域,键入 `/` 开头的字符,则会弹出指令提示,按下空格键,它会默认将命令关联的文本填充到输入区域(注意:如果包含多个指令提示,它只会选择第一个作为填充,你可以持续输入,直到第一个提示命令为你想要时,再按下空格键。或者使用鼠标来点击多条指令中的某一个)。填充完成后,你只需要按下回车键即可。
|
||||
在 ChatGPT 文本输入区域,键入 `/` 开头的字符,则会弹出指令提示,按下空格键,它会默认将命令关联的文本填充到输入区域(注意:如果包含多个指令提示,它只会选择第一个作为填充,你可以持续输入,直到第一个提示命令为你想要时,再按下空格键。或者使用鼠标来点击多条指令中的某一个)。填充完成后,你只需要按下回车键即可。斜杠命令下,使用 TAB 键修改 `{q}` 标签内容(仅支持单个修改 [#54](https://github.com/lencx/ChatGPT/issues/54))。
|
||||
|
||||
![chatgpt](assets/chatgpt.gif)
|
||||
|
||||
@ -74,6 +74,7 @@ cask "popcorn-time", args: { "no-quarantine": true }
|
||||
- 丰富的快捷键
|
||||
- 系统托盘悬浮窗
|
||||
- 应用菜单功能强大
|
||||
- 支持斜杠命令及其配置(可手动配置或从文件同步)
|
||||
|
||||
### 菜单项
|
||||
|
||||
@ -99,18 +100,68 @@ cask "popcorn-time", args: { "no-quarantine": true }
|
||||
- `Report Bug`: 报告 BUG 或反馈建议
|
||||
- `Toggle Developer Tools`: 网站调试工具,调试页面或脚本可能需要
|
||||
|
||||
## 应用配置
|
||||
|
||||
| 平台 | 路径 |
|
||||
| ------- | ------------------------- |
|
||||
| Linux | `/home/lencx/.chatgpt` |
|
||||
| macOS | `/Users/lencx/.chatgpt` |
|
||||
| Windows | `C:\Users\lencx\.chatgpt` |
|
||||
|
||||
- `[.chatgpt]` - 应用配置根路径
|
||||
- `chat.conf.json` - 应用喜好配置
|
||||
- `chat.model.json` - ChatGPT 输入提示,通过斜杠命令来快速完成输入,主要包含三部分:
|
||||
- `user_custom` - 需要手动录入 (**Control Conter -> Language Model -> User Custom**)
|
||||
- `sync_prompts` - 从 [f/awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts) 同步数据 (**Control Conter -> Language Model -> Sync Prompts**)
|
||||
- `sync_custom` - 同步自定义的 json 或 csv 文件数据,支持本地和远程 (**Control Conter -> Language Model -> Sync Custom**)
|
||||
- `chat.model.cmd.json` - 过滤(是否启用)和排序处理后的斜杠命令数据
|
||||
- `[cache_model]` - 缓存同步或录入的数据
|
||||
- `chatgpt_prompts.json` - 缓存 `sync_prompts` 数据
|
||||
- `user_custom.json` - 缓存 `user_custom` 数据
|
||||
- `ae6cf32a6f8541b499d6bfe549dbfca3.json` - 随机生成的文件名,缓存 `sync_custom` 数据
|
||||
- `4f695d3cfbf8491e9b1f3fab6d85715c.json` - 随机生成的文件名,缓存 `sync_custom` 数据
|
||||
- `bd1b96f15a1644f7bd647cc53073ff8f.json` - 随机生成的文件名,缓存 `sync_custom` 数据
|
||||
|
||||
### Sync Custom
|
||||
|
||||
目前同步自定文件仅支持 json 和 csv,且需要满足以下格式,否则会导致应用异常:
|
||||
|
||||
> JSON 格式
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"cmd": "a",
|
||||
"act": "aa",
|
||||
"prompt": "aaa aaa aaa"
|
||||
},
|
||||
{
|
||||
"cmd": "b",
|
||||
"act": "bb",
|
||||
"prompt": "bbb bbb bbb"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
> CSV 格式
|
||||
|
||||
```csv
|
||||
"cmd","act","prompt"
|
||||
"a","aa","aaa aaa aaa"
|
||||
"b","bb","bbb bbb bbb"
|
||||
```
|
||||
|
||||
## 👀 预览
|
||||
|
||||
<img width="320" src="./assets/install.png" alt="install"> <img width="320" src="./assets/control-center.png" alt="control center">
|
||||
<img width="320" src="./assets/export.png" alt="export"> <img width="320" src="./assets/tray.png" alt="tray">
|
||||
<img width="320" src="./assets/tray-login.png" alt="tray login"> <img width="320" src="./assets/auto-update.png" alt="auto update">
|
||||
|
||||
|
||||
---
|
||||
|
||||
<a href="https://www.buymeacoffee.com/lencx" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
||||
|
||||
## ❓常见问题
|
||||
## ❓ 常见问题
|
||||
|
||||
### 不能打开 ChatGPT
|
||||
|
||||
|
64
README.md
64
README.md
@ -11,6 +11,7 @@
|
||||
[![ChatGPT downloads](https://img.shields.io/github/downloads/lencx/ChatGPT/total.svg?style=flat-square)](https://github.com/lencx/ChatGPT/releases)
|
||||
[![chat](https://img.shields.io/badge/chat-discord-blue?style=flat&logo=discord)](https://discord.gg/aPhCRf4zZr)
|
||||
[![lencx](https://img.shields.io/twitter/follow/lencx_.svg?style=social)](https://twitter.com/lencx_)
|
||||
|
||||
<!-- [![中文版 badge](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-Traditional%20Chinese-blue)](./README-ZH.md) -->
|
||||
|
||||
[Awesome ChatGPT](./AWESOME.md)
|
||||
@ -35,18 +36,18 @@
|
||||
|
||||
Easily install with _[Homebrew](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
|
||||
|
||||
~~~ sh
|
||||
```sh
|
||||
brew tap lencx/chatgpt https://github.com/lencx/ChatGPT.git
|
||||
brew install --cask chatgpt --no-quarantine
|
||||
~~~
|
||||
```
|
||||
|
||||
Also, if you keep a _[Brewfile](https://github.com/Homebrew/homebrew-bundle#usage)_, you can add something like this:
|
||||
|
||||
~~~ rb
|
||||
```rb
|
||||
repo = "lencx/chatgpt"
|
||||
tap repo, "https://github.com/#{repo}.git"
|
||||
cask "popcorn-time", args: { "no-quarantine": true }
|
||||
~~~
|
||||
```
|
||||
|
||||
## 📢 Announcement
|
||||
|
||||
@ -63,7 +64,7 @@ After the data import is done, you can restart the app to make the configuration
|
||||
|
||||
The project maintains a list of common commands, or you can copy [chat.model.json](https://github.com/lencx/ChatGPT/blob/main/chat.model.json) directly to your local directory `~/.chatgpt/chat.model.json`
|
||||
|
||||
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.
|
||||
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)).
|
||||
|
||||
![chatgpt](assets/chatgpt.gif)
|
||||
|
||||
@ -75,7 +76,7 @@ In the chatgpt text input area, type a character starting with `/` to bring up t
|
||||
- Common shortcut keys
|
||||
- System tray hover window
|
||||
- Powerful menu items
|
||||
- Shortcut command typing chatgpt prompt
|
||||
- Support for slash commands and their configuration (can be configured manually or synchronized from a file)
|
||||
|
||||
### MenuItem
|
||||
|
||||
@ -101,6 +102,57 @@ In the chatgpt text input area, type a character starting with `/` to bring up t
|
||||
- `Report Bug`: Report a bug or give feedback.
|
||||
- `Toggle Developer Tools`: Developer debugging tools.
|
||||
|
||||
## Application Configuration
|
||||
|
||||
| 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.model.json` - prompts configuration,contains 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))
|
||||
|
@ -8,7 +8,9 @@ fix:
|
||||
feat:
|
||||
- optimize the generated pdf file size
|
||||
- menu added `Sync Prompts`
|
||||
- `Control Center` added `Sync Custom`
|
||||
- the slash command is triggered by the enter key
|
||||
- under the slash command, use the tab key to modify the contents of the `{q}` tag (only single changes are supported (https://github.com/lencx/ChatGPT/issues/54)
|
||||
|
||||
## v0.5.1
|
||||
|
||||
|
48
src-tauri/src/assets/cmd.js
vendored
48
src-tauri/src/assets/cmd.js
vendored
@ -85,37 +85,66 @@ async function cmdTip() {
|
||||
}
|
||||
|
||||
// feat: https://github.com/lencx/ChatGPT/issues/54
|
||||
if (event.keyCode === 9) {
|
||||
if (event.keyCode === 9 && !window.__CHAT_MODEL_STATUS__) {
|
||||
const strGroup = window.__CHAT_MODEL_CMD_PROMPT__.match(/\{([^{}]*)\}/) || [];
|
||||
|
||||
if (strGroup[1]) {
|
||||
searchInput.value = `/${window.__CHAT_MODEL_CMD__}` + `{${strGroup[1]}}` + ' |-> ';
|
||||
window.__CHAT_MODEL_VAR__ = true;
|
||||
searchInput.value = `/${window.__CHAT_MODEL_CMD__}` + ` {${strGroup[1]}}` + ' |-> ';
|
||||
window.__CHAT_MODEL_STATUS__ = 1;
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (window.__CHAT_MODEL_VAR__ && event.keyCode === 9) {
|
||||
if (window.__CHAT_MODEL_STATUS__ === 1 && event.keyCode === 9) {
|
||||
const data = searchInput.value.split('|->');
|
||||
if (data[1]) {
|
||||
if (data[1]?.trim()) {
|
||||
window.__CHAT_MODEL_CMD_PROMPT__ = window.__CHAT_MODEL_CMD_PROMPT__?.replace(/\{([^{}]*)\}/, `{${data[1]?.trim()}}`);
|
||||
// searchInput.value = window.__CHAT_MODEL_CMD_PROMPT__;
|
||||
window.__CHAT_MODEL_STATUS__ = 2;
|
||||
}
|
||||
// event.preventDefault();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// input text
|
||||
if (window.__CHAT_MODEL_STATUS__ === 2 && event.keyCode === 9) {
|
||||
console.log('«110» /src/assets/cmd.js ~> ', __CHAT_MODEL_STATUS__);
|
||||
|
||||
searchInput.value = window.__CHAT_MODEL_CMD_PROMPT__;
|
||||
modelDom.innerHTML = '';
|
||||
delete window.__CHAT_MODEL_STATUS__;
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// type in a space to complete the fill
|
||||
if (event.keyCode === 32) {
|
||||
searchInput.value = window.__CHAT_MODEL_CMD_PROMPT__;
|
||||
modelDom.innerHTML = '';
|
||||
delete window.__CHAT_MODEL_CMD_PROMPT__;
|
||||
}
|
||||
|
||||
// send
|
||||
if (event.keyCode === 13 && window.__CHAT_MODEL_CMD_PROMPT__) {
|
||||
const data = searchInput.value.split('|->');
|
||||
if (data[1]?.trim()) {
|
||||
window.__CHAT_MODEL_CMD_PROMPT__ = window.__CHAT_MODEL_CMD_PROMPT__?.replace(/\{([^{}]*)\}/, `{${data[1]?.trim()}}`);
|
||||
}
|
||||
|
||||
searchInput.value = window.__CHAT_MODEL_CMD_PROMPT__;
|
||||
modelDom.innerHTML = '';
|
||||
delete window.__CHAT_MODEL_CMD_PROMPT__;
|
||||
delete window.__CHAT_MODEL_CMD__;
|
||||
delete window.__CHAT_MODEL_VAR__;
|
||||
delete window.__CHAT_MODEL_STATUS__;
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
searchInput.addEventListener('input', (event) => {
|
||||
if (window.__CHAT_MODEL_VAR__) return;
|
||||
if (searchInput.value === '') {
|
||||
delete window.__CHAT_MODEL_CMD_PROMPT__;
|
||||
delete window.__CHAT_MODEL_CMD__;
|
||||
delete window.__CHAT_MODEL_STATUS__;
|
||||
}
|
||||
|
||||
if (window.__CHAT_MODEL_STATUS__) return;
|
||||
|
||||
const query = searchInput.value;
|
||||
if (!query || !/^\//.test(query)) {
|
||||
@ -140,6 +169,7 @@ async function cmdTip() {
|
||||
modelDom.innerHTML = '';
|
||||
delete window.__CHAT_MODEL_CMD_PROMPT__;
|
||||
delete window.__CHAT_MODEL_CMD__;
|
||||
delete window.__CHAT_MODEL_STATUS__;
|
||||
}
|
||||
}, {
|
||||
capture: false,
|
||||
|
Loading…
Reference in New Issue
Block a user