1
0
mirror of https://github.com/lencx/ChatGPT.git synced 2024-10-01 01:06:13 -04:00

Merge pull request #214 from lencx/dev

This commit is contained in:
lencx 2023-01-15 18:35:57 +08:00 committed by GitHub
commit 3ffd832640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 99 additions and 53 deletions

View File

@ -24,7 +24,7 @@
### Windows
- [ChatGPT_0.9.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/ChatGPT_0.9.1_x64_en-US.msi):
- [ChatGPT_0.9.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/ChatGPT_0.9.2_x64_en-US.msi):
- 使用 [winget](https://winstall.app/apps/lencx.ChatGPT):
```bash
# install the latest version
@ -34,12 +34,12 @@
winget install --id=lencx.ChatGPT -e --version 0.9.0
```
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.9.1))**
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.9.2))**
### Mac
- [ChatGPT_0.9.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/ChatGPT_0.9.1_x64.dmg)
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/ChatGPT.app.tar.gz)
- [ChatGPT_0.9.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/ChatGPT_0.9.2_x64.dmg)
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/ChatGPT.app.tar.gz)
- Homebrew \
_[Homebrew 快捷安装](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
```sh
@ -55,8 +55,8 @@
### Linux
- [chat-gpt_0.9.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/chat-gpt_0.9.1_amd64.deb)
- [chat-gpt_0.9.1_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/chat-gpt_0.9.1_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它**
- [chat-gpt_0.9.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/chat-gpt_0.9.2_amd64.deb)
- [chat-gpt_0.9.2_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/chat-gpt_0.9.2_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它**
- 使用 [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin):
```bash
yay -S chatgpt-desktop-bin

View File

@ -26,7 +26,7 @@
### Windows
- [ChatGPT_0.9.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/ChatGPT_0.9.1_x64_en-US.msi): Direct download installer
- [ChatGPT_0.9.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/ChatGPT_0.9.2_x64_en-US.msi): Direct download installer
- Use [winget](https://winstall.app/apps/lencx.ChatGPT):
```bash
# install the latest version
@ -36,12 +36,12 @@
winget install --id=lencx.ChatGPT -e --version 0.9.0
```
**Note: If the installation path and application name are the same, it will lead to conflict ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.9.1))**
**Note: If the installation path and application name are the same, it will lead to conflict ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.9.2))**
### Mac
- [ChatGPT_0.9.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/ChatGPT_0.9.1_x64.dmg): Direct download installer
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/ChatGPT.app.tar.gz): Download the `.app` installer
- [ChatGPT_0.9.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/ChatGPT_0.9.2_x64.dmg): Direct download installer
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/ChatGPT.app.tar.gz): Download the `.app` installer
- Homebrew \
Or you can install with _[Homebrew](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
```sh
@ -57,8 +57,8 @@
### Linux
- [chat-gpt_0.9.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/chat-gpt_0.9.1_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
- [chat-gpt_0.9.1_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.9.1/chat-gpt_0.9.1_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run
- [chat-gpt_0.9.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/chat-gpt_0.9.2_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
- [chat-gpt_0.9.2_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.9.2/chat-gpt_0.9.2_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run
- Available on [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin) with the package name `chatgpt-desktop-bin`, and you can use your favourite AUR package manager to install it.
<!-- download end -->

View File

@ -1,5 +1,9 @@
# UPDATE LOG
## v0.9.2
fix: slash command does not work
## v0.9.1
fix: slash command does not work

View File

@ -61,7 +61,6 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
.always_on_top(chat_conf.stay_on_top)
.title_bar_style(ChatConfJson::titlebar())
.initialization_script(&utils::user_script())
.initialization_script(include_str!("../vendors/jq.js"))
.initialization_script(include_str!("../vendors/floating-ui-core.js"))
.initialization_script(include_str!("../vendors/floating-ui-dom.js"))
.initialization_script(include_str!("../vendors/html2canvas.js"))
@ -86,7 +85,6 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
.theme(theme)
.always_on_top(chat_conf.stay_on_top)
.initialization_script(&utils::user_script())
.initialization_script(include_str!("../vendors/jq.js"))
.initialization_script(include_str!("../vendors/floating-ui-core.js"))
.initialization_script(include_str!("../vendors/floating-ui-dom.js"))
.initialization_script(include_str!("../vendors/html2canvas.js"))

View File

@ -18,7 +18,6 @@ pub fn tray_window(handle: &tauri::AppHandle) {
.always_on_top(true)
.theme(theme)
.initialization_script(&utils::user_script())
.initialization_script(include_str!("../vendors/jq.js"))
.initialization_script(include_str!("../vendors/floating-ui-core.js"))
.initialization_script(include_str!("../vendors/floating-ui-dom.js"))
.initialization_script(include_str!("../scripts/core.js"))
@ -74,7 +73,6 @@ pub fn dalle2_window(
.inner_size(800.0, 600.0)
.always_on_top(false)
.theme(theme)
.initialization_script(include_str!("../vendors/jq.js"))
.initialization_script(include_str!("../scripts/core.js"))
.initialization_script(&query)
.initialization_script(include_str!("../scripts/dalle2.js"))

View File

@ -23,7 +23,7 @@ pub const DEFAULT_CHAT_CONF: &str = r#"{
"theme": "Light",
"tray": true,
"titlebar": true,
"popup_search": true,
"popup_search": false,
"global_shortcut": "",
"hide_dock_icon": false,
"default_origin": "https://chat.openai.com",
@ -37,7 +37,7 @@ pub const DEFAULT_CHAT_CONF_MAC: &str = r#"{
"theme": "Light",
"tray": true,
"titlebar": false,
"popup_search": true,
"popup_search": false,
"global_shortcut": "",
"hide_dock_icon": false,
"default_origin": "https://chat.openai.com",

View File

@ -1,6 +1,6 @@
// *** Core Script - CMD ***
$(function() {
function init() {
const styleDom = document.createElement('style');
styleDom.innerHTML = `form {
position: relative;
@ -94,6 +94,7 @@ $(function() {
new MutationObserver(function (mutationsList) {
for (const mutation of mutationsList) {
if (mutation.target.getAttribute('id') === '__next') {
initDom();
cmdTip();
}
if (mutation.target.getAttribute('class') === 'chat-model-cmd-list') {
@ -117,7 +118,7 @@ $(function() {
subtree: true,
});
}, 300);
});
}
async function cmdTip() {
initDom();
@ -143,9 +144,9 @@ async function cmdTip() {
modelDom.innerHTML = `<div>${v.map(itemDom).join('')}</div>`;
window.__CHAT_MODEL_CMD_PROMPT__ = v[0]?.prompt.trim();
window.__CHAT_MODEL_CMD__ = v[0]?.cmd.trim();
window.__list = modelDom.querySelectorAll('.cmd-item');
window.__index = 0;
window.__list[window.__index].classList.add('selected');
window.__cmd_list = modelDom.querySelectorAll('.cmd-item');
window.__cmd_index = 0;
window.__cmd_list[window.__cmd_index].classList.add('selected');
};
const setPrompt = (v = '') => {
if (v.trim()) {
@ -162,28 +163,28 @@ async function cmdTip() {
}
// ------------------ Keyboard scrolling (ArrowUp | ArrowDown) --------------------------
if (event.keyCode === 38 && window.__index > 0) { // ArrowUp
window.__list[window.__index].classList.remove('selected');
window.__index = window.__index - 1;
window.__list[window.__index].classList.add('selected');
window.__CHAT_MODEL_CMD_PROMPT__ = decodeURIComponent(window.__list[window.__index].getAttribute('data-prompt'));
searchInput.value = `/${window.__list[window.__index].getAttribute('data-cmd')}`;
if (event.keyCode === 38 && window.__cmd_index > 0) { // ArrowUp
window.__cmd_list[window.__cmd_index].classList.remove('selected');
window.__cmd_index = window.__cmd_index - 1;
window.__cmd_list[window.__cmd_index].classList.add('selected');
window.__CHAT_MODEL_CMD_PROMPT__ = decodeURIComponent(window.__cmd_list[window.__cmd_index].getAttribute('data-prompt'));
searchInput.value = `/${window.__cmd_list[window.__cmd_index].getAttribute('data-cmd')}`;
event.preventDefault();
}
if (event.keyCode === 40 && window.__index < window.__list.length - 1) { // ArrowDown
window.__list[window.__index].classList.remove('selected');
window.__index = window.__index + 1;
window.__list[window.__index].classList.add('selected');
window.__CHAT_MODEL_CMD_PROMPT__ = decodeURIComponent(window.__list[window.__index].getAttribute('data-prompt'));
searchInput.value = `/${window.__list[window.__index].getAttribute('data-cmd')}`;
if (event.keyCode === 40 && window.__cmd_index < window.__cmd_list.length - 1) { // ArrowDown
window.__cmd_list[window.__cmd_index].classList.remove('selected');
window.__cmd_index = window.__cmd_index + 1;
window.__cmd_list[window.__cmd_index].classList.add('selected');
window.__CHAT_MODEL_CMD_PROMPT__ = decodeURIComponent(window.__cmd_list[window.__cmd_index].getAttribute('data-prompt'));
searchInput.value = `/${window.__cmd_list[window.__cmd_index].getAttribute('data-cmd')}`;
event.preventDefault();
}
const containerHeight = modelDom.offsetHeight;
const itemHeight = window.__list[0].offsetHeight + 1;
const itemHeight = window.__cmd_list[0].offsetHeight + 1;
const itemTop = window.__list[window.__index].offsetTop;
const itemTop = window.__cmd_list[window.__cmd_index].offsetTop;
const itemBottom = itemTop + itemHeight;
if (itemTop < modelDom.scrollTop || itemBottom > modelDom.scrollTop + containerHeight) {
modelDom.scrollTop = itemTop;
@ -239,8 +240,8 @@ async function cmdTip() {
event.preventDefault();
}
}
searchInput.removeEventListener('keydown', cmdKeydown);
searchInput.addEventListener('keydown', cmdKeydown);
searchInput.removeEventListener('keydown', cmdKeydown, { capture: true });
searchInput.addEventListener('keydown', cmdKeydown, { capture: true });
function cmdInput() {
if (searchInput.value === '') {
@ -277,8 +278,19 @@ function initDom() {
const modelDom = document.querySelector('.chat-model-cmd-list');
if (modelDom) {
modelDom.innerHTML = '';
delete window.__CHAT_MODEL_CMD_PROMPT__;
delete window.__CHAT_MODEL_CMD__;
delete window.__CHAT_MODEL_STATUS__;
}
delete window.__CHAT_MODEL_CMD_PROMPT__;
delete window.__CHAT_MODEL_CMD__;
delete window.__CHAT_MODEL_STATUS__;
delete window.__cmd_list;
delete window.__cmd_index;
}
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
init();
} else {
document.addEventListener("DOMContentLoaded", init);
}

View File

@ -40,7 +40,7 @@ window.uid = uid;
window.invoke = invoke;
window.transformCallback = transformCallback;
$(async function () {
async function init() {
if (__TAURI_METADATA__.__currentWindow.label === 'tray') {
document.getElementsByTagName('html')[0].style['font-size'] = '70%';
}
@ -91,4 +91,13 @@ $(async function () {
window.__sync_prompts = async function() {
await invoke('sync_prompts', { time: Date.now() });
}
});
}
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
init();
} else {
document.addEventListener("DOMContentLoaded", init);
}

View File

@ -1,6 +1,6 @@
// *** Core Script - DALL·E 2 ***
$(function () {
function init() {
document.addEventListener("click", (e) => {
const origin = e.target.closest("a");
if (!origin || !origin.target) return;
@ -28,4 +28,13 @@ $(function () {
searchInput.value = query;
}
}, 200)
})
}
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
init();
} else {
document.addEventListener("DOMContentLoaded", init);
}

View File

@ -1,6 +1,6 @@
// *** Core Script - Export ***
$(async function () {
async function init() {
const buttonOuterHTMLFallback = `<button class="btn flex justify-center gap-2 btn-neutral" id="download-png-button">Try Again</button>`;
if (window.innerWidth < 767) return;
const chatConf = await invoke('get_chat_conf') || {};
@ -24,7 +24,7 @@ $(async function () {
removeButtons();
}
}, 1000);
})
}
const Format = {
PNG: "png",
@ -271,3 +271,12 @@ function setIcon(type) {
md: `<svg class="chatappico md" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1380" width="200" height="200"><path d="M128 128h768a42.666667 42.666667 0 0 1 42.666667 42.666667v682.666666a42.666667 42.666667 0 0 1-42.666667 42.666667H128a42.666667 42.666667 0 0 1-42.666667-42.666667V170.666667a42.666667 42.666667 0 0 1 42.666667-42.666667z m170.666667 533.333333v-170.666666l85.333333 85.333333 85.333333-85.333333v170.666666h85.333334v-298.666666h-85.333334l-85.333333 85.333333-85.333333-85.333333H213.333333v298.666666h85.333334z m469.333333-128v-170.666666h-85.333333v170.666666h-85.333334l128 128 128-128h-85.333333z" p-id="1381" fill="currentColor"></path></svg>`
}[type];
}
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
init();
} else {
document.addEventListener("DOMContentLoaded", init);
}

View File

@ -1,6 +1,6 @@
// *** Core Script - DALL·E 2 Core ***
$(async function () {
async function init() {
const chatConf = await invoke('get_chat_conf') || {};
if (!chatConf.popup_search) return;
if (!window.FloatingUIDOM) return;
@ -72,4 +72,13 @@ $(async function () {
});
}
});
})
}
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
init();
} else {
document.addEventListener("DOMContentLoaded", init);
}

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
},
"package": {
"productName": "ChatGPT",
"version": "0.9.1"
"version": "0.9.2"
},
"tauri": {
"allowlist": {