Compare commits

...

41 Commits

Author SHA1 Message Date
lencx
cd36360f0e v0.11.0 2023-02-16 23:54:37 +08:00
lencx
2398026795 readme 2023-02-16 23:53:56 +08:00
lencx
5426a711e9 feat: set window size (#405) 2023-02-16 22:02:12 +08:00
lencx
5ec9bb5656 chore: action 2023-02-15 23:55:08 +08:00
lencx
9cd30c158c Merge branch 'main' into dev 2023-02-15 21:37:20 +08:00
lencx
8c7e6b0818 Merge pull request #397 from targed/main 2023-02-15 14:12:39 +08:00
lencx
48a2a37fa2 Merge pull request #389 from cyhhao/main 2023-02-15 12:27:52 +08:00
targed
3a7da4b610 Update README.md 2023-02-14 17:34:37 -06:00
cyhhao
fde75aa81e format 2023-02-14 16:18:52 +08:00
cyhhao
95f8c16be0 Fix Chinese input method Enter on Safari 2023-02-14 16:10:44 +08:00
lencx
668d666377 Merge branch 'main' into dev 2023-02-13 16:05:11 +08:00
lencx
0871824093 Merge pull request #377 from lencx/doc 2023-02-13 13:49:32 +08:00
lencx
ce66cdbffb readme 2023-02-13 13:47:19 +08:00
lencx
56dae0017e Merge pull request #376 from lencx/doc 2023-02-13 13:19:34 +08:00
lencx
2e46cf4e63 readme 2023-02-13 13:18:39 +08:00
lencx
7c4913b499 readme 2023-02-13 13:12:35 +08:00
lencx
7730d626da readme 2023-02-13 13:11:52 +08:00
lencx
64706adec6 readme 2023-02-13 13:10:29 +08:00
lencx
7fe4a73b5e readme 2023-02-13 13:08:49 +08:00
lencx
7479ee905f fix: close (#349) 2023-02-12 23:33:23 +08:00
lencx
522f7b86b8 fix: save window state (#313) 2023-02-12 00:50:21 +08:00
lencx
4cba634d4a chore: casks 2023-02-12 00:33:51 +08:00
lencx
4a93573f4c Merge branch 'main' into dev 2023-02-12 00:21:13 +08:00
lencx
a67bd0468a chore: action 2023-02-12 00:20:42 +08:00
lencx
2d0cac6766 chore: download 2023-02-11 23:30:06 +08:00
lencx
7836c1263b Merge pull request #330 from cnyy7/patch-1 2023-02-07 22:56:20 +08:00
chennan
b403dea11b Update chatgpt.rb to version 0.10.3
checked locally:

brew reinstall --cask chatgpt --no-quarantine
==> Downloading https://github.com/lencx/ChatGPT/releases/download/v0.10.3/ChatGPT_0.10.3_x64.dmg
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/575340621/b
######################################################################## 100.0%
Warning: Cannot verify integrity of 'a77703907b8af9fcb951d9e896b73c3424f60799b39b49a6b9a2d2e3fca259e3--ChatGPT_0.10.3_x64.dmg'.
No checksum was provided for this cask.
For your reference, the checksum is:
  sha256 "f44838a80844999191a303684fd7ae1811dd2fae6709aebe8bff23c70f9b8a10"
==> Uninstalling Cask chatgpt
==> Backing App 'ChatGPT.app' up to '/usr/local/Caskroom/chatgpt/0.6.10/ChatGPT.app'
==> Removing App '/Applications/ChatGPT.app'
==> Purging files for version 0.6.10 of Cask chatgpt
==> Installing Cask chatgpt
Warning: macOS's Gatekeeper has been disabled for this Cask
==> Moving App 'ChatGPT.app' to '/Applications/ChatGPT.app'
🍺  chatgpt was successfully installed!
2023-02-07 17:03:26 +08:00
lencx
62cf15d952 chore: action 2023-02-06 15:05:30 +08:00
lencx
d786e3a96c chore: action 2023-02-06 14:37:49 +08:00
lencx
28db6a72e5 chore: action 2023-02-06 14:22:58 +08:00
lencx
bc35164538 chore: action 2023-02-06 14:18:31 +08:00
lencx
c2482224a7 chore: action 2023-02-06 14:16:51 +08:00
lencx
8a0b85905d Merge pull request #310 from slithery0/patch-1 2023-02-05 13:04:37 +08:00
rukh
baf055388d Aur repo added, for git version of ChatGPT 2023-02-05 08:36:15 +05:45
lencx
c293f07b3c Merge pull request #301 from lencx/dev 2023-02-03 14:39:50 +08:00
lencx
c6efaec586 v0.10.3 2023-02-03 13:34:42 +08:00
lencx
01c6e11e8c release 2023-02-03 13:33:26 +08:00
lencx
70aac07f8e feat: markdown export (#233) 2023-02-03 12:22:15 +08:00
lencx
4847bb6fac chore: copy 2023-02-03 01:30:03 +08:00
lencx
041ffb7462 fix: conf error (#295) 2023-02-03 01:11:56 +08:00
lencx
93bb98e9c0 Merge pull request #292 from lencx/dev 2023-02-02 01:12:06 +08:00
26 changed files with 9719 additions and 148 deletions

View File

@@ -6,97 +6,192 @@ on:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
create-release:
runs-on: ubuntu-20.04
outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v2
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo "version=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: '${{ env.version }}'
release_name: 'ChatGPT ${{ env.version }}'
body: 'See the assets to download this version and install.'
build-tauri:
needs: create-release
build-chatgpt:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest]
include:
- build: linux
os: ubuntu-latest
arch: x86_64
target: x86_64-unknown-linux-gnu
- build: macos
os: macos-latest
arch: x86_64
target: x86_64-apple-darwin
- buid: macos
os: macos-latest
arch: aarch64
target: aarch64-apple-darwin
- build: windows
os: windows-latest
arch: x86_64
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: setup node
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: install Rust stable
- name: 'Setup Rust'
uses: dtolnay/rust-toolchain@stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
- name: Install app dependencies and build it
run: yarn && yarn build:fe
- name: Build FE
run: pnpm build:fe
# - name: Rewrite tauri.conf.json
# run: yarn fix:conf
- name: Install rust target
run: rustup target add ${{ matrix.target }}
- name: fix tray icon
if: matrix.platform != 'macos-latest'
if: matrix.os != 'macos-latest'
run: |
yarn fix:tray
pnpm fix:tray
- uses: tauri-apps/tauri-action@v0.3
- run: pnpm build --target ${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 📝: https://tauri.app/v1/guides/distribution/updater#signing-updates
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
name: artifacts-${{ matrix.arch }}
path: |
./target/${{ matrix.target }}/release/bundle/appimage/**.AppImage.*
./target/${{ matrix.target }}/release/bundle/deb/**.deb
- uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: artifacts-${{ matrix.arch }}
path: |
./target/${{ matrix.target }}/release/bundle/dmg/**.dmg
./target/${{ matrix.target }}/release/bundle/macos/**.app.*
- uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: artifacts-${{ matrix.arch }}
path: |
./target/${{ matrix.target }}/release/bundle/msi/**
release-chatgpt:
needs: build-chatgpt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Query version number
run: echo "version=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Download x86_64 artifacts
uses: actions/download-artifact@v3
with:
name: artifacts-x86_64
path: artifacts/x86_64
- name: Download aarch64 artifacts
uses: actions/download-artifact@v3
with:
name: artifacts-aarch64
path: artifacts/aarch64
- name: Rename artifacts
run: |
mv "artifacts/aarch64/dmg/ChatGPT_${{ env.version }}_aarch64.dmg" "artifacts/ChatGPT_${{ env.version }}_macos_aarch64.dmg"
mv "artifacts/aarch64/macos/ChatGPT.app.tar.gz" "artifacts/ChatGPT_${{ env.version }}_macos_aarch64.app.tar.gz"
mv "artifacts/aarch64/macos/ChatGPT.app.tar.gz.sig" "artifacts/ChatGPT_${{ env.version }}_macos_aarch64.app.tar.gz.sig"
mv "artifacts/x86_64/dmg/ChatGPT_${{ env.version }}_x64.dmg" "artifacts/ChatGPT_${{ env.version }}_macos_x86_64.dmg"
mv "artifacts/x86_64/macos/ChatGPT.app.tar.gz" "artifacts/ChatGPT_${{ env.version }}_macos_x86_64.app.tar.gz"
mv "artifacts/x86_64/macos/ChatGPT.app.tar.gz.sig" "artifacts/ChatGPT_${{ env.version }}_macos_x86_64.app.tar.gz.sig"
mv "artifacts/x86_64/deb/chat-gpt_${{ env.version }}_amd64.deb" "artifacts/x86_64/deb/ChatGPT_${{ env.version }}_linux_x86_64.deb"
mv "artifacts/x86_64/appimage/chat-gpt_${{ env.version }}_amd64.AppImage.tar.gz" "artifacts/ChatGPT_${{ env.version }}_linux_x86_64.AppImage.tar.gz"
mv "artifacts/x86_64/appimage/chat-gpt_${{ env.version }}_amd64.AppImage.tar.gz.sig" "artifacts/ChatGPT_${{ env.version }}_linux_x86_64.AppImage.tar.gz.sig"
mv "artifacts/x86_64/ChatGPT_${{ env.version }}_x64_en-US.msi" "artifacts/ChatGPT_${{ env.version }}_windows_x86_64.msi"
mv "artifacts/x86_64/ChatGPT_${{ env.version }}_x64_en-US.msi.zip" "artifacts/ChatGPT_${{ env.version }}_windows_x86_64.msi.zip"
mv "artifacts/x86_64/ChatGPT_${{ env.version }}_x64_en-US.msi.zip.sig" "artifacts/ChatGPT_${{ env.version }}_windows_x86_64.msi.zip.sig"
- name: Create Release
uses: softprops/action-gh-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.version }}
name: ChatGPT v${{ env.version }}
body: See the assets to download this version and install.
prerelease: false
generate_release_notes: false
files: ./artifacts/**/*
updater:
runs-on: ubuntu-20.04
needs: [create-release, build-tauri]
runs-on: ubuntu-latest
needs: release-chatgpt
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn updater --token=${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Updater JSON
run: pnpm updater --token=${{ secrets.GITHUB_TOKEN }}
- name: Deploy install.json
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# 📝: Edit the deployment directory
publish_dir: ./updater
force_orphan: true
# force_orphan: true
# publish-winget:
# # Action can only be run on windows
# runs-on: windows-latest
# needs: [create-release, build-tauri]
# steps:
# - uses: vedantmgoyal2009/winget-releaser@v1
# with:
# identifier: lencx.ChatGPT
# token: ${{ secrets.WINGET_TOKEN }}
# version: ${{ env.version }}
- name: Query version number
run: echo "version=${GITHUB_REF:11}" >> $GITHUB_ENV
publish-winget:
# Action can only be run on windows
runs-on: windows-latest
needs: [build-chatgpt, release-chatgpt]
steps:
- uses: vedantmgoyal2009/winget-releaser@v1
with:
identifier: lencx.ChatGPT
token: ${{ secrets.WINGET_TOKEN }}
version: ${{ github.event.release.tag_name }}

6
.gitignore vendored
View File

@@ -1,11 +1,11 @@
package-lock.json
node_modules/
yarn.lock
*.lock
.yarn/*
.pnp.*
# rust
target/
Cargo.lock
# Logs
logs

4589
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -20,11 +20,11 @@
- [📝 更新日志](./UPDATE_LOG.md)
- [🕒 历史版本...](https://github.com/lencx/ChatGPT/releases)
<!-- download start -->
<!-- tr-download-start -->
### Windows
- [ChatGPT_0.10.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT_0.10.2_x64_en-US.msi):
- [ChatGPT_0.11.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/ChatGPT_0.11.0_x64_en-US.msi):
- 使用 [winget](https://winstall.app/apps/lencx.ChatGPT):
```bash
@@ -35,12 +35,12 @@
winget install --id=lencx.ChatGPT -e --version 0.10.0
```
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.2))**
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.11.0))**
### Mac
- [ChatGPT_0.10.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT_0.10.2_x64.dmg)
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT.app.tar.gz)
- [ChatGPT_0.11.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/ChatGPT_0.11.0_x64.dmg)
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/ChatGPT.app.tar.gz)
- Homebrew \
_[Homebrew 快捷安装](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
```sh
@@ -56,14 +56,14 @@
### Linux
- [chat-gpt_0.10.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/chat-gpt_0.10.2_amd64.deb)
- [chat-gpt_0.10.2_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/chat-gpt_0.10.2_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它**
- [chat-gpt_0.11.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/chat-gpt_0.11.0_amd64.deb)
- [chat-gpt_0.11.0_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/chat-gpt_0.11.0_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它**
- 使用 [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin):
```bash
yay -S chatgpt-desktop-bin
```
<!-- download end -->
<!-- tr-download-end -->
## 📢 公告
@@ -248,6 +248,8 @@ yarn build
<img width="180" src="https://user-images.githubusercontent.com/16164244/207228300-ea5c4688-c916-4c55-a8c3-7f862888f351.png"> <img width="200" src="https://user-images.githubusercontent.com/16164244/207228025-117b5f77-c5d2-48c2-a070-774b7a1596f2.png">
<a href="https://t.zsxq.com/0bQikmcVw"><img width="360" src="./assets/zsxq.png"></a>
## License
Apache License

View File

@@ -23,11 +23,11 @@
- [📝 Update Log](./UPDATE_LOG.md)
- [🕒 History versions...](https://github.com/lencx/ChatGPT/releases)
<!-- download start -->
<!-- tr-download-start -->
### Windows
- [ChatGPT_0.10.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT_0.10.2_x64_en-US.msi): Direct download installer
- [ChatGPT_0.11.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/ChatGPT_0.11.0_x64_en-US.msi): Direct download installer
- Use [winget](https://winstall.app/apps/lencx.ChatGPT):
```bash
@@ -38,12 +38,19 @@
winget install --id=lencx.ChatGPT -e --version 0.10.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.10.2))**
- Use [Chocolatey](https://community.chocolatey.org/packages/chatgpt/0.11.0#versionhistory):
```bash
# install the package
choco install chatgpt -y
```
**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.11.0))**
### Mac
- [ChatGPT_0.10.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT_0.10.2_x64.dmg): Direct download installer
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT.app.tar.gz): Download the `.app` installer
- [ChatGPT_0.11.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/ChatGPT_0.11.0_x64.dmg): Direct download installer
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/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
@@ -59,11 +66,13 @@
### Linux
- [chat-gpt_0.10.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/chat-gpt_0.10.2_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
- [chat-gpt_0.10.2_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/chat-gpt_0.10.2_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run
- [chat-gpt_0.11.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/chat-gpt_0.11.0_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
- [chat-gpt_0.11.0_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.11.0/chat-gpt_0.11.0_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.
- Also, [Aur](https://aur.archlinux.org/packages/chatgpt-desktop-git) available with the package name `chatgpt-desktop-git`.
<!-- chatgpt-desktop-git always builds the latest commits of main branch -->
<!-- download end -->
<!-- tr-download-end -->
## 📢 Announcement
@@ -258,6 +267,8 @@ yarn build
<img width="180" src="https://user-images.githubusercontent.com/16164244/207228300-ea5c4688-c916-4c55-a8c3-7f862888f351.png"> <img width="200" src="https://user-images.githubusercontent.com/16164244/207228025-117b5f77-c5d2-48c2-a070-774b7a1596f2.png">
<a href="https://t.zsxq.com/0bQikmcVw"><img width="360" src="./assets/zsxq.png"></a>
## License
Apache License

View File

@@ -1,5 +1,31 @@
# UPDATE LOG
## v0.11.0
Fix:
- User-defined close button behavior (exit or minimize) (`Control Center -> Settings -> Main Window -> Close Exit`). (https://github.com/lencx/ChatGPT/issues/359)
- Markdown content layout (https://github.com/lencx/ChatGPT/issues/378)
Feat:
- Set the main window and tray window size (https://github.com/lencx/ChatGPT/issues/405)
- Save window positions and sizes and restore them when the app is reopened (`Control Center -> Settings -> General -> Save Window State`)
- macOS support for aarch64 installer (https://github.com/lencx/ChatGPT/issues/380)
## v0.10.3
> Note: As of now the ChatGPT desktop app has added a lot of exciting features and it continues to improve, as the app grows it has gone far beyond what ChatGPT was intended for. I want to make it the ultimate goal that any website can be easily wrapped to the desktop through user customization. So it needed an international user guide to guide users to use it more professionally. And https://app.nofwl.com is the manual for the app, which will be built into the app (`Menu -> Window -> ChatGPT User's Guide`) so you can access it anytime. It's just starting at the moment, so stay tuned.
Fix:
- Incompatible configuration data causes program crashes (https://github.com/lencx/ChatGPT/issues/295)
Feat:
- Silent copy text
- Markdown export support distinguishes between users and bots (https://github.com/lencx/ChatGPT/issues/233)
## v0.10.2
Fix:

BIN
assets/zsxq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,8 +1,8 @@
cask "chatgpt" do
version "0.6.10"
sha256 "e85062565f826d32219c53b184d6df9c89441d4231cdfff775c2de8c50ac9906"
version "0.10.3"
sha256 "f44838a80844999191a303684fd7ae1811dd2fae6709aebe8bff23c70f9b8a10"
url "https://github.com/lencx/ChatGPT/releases/download/v#{version}/ChatGPT_#{version}_x64.dmg"
url "https://github.com/lencx/ChatGPT/releases/download/v#{version}/ChatGPT_#{version}_macos_x86_64.dmg"
name "ChatGPT"
desc "Desktop wrapper for OpenAI ChatGPT"
homepage "https://github.com/lencx/ChatGPT#readme"

View File

@@ -4,14 +4,14 @@
"scripts": {
"dev:fe": "vite",
"build:fe": "tsc && vite build",
"dev": "yarn tauri dev",
"build": "yarn tauri build",
"dev": "tauri dev",
"build": "tauri build",
"updater": "tr updater",
"release": "tr release --git",
"fix:conf": "tr override --json.tauri_updater_active=false",
"fix:tray": "tr override --json.tauri_systemTray_iconPath=\"icons/tray-icon-light.png\" --json.tauri_systemTray_iconAsTemplate=false",
"fix:tray:mac": "tr override --json.tauri_systemTray_iconPath=\"icons/tray-icon.png\" --json.tauri_systemTray_iconAsTemplate=true",
"download": "node ./scripts/download.js",
"download": "tr download --mdfile=README.md,README-ZH_CN.md --f1=38 --f2=35",
"fmt:rs": "cargo fmt",
"tr": "tr",
"tauri": "tauri",
@@ -45,6 +45,7 @@
"dayjs": "^1.11.7",
"github-markdown-css": "^5.1.0",
"lodash": "^4.17.21",
"monaco-editor": "^0.34.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.4",
@@ -58,7 +59,7 @@
},
"devDependencies": {
"@tauri-apps/cli": "^1.2.2",
"@tauri-release/cli": "^0.2.3",
"@tauri-release/cli": "^0.2.5",
"@types/lodash": "^4.14.191",
"@types/node": "^18.7.10",
"@types/react": "^18.0.15",

4764
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

33
scripts/download.js vendored
View File

@@ -1,33 +0,0 @@
const fs = require('fs');
const argv = process.argv.slice(2);
async function rewrite(filename) {
const content = fs.readFileSync(filename, 'utf8').split('\n');
const startRe = /<!-- download start -->/;
const endRe = /<!-- download end -->/;
let flag = false;
for (let i = 0; i < content.length; i++) {
if (startRe.test(content[i])) {
flag = true;
}
if (flag) {
if (!/winget install --id=lencx.ChatGPT -e --version/.test(content[i])) {
content[i] = content[i].replace(/(\d+).(\d+).(\d+)/g, argv[0]);
}
}
if (endRe.test(content[i])) {
break;
}
}
fs.writeFileSync(filename, content.join('\n'), 'utf8');
}
async function init() {
rewrite('README.md');
rewrite('README-ZH_CN.md');
}
init().catch(console.error);

View File

@@ -30,6 +30,7 @@ tauri = { version = "1.2.4", features = ["api-all", "devtools", "global-shortcut
tauri-plugin-positioner = { version = "1.0.4", features = ["system-tray"] }
tauri-plugin-log = { git = "https://github.com/lencx/tauri-plugins-workspace", branch = "dev", features = ["colored"] }
tauri-plugin-autostart = { git = "https://github.com/lencx/tauri-plugins-workspace", branch = "dev" }
tauri-plugin-window-state = { git = "https://github.com/lencx/tauri-plugins-workspace", branch = "dev" }
# sqlx = { version = "0.6.2", features = ["runtime-tokio-rustls", "sqlite"] }

View File

@@ -62,7 +62,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
.title("ChatGPT")
.resizable(true)
.fullscreen(false)
.inner_size(800.0, 600.0)
.inner_size(app_conf2.main_width, app_conf2.main_height)
.theme(Some(theme))
.always_on_top(app_conf2.stay_on_top)
.initialization_script(&utils::user_script())

View File

@@ -18,7 +18,7 @@ pub fn tray_window(handle: &tauri::AppHandle) {
.title("ChatGPT")
.resizable(false)
.fullscreen(false)
.inner_size(360.0, 540.0)
.inner_size(app_conf.tray_width, app_conf.tray_height)
.decorations(false)
.always_on_top(true)
.theme(Some(theme))
@@ -150,8 +150,7 @@ pub mod cmd {
.build()
.unwrap();
});
}
if let Some(v) = win {
} else if let Some(v) = win {
if !v.is_visible().unwrap() {
v.show().unwrap();
}

View File

@@ -35,17 +35,28 @@ pub_struct!(AppConf {
theme: String,
// auto update policy: prompt / silent / disable
auto_update: String,
tray: bool,
popup_search: bool,
stay_on_top: bool,
main_dashboard: bool,
tray_dashboard: bool,
main_origin: String,
tray_origin: String,
default_origin: String,
ua_window: String,
ua_tray: String,
save_window_state: bool,
global_shortcut: Option<String>,
default_origin: String,
// Main Window
isinit: bool,
popup_search: bool,
main_close: bool,
main_dashboard: bool,
main_origin: String,
ua_window: String,
main_width: f64,
main_height: f64,
// Tray Window
tray_width: f64,
tray_height: f64,
tray: bool,
tray_dashboard: bool,
tray_origin: String,
ua_tray: String,
});
impl AppConf {
@@ -54,13 +65,20 @@ impl AppConf {
Self {
titlebar: !cfg!(target_os = "macos"),
hide_dock_icon: false,
save_window_state: false,
theme: "light".into(),
auto_update: "prompt".into(),
tray: true,
popup_search: false,
isinit: true,
main_close: false,
stay_on_top: false,
main_dashboard: false,
tray_dashboard: false,
main_width: 800.0,
main_height: 600.0,
tray_width: 360.0,
tray_height: 540.0,
main_origin: CHATGPT_URL.into(),
tray_origin: CHATGPT_URL.into(),
default_origin: CHATGPT_URL.into(),
@@ -76,7 +94,14 @@ impl AppConf {
pub fn read() -> Self {
match std::fs::read_to_string(Self::file_path()) {
Ok(v) => serde_json::from_str::<AppConf>(&v).unwrap(),
Ok(v) => {
if let Ok(v2) = serde_json::from_str::<AppConf>(&v) {
v2
} else {
error!("conf_read_parse_error");
Self::default()
}
}
Err(err) => {
error!("conf_read_error: {}", err);
Self::default()

View File

@@ -87,16 +87,41 @@ async fn main() {
builder = builder.system_tray(menu::tray_menu());
}
if app_conf.save_window_state {
builder = builder.plugin(tauri_plugin_window_state::Builder::default().build());
}
builder
.on_menu_event(menu::menu_handler)
.on_system_tray_event(menu::tray_handler)
.on_window_event(|event| {
.on_window_event(move |event| {
if let tauri::WindowEvent::CloseRequested { api, .. } = event.event() {
let win = event.window();
let win = event.window().clone();
let app_conf = AppConf::read();
if win.label() == "core" {
event.window().minimize().unwrap();
if app_conf.isinit {
tauri::api::dialog::ask(
Some(event.window()),
"",
"Do you want to exit the application when you click the [x] button?",
move |is_ok| {
app_conf
.amend(serde_json::json!({ "isinit" : false, "main_close": is_ok }))
.write();
if is_ok {
std::process::exit(0);
} else {
win.minimize().unwrap();
}
},
);
} else if app_conf.main_close {
std::process::exit(0);
} else {
win.minimize().unwrap();
}
} else {
win.close().unwrap();
event.window().close().unwrap();
}
api.prevent_close();
}

View File

@@ -79,6 +79,10 @@ function init() {
width: 16px;
height: 16px;
}
.chatappico.cpok {
width: 16px;
height: 16px;
}
@media screen and (max-width: 767px) {
#download-png-button, #download-pdf-button, #download-html-button {
display: none;

View File

@@ -101,6 +101,11 @@ async function init() {
}
});
// Fix Chinese input method "Enter" on Safari
document.addEventListener("keydown", (e) => {
if(e.keyCode == 229) e.stopPropagation();
}, true)
if (window.location.host === 'chat.openai.com') {
window.__sync_prompts = async function() {
await invoke('sync_prompts', { time: Date.now() });

View File

@@ -137,7 +137,14 @@ function addActionsButtons(actionsArea, TryAgainButton) {
}
async function exportMarkdown() {
const data = ExportMD.turndown(document.querySelector("main div>div>div").innerHTML);
const content = Array.from(document.querySelectorAll('main .items-center>div')).map(i => {
let j = i.cloneNode(true);
if (/dark\:bg-gray-800/.test(i.getAttribute('class'))) {
j.innerHTML = `<blockquote>${i.innerHTML}</blockquote>`;
}
return j.innerHTML;
}).join('<hr />');
const data = ExportMD.turndown(content);
const { id, filename } = getName();
await invoke('save_file', { name: `notes/${id}.md`, content: data });
await invoke('download_list', { pathname: 'chat.notes.json', filename, id, dir: 'notes' });
@@ -274,7 +281,8 @@ function setIcon(type) {
png: `<svg class="chatappico" viewBox="0 0 1070 1024"><path d="M981.783273 0H85.224727C38.353455 0 0 35.374545 0 83.083636v844.893091c0 47.616 38.353455 86.574545 85.178182 86.574546h903.633454c46.917818 0 81.733818-38.958545 81.733819-86.574546V83.083636C1070.592 35.374545 1028.701091 0 981.783273 0zM335.825455 135.912727c74.193455 0 134.330182 60.974545 134.330181 136.285091 0 75.170909-60.136727 136.192-134.330181 136.192-74.286545 0-134.516364-61.021091-134.516364-136.192 0-75.264 60.229818-136.285091 134.516364-136.285091z m-161.512728 745.937455a41.890909 41.890909 0 0 1-27.648-10.379637 43.752727 43.752727 0 0 1-4.654545-61.067636l198.097454-255.162182a42.123636 42.123636 0 0 1 57.716364-6.702545l116.549818 128.139636 286.906182-352.814545c14.615273-18.711273 90.251636-106.775273 135.866182-6.935273 0.093091-0.093091 0.093091 112.965818 0.232727 247.761455 0.093091 140.8 0.093091 317.067636 0.093091 317.067636-1.024-0.093091-762.740364 0.093091-763.112727 0.093091z" fill="currentColor"></path></svg>`,
pdf: `<svg class="chatappico pdf" viewBox="0 0 1024 1024"><path d="M821.457602 118.382249H205.725895c-48.378584 0-87.959995 39.583368-87.959996 87.963909v615.731707c0 48.378584 39.581411 87.959995 87.959996 87.959996h615.733664c48.380541 0 87.961952-39.581411 87.961952-87.959996V206.346158c-0.001957-48.378584-39.583368-87.963909-87.963909-87.963909zM493.962468 457.544987c-10.112054 32.545237-21.72487 82.872662-38.806571 124.248336-8.806957 22.378397-8.380404 18.480717-15.001764 32.609808l5.71738-1.851007c58.760658-16.443827 99.901532-20.519564 138.162194-27.561607-7.67796-6.06371-14.350194-10.751884-19.631237-15.586807-26.287817-29.101504-35.464584-34.570387-70.440002-111.862636v0.003913z m288.36767 186.413594c-7.476424 8.356924-20.670227 13.191847-40.019704 13.191847-33.427694 0-63.808858-9.229597-107.79277-31.660824-75.648648 8.356924-156.097 17.214754-201.399704 31.729308-2.199293 0.876587-4.832967 1.759043-7.916674 3.077836-54.536215 93.237125-95.031389 132.767663-130.621199 131.19646-11.286054-0.49895-27.694661-7.044-32.973748-10.11988l-6.52157-6.196764-2.29517-4.353583c-3.07588-7.91863-3.954423-15.395054-2.197337-23.751977 4.838837-23.309771 29.907651-60.251638 82.686779-93.237126 8.356924-6.159587 27.430511-15.897917 45.020944-24.25484 13.311204-21.177004 19.45905-34.744531 36.341171-72.259702 19.102937-45.324228 36.505531-99.492589 47.500041-138.191543v-0.44025c-16.267727-53.219378-25.945401-89.310095-9.67376-147.80856 3.958337-16.71189 18.46702-33.864031 34.748444-33.864031h10.552304c10.115967 0 19.791684 3.520043 26.829814 10.552304 29.029107 29.031064 15.39114 103.824649 0.8805 162.323113-0.8805 2.63563-1.322707 4.832967-1.761 6.153717 17.59239 49.697378 45.400538 98.774492 73.108895 121.647926 11.436717 8.791304 22.638634 18.899444 36.71098 26.814161 19.791684-2.20125 37.517128-4.11487 55.547812-4.11487 54.540128 0 87.525615 9.67963 100.279169 30.351814 4.400543 7.034217 6.595923 15.389184 5.281043 24.1844-0.44025 10.996467-4.39663 21.112434-12.31526 29.031064z m-27.796407-36.748157c-4.394673-4.398587-17.024957-16.936907-78.601259-16.936907-3.073923 0-10.622744-0.784623-14.57521 3.612007 32.104987 14.072347 62.830525 24.757704 83.058545 24.757703 3.083707 0 5.72325-0.442207 8.356923-0.876586h1.759044c2.20125-0.8805 3.520043-1.324663 3.960293-5.71738-0.87463-1.324663-1.757087-3.083707-3.958336-4.838837z m-387.124553 63.041845c-9.237424 5.27713-16.71189 10.112054-21.112433 13.634053-31.226444 28.586901-51.018128 57.616008-53.217422 74.331812 19.789727-6.59788 45.737084-35.626987 74.329855-87.961952v-0.003913z m125.574957-297.822284l2.197336-1.761c3.079793-14.072347 5.232127-29.189554 7.87167-38.869184l1.318794-7.036174c4.39663-25.070771 2.71781-39.720334-4.76057-50.272637l-6.59788-2.20125a57.381208 57.381208 0 0 0-3.079794 5.27713c-7.474467 18.47289-7.063567 55.283661 3.0524 94.865072l-0.001956-0.001957z" fill="currentColor"></path></svg>`,
md: `<svg class="chatappico md" viewBox="0 0 1024 1024" 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>`,
copy: `<svg class="chatappico copy" stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect></svg>`
copy: `<svg class="chatappico copy" stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect></svg>`,
cpok: `<svg class="chatappico cpok" viewBox="0 0 24 24"><g fill="none" stroke="#10a37f" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M16 4h2a2 2 0 0 1 2 2v4m1 4H11"/><path d="m15 10l-4 4l4 4"/></g></svg>`
}[type];
}
@@ -289,12 +297,14 @@ function copyBtns() {
btn.innerHTML = setIcon('copy');
i.querySelector('.self-end').appendChild(btn);
btn.onclick = () => {
copyToClipboard(i?.innerText?.trim() || '');
copyToClipboard(i?.innerText?.trim() || '', btn);
}
})
}
function copyToClipboard(text) {
function copyToClipboard(text, btn) {
window.clearTimeout(window.__cpTimeout);
btn.innerHTML = setIcon('cpok');
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
} else {
@@ -308,7 +318,9 @@ function copyToClipboard(text) {
document.execCommand('copy', true);
document.body.removeChild(textarea);
}
message('Copied to clipboard');
window.__cpTimeout = setTimeout(() => {
btn.innerHTML = setIcon('copy');
}, 1000);
}
if (

View File

@@ -2,7 +2,9 @@ var ExportMD = (function () {
if (!TurndownService || !turndownPluginGfm) return;
const hljsREG = /^.*(hljs).*(language-[a-z0-9]+).*$/i;
const gfm = turndownPluginGfm.gfm
const turndownService = new TurndownService()
const turndownService = new TurndownService({
hr: '---'
})
.use(gfm)
.addRule('code', {
filter: (node) => {

View File

@@ -7,7 +7,7 @@
},
"package": {
"productName": "ChatGPT",
"version": "0.10.2"
"version": "0.11.0"
},
"tauri": {
"allowlist": {

View File

@@ -8,8 +8,8 @@ type rowSelectionOptions = {
key: 'id' | string;
rowType: 'id' | 'row' | 'all';
};
export function useTableRowSelection(options: Partial<rowSelectionOptions> = {}) {
const { key = 'id', rowType = 'id' } = options;
export function useTableRowSelection(options?: Partial<rowSelectionOptions>) {
const { key = 'id', rowType = 'id' } = options || {};
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const [selectedRowIDs, setSelectedRowIDs] = useState<string[]>([]);
const [selectedRows, setSelectedRows] = useState<Record<string | symbol, any>[]>([]);

View File

@@ -18,6 +18,9 @@ export default function General() {
<Form.Item label="Stay On Top" name="stay_on_top" valuePropName="checked">
<Switch />
</Form.Item>
<Form.Item label="Save Window State" name="save_window_state" valuePropName="checked">
<Switch />
</Form.Item>
{platformInfo === 'darwin' && (
<Form.Item label="Titlebar" name="titlebar" valuePropName="checked">
<Switch />

View File

@@ -1,4 +1,4 @@
import { Form, Switch, Input, Tooltip } from 'antd';
import { Form, Switch, Input, InputNumber, Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import SwitchOrigin from '@/components/SwitchOrigin';
@@ -30,12 +30,32 @@ const PopupSearchLabel = () => {
);
};
const MainCloseLabel = () => {
return (
<span>
Close Exit{' '}
<Tooltip title="Click the close button whether to exit directly, the default minimized.">
<QuestionCircleOutlined style={{ color: '#1677ff' }} />
</Tooltip>
</span>
);
};
export default function MainWindow() {
return (
<>
<Form.Item label={<PopupSearchLabel />} name="popup_search" valuePropName="checked">
<Switch />
</Form.Item>
<Form.Item label={<MainCloseLabel />} name="main_close" valuePropName="checked">
<Switch />
</Form.Item>
<Form.Item label="Default Width" name="main_width">
<InputNumber />
</Form.Item>
<Form.Item label="Default Height" name="main_height">
<InputNumber />
</Form.Item>
<SwitchOrigin name="main" />
<Form.Item label="User Agent (Main)" name="ua_window">
<Input.TextArea

View File

@@ -1,4 +1,4 @@
import { Form, Switch, Input, Tooltip } from 'antd';
import { Form, Switch, Input, InputNumber, Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { DISABLE_AUTO_COMPLETE } from '@/utils';
@@ -23,6 +23,12 @@ export default function TrayWindow() {
<Form.Item label="Enable SystemTray" name="tray" valuePropName="checked">
<Switch />
</Form.Item>
<Form.Item label="Default Width" name="tray_width">
<InputNumber />
</Form.Item>
<Form.Item label="Default Height" name="tray_height">
<InputNumber />
</Form.Item>
<SwitchOrigin name="tray" />
<Form.Item label={<UALabel />} name="ua_tray">
<Input.TextArea

View File

@@ -24,5 +24,19 @@ export default defineConfig({
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
// produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_DEBUG,
rollupOptions: {
output: {
manualChunks: {
ant: ['antd'],
antico: ['@ant-design/icons'],
editor: ['@monaco-editor/react'],
utils: ['lodash', 'uuid', 'dayjs', 'clsx'],
rrr: ['react', 'react-dom', 'react-router-dom'],
rm: ['react-markdown'],
rsh: ['react-syntax-highlighter'],
md: ['github-markdown-css', 'rehype-raw', 'remark-comment-config', 'remark-gfm'],
},
},
},
},
});