update: 更新支持微信、千牛等客户端

This commit is contained in:
lrhh123
2024-04-18 19:45:42 +08:00
parent 81ab189d4b
commit c9d02119e1
24 changed files with 742 additions and 133 deletions
+4
View File
@@ -0,0 +1,4 @@
PY_HOSTNAME=localhost
PY_PORT=9999
VAR=1234
BKEXE_PATH=./backend/__main__.exe
+1 -4
View File
@@ -28,7 +28,4 @@ npm-debug.log.*
*.sass.d.ts
*.scss.d.ts
assets/backend/*
src/renderer/services/analytics/index.ts
.env
.vscode
src/renderer/services/analytics/*
+3
View File
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "EditorConfig.EditorConfig"]
}
+30
View File
@@ -0,0 +1,30 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Electron: Main",
"type": "node",
"request": "launch",
"protocol": "inspector",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "start"],
"env": {
"MAIN_ARGS": "--inspect=5858 --remote-debugging-port=9223"
}
},
{
"name": "Electron: Renderer",
"type": "chrome",
"request": "attach",
"port": 9223,
"webRoot": "${workspaceFolder}",
"timeout": 15000
}
],
"compounds": [
{
"name": "Electron: All",
"configurations": ["Electron: Main", "Electron: Renderer"]
}
]
}
+30
View File
@@ -0,0 +1,30 @@
{
"files.associations": {
".eslintrc": "jsonc",
".prettierrc": "jsonc",
".eslintignore": "ignore"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"html",
"typescriptreact"
],
"javascript.validate.enable": false,
"javascript.format.enable": false,
"typescript.format.enable": false,
"search.exclude": {
".git": true,
".eslintcache": true,
".erb/dll": true,
"release/{build,app/dist}": true,
"node_modules": true,
"npm-debug.log.*": true,
"test/**/__snapshots__": true,
"package-lock.json": true,
"*.{css,sass,scss}.d.ts": true
}
}
+530 -9
View File
@@ -1,12 +1,533 @@
# 1.0.1
* 修复旧版本 chrome 无法下载驱动的 BUG
* 修复应用开启多个进程的 BUG
# 2.1.0
- Migrate to `css-minifier-webpack-plugin`
# 2.0.1
## Fixes
- Fix broken css linking in production build
# 2.0.0
## Breaking Changes
- drop redux
- remove counter example app
- simplify directory structure
- move `dll` dir to `.erb` dir
- fix icon/font import paths
- migrate to `react-refresh` from `react-hot-loader`
- migrate to webpack@5
- migrate to electron@11
- remove e2e tests and testcafe integration
- rename `app` dir to more conventional `src` dir
- rename `resources` dir to `assets`
- simplify npm scripts
- drop stylelint
- simplify styling of boilerplate app
- remove `START_HOT` env variable
- notarize support
- landing page boilerplate
- docs updates
- restore removed debugging support
# 1.4.0
- Migrate to `eslint-config-erb@2`
- Rename `dev` npm script to `start`
- GitHub Actions: only publish GitHub releases when on master branch
# 1.3.1
- Fix sass building bug ([#2540](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2540))
- Fix CI bug related to E2E tests and network timeouts
- Move automated dependency PRs to `next` ([#2554](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2554))
- Bump dependencies to patch semver
# 1.3.0
- Fixes E2E tests ([#2516](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2516))
- Fixes preload entrypoint ([#2503](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2503))
- Downgrade to `electron@8`
- Bump dependencies to latest semver
# 1.2.0
- Migrate to redux toolkit
- Lazy load routes with react suspense
- Drop support for azure-pipelines and use only github actions
- Bump all deps to latest semver
- Remove `test-e2e` script from tests (blocked on release of https://github.com/DevExpress/testcafe-browser-provider-electron/pull/65)
- Swap `typed-css-modules-webpack-plugin` for `typings-for-css-modules-loader`
- Use latest version of `eslint-config-erb`
- Remove unnecessary file extensions from ts exclude
- Add experimental support for vscode debugging
- Revert https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2365 as default for users, provide as opt in option
# 1.1.0
- Fix #2402
- Simplify configs (https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2406)
# 1.0.0
- [x] 多平台支持:当前支持哔哩哔哩、抖音企业号、抖音、抖店、微博聊天、小红书专业号运营、小红书、知乎等平台,未来将不断扩展支持更多社交媒体平台。
- [x] 预设回复内容:允许用户设置自定义回复,以应对常见问题,提高回复效率。
- [x] 接入ChatGPT接口,根据客户的咨询内容智能生成回复,适用于处理复杂或者个性化的客户咨询。
- [x] 发送图片和二进制文件:支持发送图片等二进制文件,满足多样化的客户服务需求。
- [x] 知识库: 通过上传知识库文件自定义专属机器人,可作为数字分身、智能客服、私域助手使用,基于 [懒人百宝箱](https://chat.lazaytools.top/) 实现
- [x] 各个平台独立的插件系统,支持插件访问操作系统和互联网等外部资源,支持基于自有知识库定制企业 AI 应用。
- Migrate to TypeScript from Flow ([#2363](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2363))
- Use browserslist for `@babel/preset-env` targets ([#2368](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2368))
- Use preload script, disable `nodeIntegration` in renderer process for [improved security](https://www.electronjs.org/docs/tutorial/security#2-do-not-enable-nodejs-integration-for-remote-content) ([#2365](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2365))
- Add support for azure pipelines ([#2369](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2369))
- Disable sourcemaps in production
# 0.18.1 (2019.12.12)
- Fix HMR env bug ([#2343](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2343))
- Bump all deps to latest semver
- Bump to `electron@7`
# 0.18.0 (2019.11.19)
- Bump electron to `electron@6` (`electron@7` introduces breaking changes to testcafe end to end tests)
- Revert back to [two `package.json` structure](https://www.electron.build/tutorials/two-package-structure)
- Bump all deps to latest semver
# 0.17.1 (2018.11.20)
- Fix `yarn test-e2e` and testcafe for single package.json structure
- Fixes incorrect path in `yarn start` script
- Bumped deps
- Bump g++ in travis
- Change clone arguments to clone only master
- Change babel config to target current electron version
For full change list, see https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2021
# 0.17.0 (2018.10.30)
- upgraded to `babel@7` (thanks to @vikr01 🎉🎉🎉)
- migrated from [two `package.json` structure](https://www.electron.build/tutorials/two-package-structure) (thanks to @HyperSprite!)
- initial auto update support (experimental)
- migrate from greenkeeper to [renovate](https://renovatebot.com)
- added issue template
- use `babel-preset-env` to target current electron version
- add [opencollective](https://opencollective.com/electron-react-boilerplate-594) banner message display in postinstall script (help support ERB 🙏)
- fix failing ci issues
# 0.16.0 (2018.10.3)
- removed unused dependencies
- migrate from `react-redux-router` to `connect-react-router`
- move webpack configs to `./webpack` dir
- use `g++` on travis when testing linux
- migrate from `spectron` to `testcafe` for e2e tests
- add linting support for config styles
- changed stylelint config
- temporarily disabled flow in appveyor to make ci pass
- added necessary infra to publish releases from ci
# 0.15.0 (2018.8.25)
- Performance: cache webpack uglify results
- Feature: add start minimized feature
- Feature: lint and fix styles with prettier and stylelint
- Feature: add greenkeeper support
# 0.14.0 (2018.5.24)
- Improved CI timings
- Migrated README commands to yarn from npm
- Improved vscode config
- Updated all dependencies to latest semver
- Fix `electron-rebuild` script bug
- Migrated to `mini-css-extract-plugin` from `extract-text-plugin`
- Added `optimize-css-assets-webpack-plugin`
- Run `prettier` on json, css, scss, and more filetypes
# 0.13.3 (2018.5.24)
- Add git precommit hook, when git commit will use `prettier` to format git add code
- Add format code function in `lint-fix` npm script which can use `prettier` to format project js code
# 0.13.2 (2018.1.31)
- Hot Module Reload (HMR) fixes
- Bumped all dependencies to latest semver
- Prevent error propagation of `CheckNativeDeps` script
# 0.13.1 (2018.1.13)
- Hot Module Reload (HMR) fixes
- Bumped all dependencies to latest semver
- Fixed electron-rebuild script
- Fixed tests scripts to run on all platforms
- Skip redux logs in console in test ENV
# 0.13.0 (2018.1.6)
#### Additions
- Add native dependencies check on postinstall
- Updated all dependencies to latest semver
# 0.12.0 (2017.7.8)
#### Misc
- Removed `babel-polyfill`
- Renamed and alphabetized npm scripts
#### Breaking
- Changed node dev `__dirname` and `__filename` to node built in fn's (https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/1035)
- Renamed `src/bundle.js` to `src/renderer.prod.js` for consistency
- Renamed `dll/vendor.js` to `dll/renderer.dev.dll.js` for consistency
#### Additions
- Enable node_modules cache on CI
# 0.11.2 (2017.5.1)
Yay! Another patch release. This release mostly includes refactorings and router bug fixes. Huge thanks to @anthonyraymond!
⚠️ Windows electron builds are failing because of [this issue](https://github.com/electron/electron/issues/9321). This is not an issue with the boilerplate ⚠️
#### Breaking
- **Renamed `./src/main.development.js` => `./src/main.{dev,prod}.js`:** [#963](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/963)
#### Fixes
- **Fixed reloading when not on `/` path:** [#958](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/958) [#949](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/949)
#### Additions
- **Added support for stylefmt:** [#960](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/960)
# 0.11.1 (2017.4.23)
You can now debug the production build with devtools like so:
```
DEBUG_PROD=true npm run package
```
🎉🎉🎉
#### Additions
- **Added support for debugging production build:** [#fab245a](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/941/commits/fab245a077d02a09630f74270806c0c534a4ff95)
#### Bug Fixes
- **Fixed bug related to importing native dependencies:** [#933](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/933)
#### Improvements
- **Updated all deps to latest semver**
# 0.11.0 (2017.4.19)
Here's the most notable changes since `v0.10.0`. Its been about a year since a release has been pushed. Expect a new release to be published every 3-4 weeks.
#### Breaking Changes
- **Dropped support for node < 6**
- **Refactored webpack config files**
- **Migrate to two-package.json project structure**
- **Updated all devDeps to latest semver**
- **Migrated to Jest:** [#768](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/768)
- **Migrated to `react-router@4`**
- **Migrated to `electron-builder@4`**
- **Migrated to `webpack@2`**
- **Migrated to `react-hot-loader@3`**
- **Changed default live reload server PORT to `1212` from `3000`**
#### Additions
- **Added support for Yarn:** [#451](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/451)
- **Added support for Flow:** [#425](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/425)
- **Added support for stylelint:** [#911](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/911)
- **Added support for electron-builder:** [#876](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/876)
- **Added optional support for SASS:** [#880](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/880)
- **Added support for eslint-plugin-flowtype:** [#911](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/911)
- **Added support for appveyor:** [#280](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/280)
- **Added support for webpack dlls:** [#860](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/860)
- **Route based code splitting:** [#884](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/884)
- **Added support for Webpack Bundle Analyzer:** [#922](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/922)
#### Improvements
- **Parallelize renderer and main build processes when running `npm run build`**
- **Dynamically generate electron app menu**
- **Improved vscode integration:** [#856](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/856)
#### Bug Fixes
- **Fixed hot module replacement race condition bug:** [#917](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/917) [#920](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/920)
# 0.10.0 (2016.4.18)
#### Improvements
- **Use Babel in main process with Webpack build:** [#201](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/201)
- **Change targets to built-in support by webpack:** [#197](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/197)
- **use es2015 syntax for webpack configs:** [#195](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/195)
- **Open application when webcontent is loaded:** [#192](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/192)
- **Upgraded dependencies**
#### Bug fixed
- **Fix `npm list electron-prebuilt` in package.js:** [#188](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/188)
# 0.9.0 (2016.3.23)
#### Improvements
- **Added [redux-logger](https://github.com/fcomb/redux-logger)**
- **Upgraded [react-router-redux](https://github.com/reactjs/react-router-redux) to v4**
- **Upgraded dependencies**
- **Added `npm run dev` command:** [#162](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/162)
- **electron to v0.37.2**
#### Breaking Changes
- **css module as default:** [#154](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/154).
- **set default NODE_ENV to production:** [#140](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/140)
# 0.8.0 (2016.2.17)
#### Bug fixed
- **Fix lint errors**
- **Fix Webpack publicPath for production builds**: [#119](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/119).
- **package script now chooses correct OS icon extension**
#### Improvements
- **babel 6**
- **Upgrade Dependencies**
- **Enable CSS source maps**
- **Add json-loader**: [#128](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/128).
- **react-router 2.0 and react-router-redux 3.0**
# 0.7.1 (2015.12.27)
#### Bug fixed
- **Fixed npm script on windows 10:** [#103](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/103).
- **history and react-router version bump**: [#109](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/109), [#110](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/110).
#### Improvements
- **electron 0.36**
# 0.7.0 (2015.12.16)
#### Bug fixed
- **Fixed process.env.NODE_ENV variable in webpack:** [#74](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/74).
- **add missing object-assign**: [#76](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/76).
- **packaging in npm@3:** [#77](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/77).
- **compatibility in windows:** [#100](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/100).
- **disable chrome debugger in production env:** [#102](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/102).
#### Improvements
- **redux**
- **css-modules**
- **upgrade to react-router 1.x**
- **unit tests**
- **e2e tests**
- **travis-ci**
- **upgrade to electron 0.35.x**
- **use es2015**
- **check dev engine for node and npm**
# 0.6.5 (2015.11.7)
#### Improvements
- **Bump style-loader to 0.13**
- **Bump css-loader to 0.22**
# 0.6.4 (2015.10.27)
#### Improvements
- **Bump electron-debug to 0.3**
# 0.6.3 (2015.10.26)
#### Improvements
- **Initialize ExtractTextPlugin once:** [#64](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/64).
# 0.6.2 (2015.10.18)
#### Bug fixed
- **Babel plugins production env not be set properly:** [#57](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/57).
# 0.6.1 (2015.10.17)
#### Improvements
- **Bump electron to v0.34.0**
# 0.6.0 (2015.10.16)
#### Breaking Changes
- **From react-hot-loader to react-transform**
# 0.5.2 (2015.10.15)
#### Improvements
- **Run tests with babel-register:** [#29](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/29).
# 0.5.1 (2015.10.12)
#### Bug fixed
- **Fix #51:** use `path.join(__dirname` instead of `./`.
# 0.5.0 (2015.10.11)
#### Improvements
- **Simplify webpack config** see [#50](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/50).
#### Breaking Changes
- **webpack configs**
- **port changed:** changed default port from 2992 to 3000.
- **npm scripts:** remove `start-dev` and `dev-server`. rename `hot-dev-server` to `hot-server`.
# 0.4.3 (2015.9.22)
#### Bug fixed
- **Fix #45 zeromq crash:** bump version of `electron-prebuilt`.
# 0.4.2 (2015.9.15)
#### Bug fixed
- **run start-hot breaks chrome refresh(CTRL+R) (#42)**: bump `electron-debug` to `0.2.1`
# 0.4.1 (2015.9.11)
#### Improvements
- **use electron-prebuilt version for packaging (#33)**
# 0.4.0 (2015.9.5)
#### Improvements
- **update dependencies**
# 0.3.0 (2015.8.31)
#### Improvements
- **eslint-config-airbnb**
# 0.2.10 (2015.8.27)
#### Features
- **custom placeholder icon**
#### Improvements
- **electron-renderer as target:** via [webpack-target-electron-renderer](https://github.com/chentsulin/webpack-target-electron-renderer)
# 0.2.9 (2015.8.18)
#### Bug fixed
- **Fix hot-reload**
# 0.2.8 (2015.8.13)
#### Improvements
- **bump electron-debug**
- **babelrc**
- **organize webpack scripts**
# 0.2.7 (2015.7.9)
#### Bug fixed
- **defaultProps:** fix typos.
# 0.2.6 (2015.7.3)
#### Features
- **menu**
#### Bug fixed
- **package.js:** include webpack build.
# 0.2.5 (2015.7.1)
#### Features
- **NPM Script:** support multi-platform
- **package:** `--all` option
# 0.2.4 (2015.6.9)
#### Bug fixed
- **Eslint:** typo, [#17](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/17) and improve `.eslintrc`
# 0.2.3 (2015.6.3)
#### Features
- **Package Version:** use latest release electron version as default
- **Ignore Large peerDependencies**
#### Bug fixed
- **Npm Script:** typo, [#6](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/6)
- **Missing css:** [#7](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/7)
# 0.2.2 (2015.6.2)
#### Features
- **electron-debug**
#### Bug fixed
- **Webpack:** add `.json` and `.node` to extensions for imitating node require.
- **Webpack:** set `node_modules` to externals for native module support.
# 0.2.1 (2015.5.30)
#### Bug fixed
- **Webpack:** #1, change build target to `atom`.
# 0.2.0 (2015.5.30)
#### Features
- **Ignore:** `test`, `tools`, `release` folder and devDependencies in `package.json`.
- **Support asar**
- **Support icon**
# 0.1.0 (2015.5.27)
#### Features
- **Webpack:** babel, react-hot, ...
- **Flux:** actions, api, components, containers, stores..
- **Package:** darwin (osx), linux and win32 (windows) platform.
+63 -98
View File
@@ -1,106 +1,71 @@
## 懒人客服简介
本项目是基于大模型的智能对话客服工具,支持哔哩哔哩、抖音企业号、抖音、抖店、微博聊天、小红书专业号运营、小红书、知乎等平台接入,可选择 GPT3.5/GPT4.0/ [懒人百宝箱](https://chat.lazaytools.top/) (后续会支持更多平台),能处理文本、语音和图片,通过插件访问操作系统和互联网等外部资源,支持基于自有知识库定制企业 AI 应用。
注:本项目只是一个用于对接外部平台的客服工具,不提供任何平台的账号,需要自行准备。并且知识库功能也需要自行准备,该项目目前只支持的 OpenAI 的 API 接口(或代理)接入
## 主要功能
- [x] 多平台支持:当前支持哔哩哔哩、抖音企业号、抖音、抖店、微博聊天、小红书专业号运营、小红书、知乎等平台,未来将不断扩展支持更多社交媒体平台。
- [x] 预设回复内容:允许用户设置自定义回复,以应对常见问题,提高回复效率。
- [x] 接入ChatGPT接口,根据客户的咨询内容智能生成回复,适用于处理复杂或者个性化的客户咨询。
- [x] 发送图片和二进制文件:支持发送图片等二进制文件,满足多样化的客户服务需求。
- [x] 知识库: 通过上传知识库文件自定义专属机器人,可作为数字分身、智能客服、私域助手使用,基于 [懒人百宝箱](https://chat.lazaytools.top/) 实现
- [x] 各个平台独立的插件系统,支持插件访问操作系统和互联网等外部资源,支持基于自有知识库定制企业 AI 应用。
## 演示视频
[观看视频](https://www.bilibili.com/video/BV1qz421Q73S)
## 目录结构设计
```
my-app/
├── node_modules/
├── public/
├── src/
│ ├── components/
│ │ ├── layout/
│ │ │ ├── Navbar.js
│ │ │ ├── Sidebar.js
│ │ │ └── Footer.js
│ │ ├── ui/
│ │ └── common/
│ ├── pages/
│ │ ├── HomePage.js
│ │ ├── SettingsPage.js
│ │ └── AboutPage.js
│ ├── utils/ (或者 helpers/)
│ ├── hooks/
│ ├── assets/
│ │ ├── images/
│ │ └── styles/
│ ├── constants/
│ ├── context/
│ ├── services/ (或者 api/)
│ └── App.js
├── .gitignore
├── package.json
└── README.md
```
## 开源社区
如果有问题需要反馈,或者对项目有什么特性希望支持的,可以添加小助手微信加入开源项目交流群:
![微信扫码添加客服](docs/contact.png)
<!--
## 商业支持
我们还提供企业级的 AI应用平台,包含知识库、Agent插件、应用管理等能力,支持多平台聚合的应用接入、客户端管理、对话管理,以及提供 SaaS服务、私有化部署、稳定托管接入 等多种模式
目前已在私域运营、智能客服、企业效率助手等场景积累了丰富的 AI 解决方案, 在电商、文教、健康、新消费等各行业沉淀了 AI 落地的最佳实践,致力于打造助力中小企业拥抱 AI 的一站式平台。 企业服务和商用咨询可联系产品顾问:
![微信扫码添加客服](docs/contact.png) -->
- `components/`: 存放可复用的组件,如按钮、输入框等。
- `layout/`: 用于布局相关的组件,如导航栏、侧边栏、页脚等。
- `ui/`: UI 组件,可能包括主题特定的组件。
- `common/`: 其他通用组件。
- `pages/`: 存放应用的页面组件,通常这些组件会对应不同的路由。
- `utils/``helpers/`: 存放工具函数或者帮助函数。
- `hooks/`: 存放自定义钩子。
- `assets/`: 存放静态资源,如图片、CSS 文件等
- `constants/`: 存放常量定义。
- `context/`: 存放 React 的 Context 文件,用于状态管理。
- `services/``api/`: 存放与后端交互的服务或 API 调用。
## 下载地址
## webpack 配置说明
在 Electron-React-Boilerplate 项目中,Webpack配置被细分以适应不同的用途和环境。这些配置包括基础配置、针对ESLint的配置、主进程和渲染进程的开发与生产配置,以及预加载(preload)脚本和动态链接库(DLL)的特定配置。为了使`.env`文件中的环境变量在你的应用中可用,主要关注点应是主进程和渲染进程的配置文件。下面是每个文件的简要说明,以及你可能需要修改的文件:
<a href="https://wwp.lanzouo.com/iwxdP1r4g41e" style="display: inline-block; background-color: #008CBA; color: white; padding: 10px 20px; text-align: center; text-decoration: none; font-weight: bold; border-radius: 5px; margin: 4px 2px; cursor: pointer;">点击下载</a>
- **webpack.config.base.ts**: 基础配置,被其他所有配置文件共享。如果你想要全局应用一些配置(如解析规则、插件等),这是一个好地方。
- **webpack.config.eslint.ts**: 专门为ESLint设置的Webpack配置。通常,不需要在这里添加`.env`文件支持。
- **webpack.config.main.prod.ts**: 主进程的生产环境配置。如果你需要在生产环境的主进程中使用环境变量,应修改此文件。
- **webpack.config.preload.dev.ts**: 开发环境的预加载脚本配置。这个配置用于预加载脚本,除非你特别需要在预加载脚本中使用环境变量,否则无需修改。
- **webpack.config.renderer.dev.dll.ts**: 用于渲染进程开发环境的DLL配置。这主要用于性能优化,不是加载`.env`的目标。
- **webpack.config.renderer.dev.ts**: 渲染进程的开发环境配置。如果你需要在开发环境的渲染进程中使用环境变量,应修改此文件。
- **webpack.config.renderer.prod.ts**: 渲染进程的生产环境配置。如果你需要在生产环境的渲染进程中使用环境变量,应修改此文件。
- **webpack.paths.ts**: 定义Webpack使用的各种路径。通常,不需要为了`.env`支持而修改此文件。
### 如何确定修改哪个?
直接看 package.json 中的 scripts,找到对应的配置文件,然后修改即可。
## 使用说明
第一次启动时可能会有点慢,因为它需要先下载驱动文件和初始化回复数据库,所以请耐心等待。
### 1、设置 GPT 地址
启动程序后,点击设置按钮,设置好你的 OpenAPI Key 和 代理服务器地址,然后点击保存。
![alt text](docs/first_settings_1.png)
![alt text](docs/first_settings_2.png)
### 2、首页操作说明
首先可以看到首页这里的 “连接” 项,有两个勾选框,默认是暂停软件的,如果你想让软件开始工作,就把这个勾选框去掉。
![alt text](docs/home_settings_1.png)
当第一次打开时,默认是没有任何的登录态的,所以会需要你手动暂停一下,然后登录后再,再取消勾选暂停,让它开始工作。
![alt text](docs/home_settings_2.png)
自动回复开启后它就会读取你下面勾选的平台,自动打开该页面开始工作。注意上面部分的勾选框无法点击,是因为作者没有相关平台的账号,所以无法登录调试该平台的信息,如果你有相关平台的账号并且想要支持该平台的自动回复,可以联系上面的客服。
### 3、关键词的编写
当上面的 “开启关键词匹配” 勾选后,会优先匹配这里设置的关键词,如果匹配到了关键词,就会回复关键词的回复内容,当没有匹配上关键词的问题,则会调用你提供的 ChatGPT API 去询问 GPT 回答用户问题。
![alt text](docs/reply_settings_1.png)
点击 “新增关键词” 按钮可以自定义关键词和回复内容。
![alt text](docs/reply_settings_2.png)
可以添加若干个用于匹配的关键词
关键词的编写规则是,如果只写 `你好`,那么只要用户输入的内容为 `你好` 时则会回复你设置的回复内容。如果想要模糊匹配可以使用 `*` 符号,例如 `你好*`,那么只要用户输入的内容以 `你好` 开头就会回复你设置的回复内容。
同理,如果你设置的关键词为 `*你好*`,那么只要用户输入的内容中包含 `你好` 就会回复你设置的回复内容。
比较特殊的,如果使用下面的 “开始关键词” 和 “结束关键词” 时,那么只要用户输入的内容以 “开始关键词” 开头,并且以 “结束关键词” 结尾,就能匹配上你设置的关键词。
### 4、回复的编写
一条关键词规则可以对应多条回复内容,当匹配到关键词时,会随机选择一条作为回复内容。
这里的 “插入随肌符” 是因为在拼多多平台等平台,是不允许每次重复一个回答的,所以可以插入一个随机符,以规避这个问题。
这里的 “插入文件” 则主要是用于插入图片,可以插入图片的链接,这样就可以回复图片了。
### 5、平台独立的 ChatGPT API 设置
有时候,我们可能需要针对不同的平台设置不同的 ChatGPT API 地址,这时候就可以在这里设置。你可以基于 [懒人百宝箱](https://chat.lazaytools.top/) 实现自己的知识库,然后设置到这里。
![alt text](docs/other_settings_1.png)
当设置了平台单独的 ChatGPT API 地址后,就会优先使用这个地址去调用 ChatGPT API,如果没有设置,则会使用上面设置的全局 ChatGPT API 地址。
### 6、客服相关设置
![alt text](docs/other_settings_2.png)
**提取信息**:勾选提取手机号或者提取咨询商品名后,它会去提取用户消息中的手机号或者商品名,然后将它存储到下面的路径中。
**等待回复时间**:当用户发送消息后,会等待这么长时间后再回复用户,如果希望马上回复,可以将这个值设置成零。
**上下文消息数**:当前使用 ChatGPT API 时,会将指定数量的聊天上下文,拿去调用 ChatGPT API,以便 ChatGPT API 更好的理解用户的问题。注意,这个值设置的越大,调用 ChatGPT API 的速度就会越慢。
**等待人工间隔**:当遇到 ChatGPT 阻塞的时候,会等待这么长时间然后终止客服自动任务,转交给人工客服手动处理。
## 项目计划
- [ ] 支持拼多多、淘宝、京东等电商平台(如果急需可以私聊小助手)
- [ ] 支持本地模型的加载
```json
"scripts": {
// ...
"start": "ts-node ./.erb/scripts/check-port-in-use.js && pnpm run start:renderer",
"start:main": "cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only .",
"start:preload": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
"test": "jest"
},
```
+4 -1
View File
@@ -27,4 +27,7 @@ directories:
buildResources: assets
output: release/build
extraResources:
- "./assets/**"
- "./assets/**"
# build:
# afterPack: "./removeLocales.js"
afterPack: "./removeLocales.js"
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "chatgpt-on-cs",
"description": "多平台智能客服,允许使用 ChatGPT 作为客服机器人",
"version": "0.9.0",
"version": "1.0.2",
"keywords": [
"electron",
"boilerplate",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "chatgpt-on-cs",
"version": "1.0.1",
"version": "1.0.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "chatgpt-on-cs",
"version": "1.0.1",
"version": "1.0.2",
"hasInstallScript": true,
"license": "AGPL-3.0"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "chatgpt-on-cs",
"version": "1.0.1",
"version": "1.0.2",
"description": "多平台智能客服,允许使用 ChatGPT 作为客服机器人",
"license": "AGPL-3.0",
"author": {
+18
View File
@@ -0,0 +1,18 @@
const fs = require('fs');
const path = require('path');
module.exports = async function (params) {
// Assuming 'locales' directory is directly inside the app output directory
const localesDir = path.join(params.appOutDir, 'locales');
try {
const files = await fs.promises.readdir(localesDir);
for (const file of files) {
if (!file.endsWith('zh-CN.pak')) {
await fs.promises.unlink(path.join(localesDir, file));
}
}
} catch (err) {
console.error('Error removing locales:', err);
}
};
+2
View File
@@ -18,6 +18,8 @@ import BackendServiceManager from './system/backend';
let mainWindow: BrowserWindow | null = null;
let backendServiceManager: BackendServiceManager | null = null;
app.commandLine.appendSwitch('lang', 'zh-CN');
const gotTheLock = app.requestSingleInstanceLock();
if (process.env.NODE_ENV === 'production') {
+4 -3
View File
@@ -27,13 +27,14 @@ interface WebSocketContextType {
const WebSocketContext = createContext<WebSocketContextType | null>(null);
export const WebSocketProvider = ({ children }: { children: ReactNode }) => {
const [isConnected, setIsConnected] = useState(false);
const { lastMessage, sendMessage } = useWebSocket(
`ws://127.0.0.1:${window.electron.getPort()}/api/v1/event/ws`,
{
shouldReconnect: () => {
return true; // 总是尝试重连
},
shouldReconnect: () => !isConnected, // 仅当未连接时尝试重连
reconnectInterval: 3000,
onOpen: () => setIsConnected(true), // 连接成功时设置为已连接
onClose: () => setIsConnected(false), // 连接关闭时设置为未连接
},
);
const [eventHandlers, setEventHandlers] = useState<
+3
View File
@@ -12,6 +12,9 @@ const AboutPage: React.FC = () => {
## 使用说明
项目文档: [懒人百宝箱使用说明](https://gitee.com/alsritter/ChatGPT-On-CS)
## 演示视频
[哔哩哔哩](https://www.bilibili.com/video/BV1qz421Q73S)
## 项目地址
* [GitHub](https://github.com/lrhh123/ChatGPT-On-CS)
+12 -3
View File
@@ -26,7 +26,10 @@ const DriverSettings = () => {
(async () => {
try {
await updateRunner(isPaused, isKeywordMatch);
await updateRunner({
is_paused: isPaused,
is_keyword_match: isKeywordMatch,
});
} catch (error: any) {
console.error(error);
}
@@ -61,9 +64,15 @@ const DriverSettings = () => {
});
}
updateRunner(checked, driverSettings.isKeywordMatch);
updateRunner({
is_paused: checked,
is_keyword_match: driverSettings.isKeywordMatch,
});
} else if (field === 'isKeywordMatch') {
updateRunner(driverSettings.isPaused, checked);
updateRunner({
is_paused: driverSettings.isPaused,
is_keyword_match: checked,
});
}
};
+16 -1
View File
@@ -5,6 +5,7 @@ import {
Tab,
TabPanels,
TabPanel,
Tooltip,
Checkbox,
Stack,
Image,
@@ -25,7 +26,8 @@ import {
} from '../../services/platform/constant';
import { useSystemStore } from '../../stores/useSystemStore';
import defaultPlatformIcon from '../../../../assets/base/default-platform-icon.png';
import analytics from '../../services/analytics/index_template';
import windowsIcon from '../../../../assets/base/windows.png';
import analytics from '../../services/analytics';
const PlatformTabs = () => {
const { data, isLoading } = useQuery(['platformList'], getPlatformList);
@@ -95,6 +97,19 @@ const PlatformTabs = () => {
<Checkbox value={platform.id} isDisabled={!platform.impl}>
{platform.name}
</Checkbox>
{
// 如果 id 前缀有 win_ 则显示一个小图标标识
platform.id.startsWith('win_') && (
<Tooltip label="客户端应用,需要先手动打开该应用">
<Image
src={windowsIcon}
boxSize="10px"
marginLeft="4px"
alt="windows"
/>
</Tooltip>
)
}
</Box>
))}
</Grid>
+1 -1
View File
@@ -4,7 +4,7 @@ import PageContainer from '../../components/PageContainer';
import PlatformTabs from './PlatformTabs';
import DriverSettings from './DriverSettings';
import ReplyKeyword from './ReplyKeyword';
import analytics from '../../services/analytics/index_template';
import analytics from '../../services/analytics';
const HomePage = () => {
useEffect(() => {
+1 -1
View File
@@ -16,7 +16,7 @@ import {
getMessageList,
} from '../../services/platform/controller';
import SessionBox from './SessionBox';
import analytics from '../../services/analytics/index_template';
import analytics from '../../services/analytics';
import { Message } from '../../services/platform/platform';
// 假设数据通过 props.sessions 传递
+1 -1
View File
@@ -33,7 +33,7 @@ import {
Platform,
PlatformSettings as PS,
} from '../../services/platform/platform';
import analytics from '../../services/analytics/index_template';
import analytics from '../../services/analytics';
const PlatformSettings = () => {
useEffect(() => {
+7 -1
View File
@@ -10,6 +10,7 @@ import {
Switch,
Input,
Select,
Highlight,
Box,
Slider,
SliderFilledTrack,
@@ -64,7 +65,12 @@ const GptSettings = () => {
<>
<FormControl>
<FormLabel htmlFor="gptAddress" mt="8px">
GPT
<Highlight
query="/v1"
styles={{ px: '1', py: '1', bg: 'orange.100' }}
>
GPT /v1
</Highlight>
</FormLabel>
<Input
id="gptAddress"
+1 -1
View File
@@ -5,7 +5,7 @@ import GptSettings from './GptSettings';
import CustomerServiceSettings from './CustomerServiceSettings';
import { getConfig, updateConfig } from '../../services/platform/controller';
import { useSettings } from './SettingsContext';
import analytics from '../../services/analytics/index_template';
import analytics from '../../services/analytics';
const SettingsPage = () => {
useEffect(() => {
@@ -1,6 +1,7 @@
export enum PlatformTypeEnum {
HOT = 'HOT',
E_COMMERCE = 'E_COMMERCE',
ME_MEDIA = 'ME_MEDIA',
RECRUIT = 'RECRUIT',
OTHER = 'OTHER',
LAW = 'LAW',
@@ -11,5 +12,6 @@ export const PlatformTypeMap = {
[PlatformTypeEnum.E_COMMERCE]: '电商',
[PlatformTypeEnum.RECRUIT]: '招聘',
[PlatformTypeEnum.LAW]: '法律咨询',
[PlatformTypeEnum.ME_MEDIA]: '自媒体',
[PlatformTypeEnum.OTHER]: '其他',
};
+5 -5
View File
@@ -19,11 +19,11 @@ export async function updatePlatform(ids: string[]) {
await POST('/api/v1/base/platform', ids);
}
export async function updateRunner(isPaused: boolean, isKeywordMatch: boolean) {
await POST('/api/v1/base/runner', {
is_paused: isPaused,
is_keyword_match: isKeywordMatch,
});
export async function updateRunner(data: {
is_paused: boolean;
is_keyword_match: boolean;
}) {
await POST('/api/v1/base/runner', data);
}
export async function getReplyList({