-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6caf463
Showing
64 changed files
with
7,856 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build/release | ||
|
||
on: | ||
push: | ||
branches: | ||
- v** | ||
|
||
jobs: | ||
release: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v1 | ||
|
||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: latest | ||
|
||
- name: Build/release Electron app | ||
uses: samuelmeuli/[email protected] | ||
with: | ||
# GitHub token, automatically provided to the action | ||
# (No need to define this secret in the repo settings) | ||
github_token: ${{ secrets.GH_TOKEN }} | ||
|
||
# If the commit is tagged with a version (e.g. "v1.0.0"), | ||
# release the app after building | ||
release: ${{ startsWith(github.ref, 'refs/heads/v') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
|
||
cmake-build-debug | ||
node_modules | ||
dist | ||
dist-ssr | ||
dist-electron | ||
release | ||
*.local | ||
build | ||
config.ts | ||
|
||
# Editor directories and files | ||
.vscode/.debug.env | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# lockfile | ||
pnpm-lock.yaml | ||
yarn.lock | ||
config.json | ||
conversations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
electron_mirror=https://npm.taobao.org/mirrors/electron/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"tabWidth": 4, | ||
"useTabs": true, | ||
"semi": true, | ||
"singleQuote": true, | ||
"jsxSingleQuote": true, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": false, | ||
"arrowParens": "always", | ||
"printWidth": 120, | ||
"embeddedLanguageFormatting": "auto", | ||
"htmlWhitespaceSensitivity": "ignore", | ||
"preserve": "preserve", | ||
"insertPragma": false, | ||
"quoteProps": "as-needed", | ||
"requirePragma": false, | ||
"endOfLine": "auto" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2013, Aldo Cortesi. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# desktop chatai plus | ||
|
||
[![GitHub](https://img.shields.io/badge/Github-Repo-blue?logo=github)](https://github.com/danger-dream/desktop-chatai-plus) | ||
|
||
desktop chatai plus 是一个高效、轻量级的桌面版AI工具,为用户提供了一个统一、便捷的界面,实现多个LLM平台的即时交互。 | ||
|
||
## 功能特性 | ||
|
||
- **常驻内存 & 失焦隐藏 & 快捷键唤起**:保持程序在后台运行,随时恢复,高效响应。 | ||
- **简洁界面**:基于Tailwind CSS设计的清晰、简洁的用户界面。 | ||
- **多LLM交互**:在同一对话框中与多个LLM平台进行交互。 | ||
- **命令式模板**:使用\"/\"前缀快速访问常用功能,如使用自定义的Prompt、切换模型、清空对话等.. | ||
- **对话直达平台**:与LLM平台直接交互,无需经过任何第三方服务器。 | ||
- **数据保障**:对话数据仅保存在本地,保障用户隐私。 | ||
- **即将到来的功能**:web检索、图文对话、文档问答、图片生成、语音交互等。 | ||
|
||
## 截图 | ||
![1.png](./images/1.png) | ||
![2.png](images/2.png) | ||
![3.png](images/3.png) | ||
![4.png](images/4.png) | ||
![5.png](images/5.png) | ||
![6.png](images/6.png) | ||
![so.png](images/so.png) | ||
![sw.png](images/sw.png) | ||
![sq.png](images/sq.png) | ||
![ss.png](images/ss.png) | ||
|
||
|
||
## 项目背景 | ||
在使用LLM的过程中,各家平台有不同的侧重点。 每次切换不同网页也比较麻烦,且经常遇到需要重新登录的情况。虽然社区有人开发过类似的项目,但大多是web项目。开发desktop chatai plus的主要目的是常驻内存,需要时立马打开并辅助解决问题。 | ||
|
||
|
||
## 源码运行 | ||
|
||
```bash | ||
# 1. 克隆项目到本地 | ||
git clone https://github.com/danger-dream/desktop-chatai-plus.git | ||
|
||
# 2. 安装依赖 | ||
cd desktop-chatai-plus | ||
|
||
npm install | ||
|
||
# 3. 运行 | ||
npm run dev | ||
``` | ||
|
||
## 啰嗦的.. | ||
- 没做过多的组件拆分,感觉没必要,就这么点东西 | ||
- 放弃了UI库,前端真不熟,用了看着又不满意 | ||
- 依赖做到极简了,markdown那堆插件和tabler-icon会想办法去掉 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
declare module 'markdown-it-abbr'; | ||
declare module 'markdown-it-deflist'; | ||
declare module 'markdown-it-emoji'; | ||
declare module 'markdown-it-footnote'; | ||
declare module 'markdown-it-ins'; | ||
declare module 'markdown-it-mark'; | ||
declare module 'markdown-it-sub'; | ||
declare module 'markdown-it-sup'; | ||
declare module 'markdown-it-task-lists'; | ||
declare module 'markdown-it-link-attributes'; | ||
|
||
|
||
declare module '*.vue' { | ||
import { DefineComponent } from 'vue' | ||
const component: DefineComponent<{}, {}, any> | ||
export default component | ||
} | ||
|
||
|
||
interface Window { | ||
copy_code(target: HTMLButtonElement): void; | ||
|
||
inputFocus(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"productName": "Desktop ChatAI Plus", | ||
"appId": "com.chataiplus.app", | ||
"asar": true, | ||
"compression": 'maximum', | ||
"icon": "public/favicon.ico", | ||
"directories": { | ||
"output": "release" | ||
}, | ||
"artifactName": "chatai-${version}-${platform}-${arch}.${ext}", | ||
"publish": [ | ||
{ | ||
provider: 'github', | ||
owner: 'danger-dream', | ||
repo: 'Desktop-ChatAI-Plus', | ||
}, | ||
], | ||
"files": [ | ||
"dist-electron", | ||
"dist" | ||
], | ||
"win": { | ||
icon: 'public/icons/icon.ico', | ||
"target": [ | ||
{ "target": "zip", "arch": ["x64", 'ia32'] }, | ||
{ target: 'nsis', arch: ['x64', 'ia32'] } | ||
], | ||
}, | ||
"nsis": { | ||
"shortcutName": 'chatai', | ||
"oneClick": false, | ||
"allowToChangeInstallationDirectory": true, | ||
}, | ||
"mac": { | ||
"icon": "public/icons/icon.icns", | ||
"category": "public.app-category.developer-tools", | ||
"target": { "target": "dmg", "arch": ["x64", "arm64"] }, | ||
}, | ||
"dmg": { | ||
"contents": [ | ||
{ "x": 410, "y": 150, "type": 'link', "path": '/Applications' }, | ||
{ "x": 130, "y": 150, "type": 'file' } | ||
] | ||
}, | ||
"linux": { | ||
"icon": 'public/icons/', | ||
"publish": ['github'], | ||
"target": 'deb', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
const { app, globalShortcut, Menu, Tray, BrowserWindow, ipcMain, screen } = require('electron') | ||
const { enable, initialize } = require('@electron/remote/main') | ||
const { join } = require('node:path') | ||
|
||
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true' | ||
app.setAppUserModelId(app.getName()) | ||
if (!app.requestSingleInstanceLock()) { | ||
app.quit() | ||
process.exit(0) | ||
} | ||
process.env.DIST_ELECTRON = __dirname | ||
process.env.DIST = join(process.env.DIST_ELECTRON, '../dist') | ||
process.env.PUBLIC = process.env.VITE_DEV_SERVER_URL ? join(process.env.DIST_ELECTRON, '../public') : process.env.DIST | ||
|
||
app.on('window-all-closed', () => app.exit(0)) | ||
app.whenReady().then(async () => { | ||
initialize() | ||
let CurrentPin = false | ||
let win = new BrowserWindow({ | ||
show: false, width: 500, height: 600, minWidth: 500, minHeight: 600, | ||
alwaysOnTop: true, minimizable: false, maximizable: false, movable: true, resizable: true, | ||
fullscreen: false, transparent: false, skipTaskbar: true, frame: false, hasShadow: true, | ||
webPreferences: { | ||
nodeIntegration: true, contextIsolation: false, webSecurity: false, spellcheck: false | ||
} | ||
}) | ||
function showMainWindow() { | ||
if (win.isVisible()) { | ||
win.hide() | ||
} else { | ||
win.setAlwaysOnTop(true) | ||
win.show() | ||
win.focus() | ||
win.webContents.executeJavaScript('try{window.inputFocus()} catch{}').catch(() => {}) | ||
const bounds = screen.getPrimaryDisplay().bounds | ||
const w_bounds = win.getBounds() | ||
const x = bounds.width - w_bounds.width - 5 | ||
const y = bounds.height - w_bounds.height - 60 | ||
win.setPosition(x, y, false) | ||
} | ||
} | ||
ipcMain.on('onPin', (e, isPin) => { | ||
CurrentPin = isPin | ||
win.setAlwaysOnTop(isPin) | ||
}) | ||
enable(win.webContents) | ||
win.on('blur', () => { | ||
if (CurrentPin) return | ||
win.hide() | ||
}) | ||
win.on('show', () => setTimeout(() => win.setOpacity(1), 50)) | ||
win.on('hide', () => win.setOpacity(0)) | ||
win.on('close', (e) => { | ||
e.preventDefault() | ||
e.returnValue = false | ||
win.hide() | ||
}) | ||
|
||
win.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }) | ||
if (app.isPackaged) { | ||
win.loadFile(join(join(__dirname, '../dist'), 'index.html')).catch() | ||
} else { | ||
win.loadURL((process.env.VITE_DEV_SERVER_URL || '') + 'index.html').catch() | ||
win.webContents.openDevTools({ mode: 'detach' }) | ||
} | ||
globalShortcut.register('CommandOrControl+Alt+Shift+Z', showMainWindow) | ||
|
||
function restart() { | ||
app.relaunch() | ||
app.exit(0) | ||
} | ||
|
||
const tray = new Tray(join(process.env.PUBLIC, 'favicon.ico')) | ||
tray.setContextMenu(Menu.buildFromTemplate([ | ||
{ label: '显示窗口', click: () => showMainWindow() }, | ||
{ type: 'separator' }, | ||
{ label: '重载', click: () => win.reload() }, | ||
{ type: 'separator' }, | ||
{ label: '重启', click: () => restart() }, | ||
{ label: '退出', click: () => app.exit(0) } | ||
])) | ||
tray.setToolTip(`Desktop ChatAI Plus`) | ||
tray.on('double-click', () => showMainWindow()) | ||
|
||
app.on('second-instance', () => showMainWindow()) | ||
app.on('activate', () => showMainWindow()) | ||
/** 取消注册热键 */ | ||
app.on('will-quit', () => { | ||
try { | ||
globalShortcut.unregisterAll() | ||
} catch { | ||
} | ||
}) | ||
}) | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"/> | ||
<link rel="icon" type="image/svg+xml" href="/icon.png"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
<title>Desktop ChatAI Plus</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.