mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
Merge pull request #407 from lencx/dev
This commit is contained in:
215
.github/workflows/release.yml
vendored
215
.github/workflows/release.yml
vendored
@@ -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
6
.gitignore
vendored
@@ -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
4589
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -20,11 +20,11 @@
|
||||
- [📝 更新日志](./UPDATE_LOG.md)
|
||||
- [🕒 历史版本...](https://github.com/lencx/ChatGPT/releases)
|
||||
|
||||
<!-- download start -->
|
||||
<!-- tr-download-start -->
|
||||
|
||||
### Windows
|
||||
|
||||
- [ChatGPT_0.10.3_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/ChatGPT_0.10.3_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.3))**
|
||||
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.11.0))**
|
||||
|
||||
### Mac
|
||||
|
||||
- [ChatGPT_0.10.3_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/ChatGPT_0.10.3_x64.dmg)
|
||||
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/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.3_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/chat-gpt_0.10.3_amd64.deb)
|
||||
- [chat-gpt_0.10.3_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/chat-gpt_0.10.3_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 -->
|
||||
|
||||
## 📢 公告
|
||||
|
||||
|
||||
21
README.md
21
README.md
@@ -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.3_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/ChatGPT_0.10.3_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
|
||||
@@ -37,19 +37,20 @@
|
||||
# install the specified version
|
||||
winget install --id=lencx.ChatGPT -e --version 0.10.0
|
||||
```
|
||||
- Use [Chocolatey](https://community.chocolatey.org/packages/chatgpt/0.8.1#versionhistory):
|
||||
|
||||
|
||||
- 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.10.3))**
|
||||
**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.3_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/ChatGPT_0.10.3_x64.dmg): Direct download installer
|
||||
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/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
|
||||
@@ -65,13 +66,13 @@
|
||||
|
||||
### Linux
|
||||
|
||||
- [chat-gpt_0.10.3_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/chat-gpt_0.10.3_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
|
||||
- [chat-gpt_0.10.3_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.3/chat-gpt_0.10.3_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
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# 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.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
cask "chatgpt" do
|
||||
version "0.10.3"
|
||||
sha256 "f44838a80844999191a303684fd7ae1811dd2fae6709aebe8bff23c70f9b8a10"
|
||||
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"
|
||||
|
||||
@@ -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
4764
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
33
scripts/download.js
vendored
33
scripts/download.js
vendored
@@ -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);
|
||||
@@ -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"] }
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
2
src-tauri/src/scripts/export.js
vendored
2
src-tauri/src/scripts/export.js
vendored
@@ -137,7 +137,7 @@ function addActionsButtons(actionsArea, TryAgainButton) {
|
||||
}
|
||||
|
||||
async function exportMarkdown() {
|
||||
const content = Array.from(document.querySelectorAll("main >div>div>div>div")).map(i => {
|
||||
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>`;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
},
|
||||
"package": {
|
||||
"productName": "ChatGPT",
|
||||
"version": "0.10.3"
|
||||
"version": "0.11.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
|
||||
4
src/hooks/useTable.tsx
vendored
4
src/hooks/useTable.tsx
vendored
@@ -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>[]>([]);
|
||||
|
||||
3
src/view/settings/General.tsx
vendored
3
src/view/settings/General.tsx
vendored
@@ -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 />
|
||||
|
||||
22
src/view/settings/MainWindow.tsx
vendored
22
src/view/settings/MainWindow.tsx
vendored
@@ -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
|
||||
|
||||
8
src/view/settings/TrayWindow.tsx
vendored
8
src/view/settings/TrayWindow.tsx
vendored
@@ -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
|
||||
|
||||
@@ -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'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user