mirror of
https://github.com/Chanzhaoyu/chatgpt-web.git
synced 2025-07-29 17:58:38 +00:00
Compare commits
76 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3f4cb5c900 | ||
![]() |
405aeaa2a5 | ||
![]() |
fd28468778 | ||
![]() |
4128d319ed | ||
![]() |
4a06b3943c | ||
![]() |
77cdcb7798 | ||
![]() |
ee542a01f7 | ||
![]() |
30372c2e70 | ||
![]() |
6646695849 | ||
![]() |
e9db25a970 | ||
![]() |
63f4d7d77c | ||
![]() |
20255ddce4 | ||
![]() |
bbd8ff773b | ||
![]() |
c8518b7789 | ||
![]() |
bf015d35f7 | ||
![]() |
eab39b7f88 | ||
![]() |
981c036542 | ||
![]() |
91f51b6338 | ||
![]() |
26de5359ef | ||
![]() |
0423b87530 | ||
![]() |
58464b2cee | ||
![]() |
e23e1df3ce | ||
![]() |
2c3bc77eb2 | ||
![]() |
52b43868eb | ||
![]() |
7930ec5dab | ||
![]() |
7835740159 | ||
![]() |
c8745f2e21 | ||
![]() |
0b8b58f85c | ||
![]() |
c09a4f6c75 | ||
![]() |
d9761ed0e5 | ||
![]() |
cb8e2cf814 | ||
![]() |
f73aa5f9e1 | ||
![]() |
c617205a8c | ||
![]() |
79eeb51537 | ||
![]() |
b2977d8c44 | ||
![]() |
8dab963628 | ||
![]() |
79dd6c5e18 | ||
![]() |
da75ca944c | ||
![]() |
4458e744cc | ||
![]() |
d2ae2c4f54 | ||
![]() |
cf8e2dd7b6 | ||
![]() |
701ef0e6e1 | ||
![]() |
de34af8747 | ||
![]() |
33c02cfe10 | ||
![]() |
b03f804e35 | ||
![]() |
b6e5c59a9c | ||
![]() |
797cc7461b | ||
![]() |
58547d1b58 | ||
![]() |
c933a851f4 | ||
![]() |
86fcbbff0b | ||
![]() |
5d1f8519c2 | ||
![]() |
3c21068150 | ||
![]() |
cd03a71ef1 | ||
![]() |
1d74717beb | ||
![]() |
e35abb1c98 | ||
![]() |
b4b0f65158 | ||
![]() |
910c19b02e | ||
![]() |
32049fbf18 | ||
![]() |
817a4842ac | ||
![]() |
0cd120ec5b | ||
![]() |
007763f7d7 | ||
![]() |
3debaec4b2 | ||
![]() |
35f353c1f7 | ||
![]() |
3ac6746930 | ||
![]() |
9b556e4833 | ||
![]() |
071283c007 | ||
![]() |
854261ef86 | ||
![]() |
633e9ad8e2 | ||
![]() |
47dd6c9801 | ||
![]() |
0eb9df6d31 | ||
![]() |
8bfbe6f7df | ||
![]() |
43e8635e7f | ||
![]() |
b7542c70cb | ||
![]() |
b594ec5de1 | ||
![]() |
9a9b154040 | ||
![]() |
12681b1a05 |
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
Dockerfile
|
||||
.git
|
||||
.husky
|
||||
.github
|
||||
.vscode
|
4
.env
4
.env
@@ -1,2 +1,4 @@
|
||||
# Glob API URL
|
||||
VITE_GLOB_API_URL='http://localhost:3002'
|
||||
VITE_GLOB_API_URL=/api
|
||||
|
||||
VITE_APP_API_BASE_URL=http://localhost:3002/
|
||||
|
37
.github/workflows/build_docker.yml
vendored
Normal file
37
.github/workflows/build_docker.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: build_docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build_docker:
|
||||
name: Build docker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: chenzhaoyu94/chatgpt-web
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
47
.github/workflows/ci.yml
vendored
Normal file
47
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
- name: Setup
|
||||
run: npm i -g @antfu/ni
|
||||
|
||||
- name: Install
|
||||
run: nci
|
||||
|
||||
- name: Lint
|
||||
run: nr lint:fix
|
||||
|
||||
typecheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
- name: Setup
|
||||
run: npm i -g @antfu/ni
|
||||
|
||||
- name: Install
|
||||
run: nci
|
||||
|
||||
- name: Typecheck
|
||||
run: nr type-check
|
2
.husky/commit-msg
Normal file → Executable file
2
.husky/commit-msg
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm exec commitlint --config .commitlintrc.json --edit "${1}"
|
||||
npx --no -- commitlint --edit
|
||||
|
2
.husky/pre-commit
Normal file → Executable file
2
.husky/pre-commit
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm exec lint-staged
|
||||
npx lint-staged
|
||||
|
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@@ -23,7 +23,9 @@
|
||||
"axios",
|
||||
"bumpp",
|
||||
"chatgpt",
|
||||
"chenzhaoyu",
|
||||
"commitlint",
|
||||
"dockerhub",
|
||||
"esno",
|
||||
"GPTAPI",
|
||||
"iconify",
|
||||
@@ -33,8 +35,11 @@
|
||||
"rushstack",
|
||||
"Sider",
|
||||
"tailwindcss",
|
||||
"tsup",
|
||||
"Typecheck",
|
||||
"unplugin",
|
||||
"VITE",
|
||||
"vueuse"
|
||||
"vueuse",
|
||||
"Zhao"
|
||||
]
|
||||
}
|
||||
|
70
CHANGELOG.md
70
CHANGELOG.md
@@ -1,3 +1,73 @@
|
||||
## v2.4.0
|
||||
|
||||
`2023-02-17`
|
||||
|
||||
### Feature
|
||||
- 响应式支持移动端
|
||||
### Enhancement
|
||||
- 修改部份描述错误
|
||||
## v2.3.3
|
||||
|
||||
`2023-02-16`
|
||||
|
||||
### Feature
|
||||
- 添加 `README` 部份说明和贡献列表
|
||||
- 添加 `docker` 镜像
|
||||
- 添加 `GitHub Action` 自动化构建
|
||||
|
||||
### BugFix
|
||||
- 回退依赖更新导致的 [Eslint 报错](https://github.com/eslint/eslint/issues/16896)
|
||||
|
||||
## v2.3.2
|
||||
|
||||
`2023-02-16`
|
||||
|
||||
### Enhancement
|
||||
- 更新依赖至最新
|
||||
- 优化部份内容
|
||||
|
||||
## v2.3.1
|
||||
|
||||
`2023-02-15`
|
||||
|
||||
### BugFix
|
||||
- 修复多会话状态下一些意想不到的问题
|
||||
|
||||
## v2.3.0
|
||||
|
||||
`2023-02-15`
|
||||
### Feature
|
||||
- 代码类型信息高亮显示
|
||||
- 支持 `node ^16` 版本
|
||||
- 移动端响应式初步支持
|
||||
- `vite` 中 `proxy` 代理
|
||||
|
||||
### Enhancement
|
||||
- 调整超时处理范围
|
||||
|
||||
### BugFix
|
||||
- 修复取消请求错误提示会添加到信息中
|
||||
- 修复部份情况下提交请求不可用
|
||||
- 修复侧边栏宽度变化闪烁的问题
|
||||
|
||||
## v2.2.0
|
||||
|
||||
`2023-02-14`
|
||||
### Feature
|
||||
- 会话和上下文本地储存
|
||||
- 侧边栏本地储存
|
||||
|
||||
## v2.1.0
|
||||
|
||||
`2023-02-14`
|
||||
### Enhancement
|
||||
- 更新依赖至最新
|
||||
- 联想功能移动至前端提交,后端只做转发
|
||||
|
||||
### BugFix
|
||||
- 修复部份项目检测有关 `Bug`
|
||||
- 修复清除上下文按钮失效
|
||||
|
||||
## v2.0.0
|
||||
|
||||
`2023-02-13`
|
||||
|
49
CONTRIBUTING.md
Normal file
49
CONTRIBUTING.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# 贡献指南
|
||||
感谢你的宝贵时间。你的贡献将使这个项目变得更好!在提交贡献之前,请务必花点时间阅读下面的入门指南。
|
||||
|
||||
## 语义化版本
|
||||
该项目遵循语义化版本。我们对重要的漏洞修复发布修订号,对新特性或不重要的变更发布次版本号,对重大且不兼容的变更发布主版本号。
|
||||
|
||||
每个重大更改都将记录在 `changelog` 中。
|
||||
|
||||
## 提交 Pull Request
|
||||
1. Fork [此仓库](https://github.com/Chanzhaoyu/chatgpt-web),从 `main` 创建分支。新功能实现请发 pull request 到 `feature` 分支。其他更改发到 `main` 分支。
|
||||
2. 使用 `npm install pnpm -g` 安装 `pnpm` 工具。
|
||||
3. `vscode` 安装了 `Eslint` 插件,其它编辑器如 `webStorm` 打开了 `eslint` 功能。
|
||||
4. 根目录下执行 `pnpm bootstrap`。
|
||||
5. `/service/` 目录下执行 `pnpm install`。
|
||||
6. 对代码库进行更改。如果适用的话,请确保进行了相应的测试。
|
||||
7. 请在根目录下执行 `pnpm lint:fix` 进行代码格式检查。
|
||||
8. 请在根目录下执行 `pnpm type-check` 进行类型检查。
|
||||
9. 提交 git commit, 请同时遵守 [Commit 规范](#commit-指南)
|
||||
10. 提交 `pull request`, 如果有对应的 `issue`,请进行[关联](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)。
|
||||
|
||||
## Commit 指南
|
||||
|
||||
Commit messages 请遵循[conventional-changelog 标准](https://www.conventionalcommits.org/en/v1.0.0/):
|
||||
|
||||
```bash
|
||||
<类型>[可选 范围]: <描述>
|
||||
|
||||
[可选 正文]
|
||||
|
||||
[可选 脚注]
|
||||
```
|
||||
|
||||
### Commit 类型
|
||||
|
||||
以下是 commit 类型列表:
|
||||
|
||||
- feat: 新特性或功能
|
||||
- fix: 缺陷修复
|
||||
- docs: 文档更新
|
||||
- style: 代码风格或者组件样式更新
|
||||
- refactor: 代码重构,不引入新功能和缺陷修复
|
||||
- perf: 性能优化
|
||||
- test: 单元测试
|
||||
- chore: 其他不修改 src 或测试文件的提交
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./license)
|
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
# build front-end
|
||||
FROM node:lts-alpine AS builder
|
||||
|
||||
COPY ./ /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN npm install pnpm -g && pnpm install && pnpm run build
|
||||
|
||||
# service
|
||||
FROM node:lts-alpine
|
||||
|
||||
COPY /service /app
|
||||
COPY --from=builder /app/dist /app/public
|
||||
|
||||
WORKDIR /app
|
||||
RUN npm install pnpm -g && pnpm install
|
||||
|
||||
EXPOSE 3002
|
||||
|
||||
CMD ["pnpm", "run", "start"]
|
88
README.md
88
README.md
@@ -1,27 +1,31 @@
|
||||
# ChatGPT Web Bot
|
||||
|
||||
中文 | [English](./README.en.md)
|
||||
# ChatGPT Web
|
||||
|
||||
使用 express 和 vue3 搭建的 ChartGPT 演示网页
|
||||
|
||||

|
||||

|
||||
|
||||
## Route Map
|
||||
[x] 多会话
|
||||

|
||||
|
||||
[x] 多语言
|
||||
> 提示:目前 `OpenAI` 开放的模型最高只有 `GPT-3`,和现在网页所使用的 `GPT-3.5` 或 `GPT-4` 有很大差距,需要等官方开放最新的模型接口。
|
||||
|
||||
[x] 主题
|
||||
## 待实现路线
|
||||
[✓] 多会话储存和上下文逻辑
|
||||
|
||||
[x] 用户模块
|
||||
[✓] 对代码等消息类型的格式化美化处理
|
||||
|
||||
[x] More...
|
||||
[✗] 用户模块(注册、登录、个人中心)
|
||||
|
||||
[✗] 界面多语言
|
||||
|
||||
[✗] 界面主题
|
||||
|
||||
[✗] More...
|
||||
|
||||
## 前置要求
|
||||
|
||||
### Node
|
||||
|
||||
`node` 版本需要 >= 18,使用 [nvm](https://github.com/nvm-sh/nvm) 可管理本地多个 `node` 版本
|
||||
`node` 需要 `^16 || ^18` 版本(或者 `node >= 14` 需要安装 [fetch polyfill](https://github.com/developit/unfetch#usage-as-a-polyfill)),使用 [nvm](https://github.com/nvm-sh/nvm) 可管理本地多个 `node` 版本
|
||||
|
||||
```shell
|
||||
node -v
|
||||
@@ -33,8 +37,8 @@ node -v
|
||||
npm install pnpm -g
|
||||
```
|
||||
|
||||
### OpenAI API KEy
|
||||
获取 [OpenAI API key](https://platform.openai.com/overview) 并填写到本地环境变量
|
||||
### OpenAI API Key
|
||||
注册并获取 [OpenAI API key](https://platform.openai.com/overview) 并填写到本地环境变量
|
||||
```
|
||||
# service/.env 文件
|
||||
|
||||
@@ -76,21 +80,65 @@ pnpm dev
|
||||
```
|
||||
|
||||
## 打包
|
||||
|
||||
### 后端服务
|
||||
> 如果你不需要本项目的 `node` 接口,可以省略如下操作
|
||||
|
||||
复制 `service` 文件夹到你有 `node` 服务环境的服务器上。(搜索关键字:`express部署)`
|
||||
复制 `service` 文件夹到你有 `node` 服务环境的服务器上。(搜索关键字:`express部署`)
|
||||
|
||||
```shell
|
||||
# 安装
|
||||
pnpm install
|
||||
|
||||
# 打包
|
||||
pnpm build
|
||||
|
||||
# 运行
|
||||
pnpm prod
|
||||
```
|
||||
|
||||
PS: 不进行打包,直接在服务器上运行 `pnpm start` 也可
|
||||
|
||||
## Docker build & run
|
||||
|
||||
[参考信息](https://github.com/Chanzhaoyu/chatgpt-web/pull/42)
|
||||
|
||||
```bash
|
||||
docker build -t chatgpt-web .
|
||||
```
|
||||
|
||||
## Docker compose
|
||||
|
||||
[Hub 地址](https://hub.docker.com/repository/docker/chenzhaoyu94/chatgpt-web/general)
|
||||
|
||||
```yml
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
app:
|
||||
image: chenzhaoyu94/chatgpt-web:main
|
||||
ports:
|
||||
- 3002:3002
|
||||
environment:
|
||||
OPENAI_API_KEY: xxxxxx
|
||||
```
|
||||
|
||||
操作上述 `安装` 和 `运行` 服务。
|
||||
|
||||
### 网页
|
||||
|
||||
根目录下运行以下命令,然后将 `dist` 文件夹复制到你的托管服务器上
|
||||
|
||||
[参考信息](https://cn.vitejs.dev/guide/static-deploy.html#building-the-app)
|
||||
|
||||
```shell
|
||||
pnpm build
|
||||
```
|
||||
|
||||
### 常见问题
|
||||
Q: 为什么 `Git` 提交总是报错?
|
||||
|
||||
A: 因为有提交信息验证,请遵循 [Commit 指南](./CONTRIBUTING.md)
|
||||
|
||||
Q: 如果只使用前端页面,在哪里改请求接口?
|
||||
|
||||
A: 根目录下 `.env` 文件中的 `VITE_GLOB_API_URL` 字段。
|
||||
@@ -99,5 +147,15 @@ Q: 文件保存时全部爆红?
|
||||
|
||||
A: `vscode` 请安装项目推荐插件,或手动安装 `Eslint` 插件。
|
||||
|
||||
## 参与贡献
|
||||
|
||||
贡献之前请先阅读 [贡献指南](./CONTRIBUTING.md)
|
||||
|
||||
感谢所有做过贡献的人!
|
||||
|
||||
<a href="https://github.com/Chanzhaoyu/chatgpt-web/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=Chanzhaoyu/chatgpt-web" />
|
||||
</a>
|
||||
|
||||
## License
|
||||
MIT © [ChenZhaoYu](./license)
|
||||
|
BIN
docs/c1.png
Normal file
BIN
docs/c1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 KiB |
BIN
docs/c2.png
Normal file
BIN
docs/c2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 KiB |
125
index.html
125
index.html
@@ -1,71 +1,76 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cmn-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ChatGPT Web</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<style>
|
||||
.loading-wrap {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.balls {
|
||||
width: 4em;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
|
||||
<title>ChatGPT Web</title>
|
||||
</head>
|
||||
|
||||
.balls div {
|
||||
width: 0.8em;
|
||||
height: 0.8em;
|
||||
border-radius: 50%;
|
||||
background-color: #4b9e5f;
|
||||
}
|
||||
<body>
|
||||
<div id="app">
|
||||
<style>
|
||||
.loading-wrap {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.balls div:nth-of-type(1) {
|
||||
transform: translateX(-100%);
|
||||
animation: left-swing 0.5s ease-in alternate infinite;
|
||||
}
|
||||
.balls {
|
||||
width: 4em;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.balls div:nth-of-type(3) {
|
||||
transform: translateX(-95%);
|
||||
animation: right-swing 0.5s ease-out alternate infinite;
|
||||
}
|
||||
.balls div {
|
||||
width: 0.8em;
|
||||
height: 0.8em;
|
||||
border-radius: 50%;
|
||||
background-color: #4b9e5f;
|
||||
}
|
||||
|
||||
@keyframes left-swing {
|
||||
50%,
|
||||
100% {
|
||||
transform: translateX(95%);
|
||||
}
|
||||
}
|
||||
.balls div:nth-of-type(1) {
|
||||
transform: translateX(-100%);
|
||||
animation: left-swing 0.5s ease-in alternate infinite;
|
||||
}
|
||||
|
||||
@keyframes right-swing {
|
||||
50% {
|
||||
transform: translateX(-95%);
|
||||
}
|
||||
.balls div:nth-of-type(3) {
|
||||
transform: translateX(-95%);
|
||||
animation: right-swing 0.5s ease-out alternate infinite;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="loading-wrap">
|
||||
<div class="balls">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
@keyframes left-swing {
|
||||
|
||||
50%,
|
||||
100% {
|
||||
transform: translateX(95%);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes right-swing {
|
||||
50% {
|
||||
transform: translateX(-95%);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="loading-wrap">
|
||||
<div class="balls">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
31
package.json
31
package.json
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "chatgpt-web",
|
||||
"version": "2.0.0",
|
||||
"version": "2.4.0",
|
||||
"private": false,
|
||||
"description": "ChatGPT Web Bot",
|
||||
"author": "ChenZhaoYu <chenzhaoyu1994@gami.com>",
|
||||
"description": "ChatGPT Web",
|
||||
"author": "ChenZhaoYu <chenzhaoyu1994@gmail.com>",
|
||||
"keywords": [
|
||||
"chatgpt-web",
|
||||
"chatgpt",
|
||||
"chatbot",
|
||||
"web",
|
||||
"vue"
|
||||
],
|
||||
"scripts": {
|
||||
@@ -16,40 +16,47 @@
|
||||
"preview": "vite preview",
|
||||
"build-only": "vite build",
|
||||
"type-check": "vue-tsc --noEmit",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"bootstrap": "pnpm install && pnpm run common:prepare",
|
||||
"common:cleanup": "rimraf node_modules && rimraf pnpm-lock.yaml",
|
||||
"common:prepare": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vueuse/core": "^9.12.0",
|
||||
"highlight.js": "^11.7.0",
|
||||
"naive-ui": "^2.34.3",
|
||||
"pinia": "^2.0.30",
|
||||
"vue": "^3.2.47",
|
||||
"vue-router": "^4.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^0.35.2",
|
||||
"@commitlint/cli": "^17.4.2",
|
||||
"@commitlint/config-conventional": "^17.4.2",
|
||||
"@commitlint/cli": "^17.4.3",
|
||||
"@commitlint/config-conventional": "^17.4.3",
|
||||
"@iconify/vue": "^4.1.0",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/node": "^18.13.0",
|
||||
"@types/web-bluetooth": "^0.0.16",
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"axios": "^1.3.2",
|
||||
"axios": "^1.3.3",
|
||||
"crypto-js": "^4.1.1",
|
||||
"eslint": "^8.34.0",
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^13.1.1",
|
||||
"less": "^4.1.3",
|
||||
"lint-staged": "^13.1.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^8.4.21",
|
||||
"rimraf": "^4.1.2",
|
||||
"tailwindcss": "^3.2.6",
|
||||
"typescript": "~4.9.5",
|
||||
"vite": "^4.1.1",
|
||||
"vue-tsc": "^1.0.24"
|
||||
"vue-tsc": "^1.1.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,jsx,tsx,vue}": [
|
||||
"pnpm run lint:fix",
|
||||
"pnpm run type-check"
|
||||
"*.{ts,tsx,vue}": [
|
||||
"pnpm lint:fix"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
434
pnpm-lock.yaml
generated
434
pnpm-lock.yaml
generated
@@ -2,18 +2,25 @@ lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@antfu/eslint-config': ^0.35.2
|
||||
'@commitlint/cli': ^17.4.2
|
||||
'@commitlint/config-conventional': ^17.4.2
|
||||
'@commitlint/cli': ^17.4.3
|
||||
'@commitlint/config-conventional': ^17.4.3
|
||||
'@iconify/vue': ^4.1.0
|
||||
'@types/crypto-js': ^4.1.1
|
||||
'@types/node': ^18.13.0
|
||||
'@types/web-bluetooth': ^0.0.16
|
||||
'@vitejs/plugin-vue': ^4.0.0
|
||||
'@vueuse/core': ^9.12.0
|
||||
autoprefixer: ^10.4.13
|
||||
axios: ^1.3.2
|
||||
axios: ^1.3.3
|
||||
crypto-js: ^4.1.1
|
||||
eslint: ^8.34.0
|
||||
highlight.js: ^11.7.0
|
||||
husky: ^8.0.3
|
||||
lint-staged: ^13.1.1
|
||||
less: ^4.1.3
|
||||
lint-staged: ^13.1.2
|
||||
naive-ui: ^2.34.3
|
||||
npm-run-all: ^4.1.5
|
||||
pinia: ^2.0.30
|
||||
postcss: ^8.4.21
|
||||
rimraf: ^4.1.2
|
||||
tailwindcss: ^3.2.6
|
||||
@@ -21,36 +28,43 @@ specifiers:
|
||||
vite: ^4.1.1
|
||||
vue: ^3.2.47
|
||||
vue-router: ^4.1.6
|
||||
vue-tsc: ^1.0.24
|
||||
vue-tsc: ^1.1.0
|
||||
|
||||
dependencies:
|
||||
'@vueuse/core': 9.12.0_vue@3.2.47
|
||||
highlight.js: 11.7.0
|
||||
naive-ui: 2.34.3_vue@3.2.47
|
||||
pinia: 2.0.30_hmuptsblhheur2tugfgucj7gc4
|
||||
vue: 3.2.47
|
||||
vue-router: 4.1.6_vue@3.2.47
|
||||
|
||||
devDependencies:
|
||||
'@antfu/eslint-config': 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@commitlint/cli': 17.4.2
|
||||
'@commitlint/config-conventional': 17.4.2
|
||||
'@commitlint/cli': 17.4.3
|
||||
'@commitlint/config-conventional': 17.4.3
|
||||
'@iconify/vue': 4.1.0_vue@3.2.47
|
||||
'@types/crypto-js': 4.1.1
|
||||
'@types/node': 18.13.0
|
||||
'@types/web-bluetooth': 0.0.16
|
||||
'@vitejs/plugin-vue': 4.0.0_vite@4.1.1+vue@3.2.47
|
||||
autoprefixer: 10.4.13_postcss@8.4.21
|
||||
axios: 1.3.2
|
||||
axios: 1.3.3
|
||||
crypto-js: 4.1.1
|
||||
eslint: 8.34.0
|
||||
husky: 8.0.3
|
||||
lint-staged: 13.1.1
|
||||
less: 4.1.3
|
||||
lint-staged: 13.1.2
|
||||
npm-run-all: 4.1.5
|
||||
postcss: 8.4.21
|
||||
rimraf: 4.1.2
|
||||
tailwindcss: 3.2.6_postcss@8.4.21
|
||||
typescript: 4.9.5
|
||||
vite: 4.1.1_@types+node@18.13.0
|
||||
vue-tsc: 1.0.24_typescript@4.9.5
|
||||
vite: 4.1.1_edl3ajnhen4c5iqs57t4gqrzly
|
||||
vue-tsc: 1.1.0_typescript@4.9.5
|
||||
|
||||
packages:
|
||||
|
||||
/@antfu/eslint-config-basic/0.35.2_6ike4423xm2xnh233ikrbff5m4:
|
||||
/@antfu/eslint-config-basic/0.35.2_khyrr7my4aaa3ssgqabkfgcc24:
|
||||
resolution: {integrity: sha512-2k7Ovkd8U/q0sgfjuT9KzAUV0q187yGxP7JzD2D4YifuJwL5Bh3JC49KpCv9PXMTeRUMJX2y/kOtGYPetocOug==}
|
||||
peerDependencies:
|
||||
eslint: '>=7.4.0'
|
||||
@@ -59,14 +73,14 @@ packages:
|
||||
eslint-plugin-antfu: 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
eslint-plugin-eslint-comments: 3.2.0_eslint@8.34.0
|
||||
eslint-plugin-html: 7.1.0
|
||||
eslint-plugin-import: 2.27.5_62tsymtiqxebhmxuag4hg3gx2m
|
||||
eslint-plugin-import: 2.27.5_mcvs2y73sfmcxqzpjj5lr7a2m4
|
||||
eslint-plugin-jsonc: 2.6.0_eslint@8.34.0
|
||||
eslint-plugin-markdown: 3.0.0_eslint@8.34.0
|
||||
eslint-plugin-n: 15.6.1_eslint@8.34.0
|
||||
eslint-plugin-no-only-tests: 3.1.0
|
||||
eslint-plugin-promise: 6.1.1_eslint@8.34.0
|
||||
eslint-plugin-unicorn: 45.0.2_eslint@8.34.0
|
||||
eslint-plugin-unused-imports: 2.0.0_b5d7vn5fvb66hlq4xz6bd5gdxm
|
||||
eslint-plugin-unused-imports: 2.0.0_vqeavzxdzk2atb75l6fx3anzpi
|
||||
eslint-plugin-yml: 1.5.0_eslint@8.34.0
|
||||
jsonc-eslint-parser: 2.1.0
|
||||
yaml-eslint-parser: 1.1.0
|
||||
@@ -85,11 +99,11 @@ packages:
|
||||
eslint: '>=7.4.0'
|
||||
typescript: '>=3.9'
|
||||
dependencies:
|
||||
'@antfu/eslint-config-basic': 0.35.2_6ike4423xm2xnh233ikrbff5m4
|
||||
'@typescript-eslint/eslint-plugin': 5.51.0_z4swst3wuuqk4hlme4ajzslgh4
|
||||
'@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@antfu/eslint-config-basic': 0.35.2_khyrr7my4aaa3ssgqabkfgcc24
|
||||
'@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza
|
||||
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
eslint: 8.34.0
|
||||
eslint-plugin-jest: 27.2.1_wz3lx5pragqwrk3vwpswr7bnzu
|
||||
eslint-plugin-jest: 27.2.1_7hfwvekd5cgjoxqyvesymwuacm
|
||||
typescript: 4.9.5
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-typescript
|
||||
@@ -98,12 +112,12 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@antfu/eslint-config-vue/0.35.2_6ike4423xm2xnh233ikrbff5m4:
|
||||
/@antfu/eslint-config-vue/0.35.2_khyrr7my4aaa3ssgqabkfgcc24:
|
||||
resolution: {integrity: sha512-98k9D+n0bgr/9OqedAEOsflIWbXz4D92pejXqkUAtnRnB2Nq5dWrrFMJ59oJwTDKnEslpwANlgIXM11qdiTF0Q==}
|
||||
peerDependencies:
|
||||
eslint: '>=7.4.0'
|
||||
dependencies:
|
||||
'@antfu/eslint-config-basic': 0.35.2_6ike4423xm2xnh233ikrbff5m4
|
||||
'@antfu/eslint-config-basic': 0.35.2_khyrr7my4aaa3ssgqabkfgcc24
|
||||
'@antfu/eslint-config-ts': 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
eslint: 8.34.0
|
||||
eslint-plugin-vue: 9.9.0_eslint@8.34.0
|
||||
@@ -123,13 +137,13 @@ packages:
|
||||
peerDependencies:
|
||||
eslint: '>=7.4.0'
|
||||
dependencies:
|
||||
'@antfu/eslint-config-vue': 0.35.2_6ike4423xm2xnh233ikrbff5m4
|
||||
'@typescript-eslint/eslint-plugin': 5.51.0_z4swst3wuuqk4hlme4ajzslgh4
|
||||
'@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@antfu/eslint-config-vue': 0.35.2_khyrr7my4aaa3ssgqabkfgcc24
|
||||
'@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza
|
||||
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
eslint: 8.34.0
|
||||
eslint-plugin-eslint-comments: 3.2.0_eslint@8.34.0
|
||||
eslint-plugin-html: 7.1.0
|
||||
eslint-plugin-import: 2.27.5_62tsymtiqxebhmxuag4hg3gx2m
|
||||
eslint-plugin-import: 2.27.5_mcvs2y73sfmcxqzpjj5lr7a2m4
|
||||
eslint-plugin-jsonc: 2.6.0_eslint@8.34.0
|
||||
eslint-plugin-n: 15.6.1_eslint@8.34.0
|
||||
eslint-plugin-promise: 6.1.1_eslint@8.34.0
|
||||
@@ -185,13 +199,13 @@ packages:
|
||||
'@babel/helper-validator-identifier': 7.19.1
|
||||
to-fast-properties: 2.0.0
|
||||
|
||||
/@commitlint/cli/17.4.2:
|
||||
resolution: {integrity: sha512-0rPGJ2O1owhpxMIXL9YJ2CgPkdrFLKZElIZHXDN8L8+qWK1DGH7Q7IelBT1pchXTYTuDlqkOTdh//aTvT3bSUA==}
|
||||
/@commitlint/cli/17.4.3:
|
||||
resolution: {integrity: sha512-IPTS7AZuBHgD0gl24El8HwuDM9zJN9JLa5KmZUQoFD1BQeGGdzAYJOnAr85CeJWpTDok0BGHDL0+4odnH0iTyA==}
|
||||
engines: {node: '>=v14'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@commitlint/format': 17.4.0
|
||||
'@commitlint/lint': 17.4.2
|
||||
'@commitlint/lint': 17.4.3
|
||||
'@commitlint/load': 17.4.2
|
||||
'@commitlint/read': 17.4.2
|
||||
'@commitlint/types': 17.4.0
|
||||
@@ -205,8 +219,8 @@ packages:
|
||||
- '@swc/wasm'
|
||||
dev: true
|
||||
|
||||
/@commitlint/config-conventional/17.4.2:
|
||||
resolution: {integrity: sha512-JVo1moSj5eDMoql159q8zKCU8lkOhQ+b23Vl3LVVrS6PXDLQIELnJ34ChQmFVbBdSSRNAbbXnRDhosFU+wnuHw==}
|
||||
/@commitlint/config-conventional/17.4.3:
|
||||
resolution: {integrity: sha512-8EsY2iDw74hCk3hIQSg7/E0R8/KtPjnFPZVwmmHxcjhZjkSykmxysefICPDnbI3xgxfov0zwL1WKDHM8zglJdw==}
|
||||
engines: {node: '>=v14'}
|
||||
dependencies:
|
||||
conventional-changelog-conventionalcommits: 5.0.0
|
||||
@@ -253,13 +267,13 @@ packages:
|
||||
semver: 7.3.8
|
||||
dev: true
|
||||
|
||||
/@commitlint/lint/17.4.2:
|
||||
resolution: {integrity: sha512-HcymabrdBhsDMNzIv146+ZPNBPBK5gMNsVH+el2lCagnYgCi/4ixrHooeVyS64Fgce2K26+MC7OQ4vVH8wQWVw==}
|
||||
/@commitlint/lint/17.4.3:
|
||||
resolution: {integrity: sha512-GnPsqEYmXIB/MaBhRMzkiDJWyjuLrKad4xoxKO4N6Kc19iqjR4DPc/bl2dxeW9kUmtrAtefOzIEzJAevpA5y2w==}
|
||||
engines: {node: '>=v14'}
|
||||
dependencies:
|
||||
'@commitlint/is-ignored': 17.4.2
|
||||
'@commitlint/parse': 17.4.2
|
||||
'@commitlint/rules': 17.4.2
|
||||
'@commitlint/rules': 17.4.3
|
||||
'@commitlint/types': 17.4.0
|
||||
dev: true
|
||||
|
||||
@@ -323,8 +337,8 @@ packages:
|
||||
resolve-global: 1.0.0
|
||||
dev: true
|
||||
|
||||
/@commitlint/rules/17.4.2:
|
||||
resolution: {integrity: sha512-OGrPsMb9Fx3/bZ64/EzJehY9YDSGWzp81Pj+zJiY+r/NSgJI3nUYdlS37jykNIugzazdEXfMtQ10kmA+Kx2pZQ==}
|
||||
/@commitlint/rules/17.4.3:
|
||||
resolution: {integrity: sha512-xHReDfE3Z+O9p1sXeEhPRSk4FifBsC4EbXzvQ4aa0ykQe+n/iZDd4CrFC/Oiv2K9BU4ZnFHak30IbMLa4ks1Rw==}
|
||||
engines: {node: '>=v14'}
|
||||
dependencies:
|
||||
'@commitlint/ensure': 17.4.0
|
||||
@@ -695,6 +709,10 @@ packages:
|
||||
resolution: {integrity: sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==}
|
||||
dev: true
|
||||
|
||||
/@types/crypto-js/4.1.1:
|
||||
resolution: {integrity: sha512-BG7fQKZ689HIoc5h+6D2Dgq1fABRa0RbBWKBd9SP/MVRVXROflpm5fhwyATX5duFmbStzyzyycPB8qUYKDH3NA==}
|
||||
dev: true
|
||||
|
||||
/@types/json-schema/7.0.11:
|
||||
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
|
||||
dev: true
|
||||
@@ -743,8 +761,11 @@ packages:
|
||||
resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==}
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/eslint-plugin/5.51.0_z4swst3wuuqk4hlme4ajzslgh4:
|
||||
resolution: {integrity: sha512-wcAwhEWm1RgNd7dxD/o+nnLW8oH+6RK1OGnmbmkj/GGoDPV1WWMVP0FXYQBivKHdwM1pwii3bt//RC62EriIUQ==}
|
||||
/@types/web-bluetooth/0.0.16:
|
||||
resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==}
|
||||
|
||||
/@typescript-eslint/eslint-plugin/5.52.0_6cfvjsbua5ptj65675bqcn6oza:
|
||||
resolution: {integrity: sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': ^5.0.0
|
||||
@@ -754,10 +775,10 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/scope-manager': 5.51.0
|
||||
'@typescript-eslint/type-utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/scope-manager': 5.52.0
|
||||
'@typescript-eslint/type-utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
debug: 4.3.4
|
||||
eslint: 8.34.0
|
||||
grapheme-splitter: 1.0.4
|
||||
@@ -771,8 +792,8 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/parser/5.51.0_7kw3g6rralp5ps6mg3uyzz6azm:
|
||||
resolution: {integrity: sha512-fEV0R9gGmfpDeRzJXn+fGQKcl0inIeYobmmUWijZh9zA7bxJ8clPhV9up2ZQzATxAiFAECqPQyMDB4o4B81AaA==}
|
||||
/@typescript-eslint/parser/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm:
|
||||
resolution: {integrity: sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
@@ -781,9 +802,9 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/scope-manager': 5.51.0
|
||||
'@typescript-eslint/types': 5.51.0
|
||||
'@typescript-eslint/typescript-estree': 5.51.0_typescript@4.9.5
|
||||
'@typescript-eslint/scope-manager': 5.52.0
|
||||
'@typescript-eslint/types': 5.52.0
|
||||
'@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5
|
||||
debug: 4.3.4
|
||||
eslint: 8.34.0
|
||||
typescript: 4.9.5
|
||||
@@ -791,16 +812,16 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/scope-manager/5.51.0:
|
||||
resolution: {integrity: sha512-gNpxRdlx5qw3yaHA0SFuTjW4rxeYhpHxt491PEcKF8Z6zpq0kMhe0Tolxt0qjlojS+/wArSDlj/LtE69xUJphQ==}
|
||||
/@typescript-eslint/scope-manager/5.52.0:
|
||||
resolution: {integrity: sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 5.51.0
|
||||
'@typescript-eslint/visitor-keys': 5.51.0
|
||||
'@typescript-eslint/types': 5.52.0
|
||||
'@typescript-eslint/visitor-keys': 5.52.0
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/type-utils/5.51.0_7kw3g6rralp5ps6mg3uyzz6azm:
|
||||
resolution: {integrity: sha512-QHC5KKyfV8sNSyHqfNa0UbTbJ6caB8uhcx2hYcWVvJAZYJRBo5HyyZfzMdRx8nvS+GyMg56fugMzzWnojREuQQ==}
|
||||
/@typescript-eslint/type-utils/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm:
|
||||
resolution: {integrity: sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: '*'
|
||||
@@ -809,8 +830,8 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/typescript-estree': 5.51.0_typescript@4.9.5
|
||||
'@typescript-eslint/utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5
|
||||
'@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
debug: 4.3.4
|
||||
eslint: 8.34.0
|
||||
tsutils: 3.21.0_typescript@4.9.5
|
||||
@@ -819,13 +840,13 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/types/5.51.0:
|
||||
resolution: {integrity: sha512-SqOn0ANn/v6hFn0kjvLwiDi4AzR++CBZz0NV5AnusT2/3y32jdc0G4woXPWHCumWtUXZKPAS27/9vziSsC9jnw==}
|
||||
/@typescript-eslint/types/5.52.0:
|
||||
resolution: {integrity: sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/typescript-estree/5.51.0_typescript@4.9.5:
|
||||
resolution: {integrity: sha512-TSkNupHvNRkoH9FMA3w7TazVFcBPveAAmb7Sz+kArY6sLT86PA5Vx80cKlYmd8m3Ha2SwofM1KwraF24lM9FvA==}
|
||||
/@typescript-eslint/typescript-estree/5.52.0_typescript@4.9.5:
|
||||
resolution: {integrity: sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
@@ -833,8 +854,8 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 5.51.0
|
||||
'@typescript-eslint/visitor-keys': 5.51.0
|
||||
'@typescript-eslint/types': 5.52.0
|
||||
'@typescript-eslint/visitor-keys': 5.52.0
|
||||
debug: 4.3.4
|
||||
globby: 11.1.0
|
||||
is-glob: 4.0.3
|
||||
@@ -845,17 +866,17 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/utils/5.51.0_7kw3g6rralp5ps6mg3uyzz6azm:
|
||||
resolution: {integrity: sha512-76qs+5KWcaatmwtwsDJvBk4H76RJQBFe+Gext0EfJdC3Vd2kpY2Pf//OHHzHp84Ciw0/rYoGTDnIAr3uWhhJYw==}
|
||||
/@typescript-eslint/utils/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm:
|
||||
resolution: {integrity: sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.11
|
||||
'@types/semver': 7.3.13
|
||||
'@typescript-eslint/scope-manager': 5.51.0
|
||||
'@typescript-eslint/types': 5.51.0
|
||||
'@typescript-eslint/typescript-estree': 5.51.0_typescript@4.9.5
|
||||
'@typescript-eslint/scope-manager': 5.52.0
|
||||
'@typescript-eslint/types': 5.52.0
|
||||
'@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5
|
||||
eslint: 8.34.0
|
||||
eslint-scope: 5.1.1
|
||||
eslint-utils: 3.0.0_eslint@8.34.0
|
||||
@@ -865,11 +886,11 @@ packages:
|
||||
- typescript
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/visitor-keys/5.51.0:
|
||||
resolution: {integrity: sha512-Oh2+eTdjHjOFjKA27sxESlA87YPSOJafGCR0md5oeMdh1ZcCfAGCIOL216uTBAkAIptvLIfKQhl7lHxMJet4GQ==}
|
||||
/@typescript-eslint/visitor-keys/5.52.0:
|
||||
resolution: {integrity: sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 5.51.0
|
||||
'@typescript-eslint/types': 5.52.0
|
||||
eslint-visitor-keys: 3.3.0
|
||||
dev: true
|
||||
|
||||
@@ -880,47 +901,47 @@ packages:
|
||||
vite: ^4.0.0
|
||||
vue: ^3.2.25
|
||||
dependencies:
|
||||
vite: 4.1.1_@types+node@18.13.0
|
||||
vite: 4.1.1_edl3ajnhen4c5iqs57t4gqrzly
|
||||
vue: 3.2.47
|
||||
dev: true
|
||||
|
||||
/@volar/language-core/1.0.24:
|
||||
resolution: {integrity: sha512-vTN+alJiWwK0Pax6POqrmevbtFW2dXhjwWiW/MW4f48eDYPLdyURWcr8TixO7EN/nHsUBj2udT7igFKPtjyAKg==}
|
||||
/@volar/language-core/1.2.0-alpha.11:
|
||||
resolution: {integrity: sha512-OfbPmmFa4LUA8kJCg77V9ud4NASjJ3VKJ79QCQSfHa5SwXeZ5w7lvQe2yILFBjZ3JDB5EfFnHZUSct6ziK3x5Q==}
|
||||
dependencies:
|
||||
'@volar/source-map': 1.0.24
|
||||
muggle-string: 0.1.0
|
||||
'@volar/source-map': 1.2.0-alpha.11
|
||||
dev: true
|
||||
|
||||
/@volar/source-map/1.0.24:
|
||||
resolution: {integrity: sha512-Qsv/tkplx18pgBr8lKAbM1vcDqgkGKQzbChg6NW+v0CZc3G7FLmK+WrqEPzKlN7Cwdc6XVL559Nod8WKAfKr4A==}
|
||||
/@volar/source-map/1.2.0-alpha.11:
|
||||
resolution: {integrity: sha512-GCRqcq2bn8Gf9N/qbdl8GgfGbmYuuSIB8arhl+gRZfCIWvT5NhIRVlG5GX0lkgpp02lA8ZYWZ0GLGOkwz7+DMQ==}
|
||||
dependencies:
|
||||
muggle-string: 0.1.0
|
||||
muggle-string: 0.2.2
|
||||
dev: true
|
||||
|
||||
/@volar/typescript/1.0.24:
|
||||
resolution: {integrity: sha512-f8hCSk+PfKR1/RQHxZ79V1NpDImHoivqoizK+mstphm25tn/YJ/JnKNjZHB+o21fuW0yKlI26NV3jkVb2Cc/7A==}
|
||||
/@volar/typescript/1.2.0-alpha.11:
|
||||
resolution: {integrity: sha512-tJ20326E/Xi1lvvuWX57boVJtzhStNF3HjBu4orjl9PqCXUbhqWwP+jRYzyb+nLbHqGPmEBvHKYjAO3GsJ/YXg==}
|
||||
dependencies:
|
||||
'@volar/language-core': 1.0.24
|
||||
'@volar/language-core': 1.2.0-alpha.11
|
||||
dev: true
|
||||
|
||||
/@volar/vue-language-core/1.0.24:
|
||||
resolution: {integrity: sha512-2NTJzSgrwKu6uYwPqLiTMuAzi7fAY3yFy5PJ255bGJc82If0Xr+cW8pC80vpjG0D/aVLmlwAdO4+Ya2BI8GdDg==}
|
||||
/@volar/vue-language-core/1.1.0:
|
||||
resolution: {integrity: sha512-1zTAyeGiyNKYE9s+i3dUpmuvY/Cz1U7LjIh9d5FX3p0NWpaBrzYvSh0gQY+nRaz67or7Y9qYSUCaHLKOmeolzg==}
|
||||
dependencies:
|
||||
'@volar/language-core': 1.0.24
|
||||
'@volar/source-map': 1.0.24
|
||||
'@volar/language-core': 1.2.0-alpha.11
|
||||
'@volar/source-map': 1.2.0-alpha.11
|
||||
'@vue/compiler-dom': 3.2.47
|
||||
'@vue/compiler-sfc': 3.2.47
|
||||
'@vue/reactivity': 3.2.47
|
||||
'@vue/shared': 3.2.47
|
||||
minimatch: 5.1.6
|
||||
minimatch: 6.2.0
|
||||
muggle-string: 0.2.2
|
||||
vue-template-compiler: 2.7.14
|
||||
dev: true
|
||||
|
||||
/@volar/vue-typescript/1.0.24:
|
||||
resolution: {integrity: sha512-9a25oHDvGaNC0okRS47uqJI6FxY4hUQZUsxeOUFHcqVxZEv8s17LPuP/pMMXyz7jPygrZubB/qXqHY5jEu/akA==}
|
||||
/@volar/vue-typescript/1.1.0:
|
||||
resolution: {integrity: sha512-smtfaePuNpVzXEypJayORtl8muvBdtV1FDWjces1WLYbbtcnmfWtdACW9xY0dkVk0LoE/LZTEmLBCQrRJ6hS1w==}
|
||||
dependencies:
|
||||
'@volar/typescript': 1.0.24
|
||||
'@volar/vue-language-core': 1.0.24
|
||||
'@volar/typescript': 1.2.0-alpha.11
|
||||
'@volar/vue-language-core': 1.1.0
|
||||
dev: true
|
||||
|
||||
/@vue/compiler-core/3.2.47:
|
||||
@@ -1000,6 +1021,31 @@ packages:
|
||||
/@vue/shared/3.2.47:
|
||||
resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==}
|
||||
|
||||
/@vueuse/core/9.12.0_vue@3.2.47:
|
||||
resolution: {integrity: sha512-h/Di8Bvf6xRcvS/PvUVheiMYYz3U0tH3X25YxONSaAUBa841ayMwxkuzx/DGUMCW/wHWzD8tRy2zYmOC36r4sg==}
|
||||
dependencies:
|
||||
'@types/web-bluetooth': 0.0.16
|
||||
'@vueuse/metadata': 9.12.0
|
||||
'@vueuse/shared': 9.12.0_vue@3.2.47
|
||||
vue-demi: 0.13.11_vue@3.2.47
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
dev: false
|
||||
|
||||
/@vueuse/metadata/9.12.0:
|
||||
resolution: {integrity: sha512-9oJ9MM9lFLlmvxXUqsR1wLt1uF7EVbP5iYaHJYqk+G2PbMjY6EXvZeTjbdO89HgoF5cI6z49o2zT/jD9SVoNpQ==}
|
||||
dev: false
|
||||
|
||||
/@vueuse/shared/9.12.0_vue@3.2.47:
|
||||
resolution: {integrity: sha512-TWuJLACQ0BVithVTRbex4Wf1a1VaRuSpVeyEd4vMUWl54PzlE0ciFUshKCXnlLuD0lxIaLK4Ypj3NXYzZh4+SQ==}
|
||||
dependencies:
|
||||
vue-demi: 0.13.11_vue@3.2.47
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
dev: false
|
||||
|
||||
/JSONStream/1.3.5:
|
||||
resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==}
|
||||
hasBin: true
|
||||
@@ -1194,7 +1240,7 @@ packages:
|
||||
postcss: ^8.1.0
|
||||
dependencies:
|
||||
browserslist: 4.21.5
|
||||
caniuse-lite: 1.0.30001451
|
||||
caniuse-lite: 1.0.30001452
|
||||
fraction.js: 4.2.0
|
||||
normalize-range: 0.1.2
|
||||
picocolors: 1.0.0
|
||||
@@ -1207,8 +1253,8 @@ packages:
|
||||
engines: {node: '>= 0.4'}
|
||||
dev: true
|
||||
|
||||
/axios/1.3.2:
|
||||
resolution: {integrity: sha512-1M3O703bYqYuPhbHeya5bnhpYVsDDRyQSabNja04mZtboLNSuZ4YrltestrLXfHgmzua4TpUqRiVKbiQuo2epw==}
|
||||
/axios/1.3.3:
|
||||
resolution: {integrity: sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==}
|
||||
dependencies:
|
||||
follow-redirects: 1.15.2
|
||||
form-data: 4.0.0
|
||||
@@ -1255,8 +1301,8 @@ packages:
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001451
|
||||
electron-to-chromium: 1.4.295
|
||||
caniuse-lite: 1.0.30001452
|
||||
electron-to-chromium: 1.4.296
|
||||
node-releases: 2.0.10
|
||||
update-browserslist-db: 1.0.10_browserslist@4.21.5
|
||||
dev: true
|
||||
@@ -1303,8 +1349,8 @@ packages:
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/caniuse-lite/1.0.30001451:
|
||||
resolution: {integrity: sha512-XY7UbUpGRatZzoRft//5xOa69/1iGJRBlrieH6QYrkKLIFn3m7OVEJ81dSrKoy2BnKsdbX5cLrOispZNYo9v2w==}
|
||||
/caniuse-lite/1.0.30001452:
|
||||
resolution: {integrity: sha512-Lkp0vFjMkBB3GTpLR8zk4NwW5EdRdnitwYJHDOOKIU85x4ckYCPQ+9WlVvSVClHxVReefkUMtWZH2l9KGlD51w==}
|
||||
dev: true
|
||||
|
||||
/chalk/2.4.2:
|
||||
@@ -1478,6 +1524,12 @@ packages:
|
||||
through2: 4.0.2
|
||||
dev: true
|
||||
|
||||
/copy-anything/2.0.6:
|
||||
resolution: {integrity: sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==}
|
||||
dependencies:
|
||||
is-what: 3.14.1
|
||||
dev: true
|
||||
|
||||
/cosmiconfig-typescript-loader/4.3.0_p7cp6dsfhdrlk7mvuxd3wodbsu:
|
||||
resolution: {integrity: sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==}
|
||||
engines: {node: '>=12', npm: '>=6'}
|
||||
@@ -1527,6 +1579,10 @@ packages:
|
||||
which: 2.0.2
|
||||
dev: true
|
||||
|
||||
/crypto-js/4.1.1:
|
||||
resolution: {integrity: sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==}
|
||||
dev: true
|
||||
|
||||
/css-render/0.15.12:
|
||||
resolution: {integrity: sha512-eWzS66patiGkTTik+ipO9qNGZ+uNuGyTmnz6/+EJIiFg8+3yZRpnMwgFo8YdXhQRsiePzehnusrxVvugNjXzbw==}
|
||||
dependencies:
|
||||
@@ -1708,8 +1764,8 @@ packages:
|
||||
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
|
||||
dev: true
|
||||
|
||||
/electron-to-chromium/1.4.295:
|
||||
resolution: {integrity: sha512-lEO94zqf1bDA3aepxwnWoHUjA8sZ+2owgcSZjYQy0+uOSEclJX0VieZC+r+wLpSxUHRd6gG32znTWmr+5iGzFw==}
|
||||
/electron-to-chromium/1.4.296:
|
||||
resolution: {integrity: sha512-i/6Q+Y9bluDa2a0NbMvdtG5TuS/1Fr3TKK8L+7UUL9QjRS5iFJzCC3r70xjyOnLiYG8qGV4/mMpe6HuAbdJW4w==}
|
||||
dev: true
|
||||
|
||||
/emoji-regex/8.0.0:
|
||||
@@ -1725,6 +1781,15 @@ packages:
|
||||
engines: {node: '>=0.12'}
|
||||
dev: true
|
||||
|
||||
/errno/0.1.8:
|
||||
resolution: {integrity: sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
prr: 1.0.1
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/error-ex/1.3.2:
|
||||
resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==}
|
||||
dependencies:
|
||||
@@ -1849,7 +1914,7 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-module-utils/2.7.4_ithmlgmaospkvl4p7n7pyp3rgq:
|
||||
/eslint-module-utils/2.7.4_npjqex3ey3rgd34fjcuucz7la4:
|
||||
resolution: {integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
@@ -1870,7 +1935,7 @@ packages:
|
||||
eslint-import-resolver-webpack:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
debug: 3.2.7
|
||||
eslint: 8.34.0
|
||||
eslint-import-resolver-node: 0.3.7
|
||||
@@ -1881,7 +1946,7 @@ packages:
|
||||
/eslint-plugin-antfu/0.35.2_7kw3g6rralp5ps6mg3uyzz6azm:
|
||||
resolution: {integrity: sha512-Q6FOcOakafU49PDRlq7jkrWmlTJ4u3AW7aGX+FqeQNaMgjXq0RzPGvS0Vyp7q/XDRLLoe0BjbGkamTeZXg8waw==}
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
transitivePeerDependencies:
|
||||
- eslint
|
||||
- supports-color
|
||||
@@ -1916,7 +1981,7 @@ packages:
|
||||
htmlparser2: 8.0.1
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-import/2.27.5_62tsymtiqxebhmxuag4hg3gx2m:
|
||||
/eslint-plugin-import/2.27.5_mcvs2y73sfmcxqzpjj5lr7a2m4:
|
||||
resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
@@ -1926,7 +1991,7 @@ packages:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
array-includes: 3.1.6
|
||||
array.prototype.flat: 1.3.1
|
||||
array.prototype.flatmap: 1.3.1
|
||||
@@ -1934,7 +1999,7 @@ packages:
|
||||
doctrine: 2.1.0
|
||||
eslint: 8.34.0
|
||||
eslint-import-resolver-node: 0.3.7
|
||||
eslint-module-utils: 2.7.4_ithmlgmaospkvl4p7n7pyp3rgq
|
||||
eslint-module-utils: 2.7.4_npjqex3ey3rgd34fjcuucz7la4
|
||||
has: 1.0.3
|
||||
is-core-module: 2.11.0
|
||||
is-glob: 4.0.3
|
||||
@@ -1949,7 +2014,7 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-jest/27.2.1_wz3lx5pragqwrk3vwpswr7bnzu:
|
||||
/eslint-plugin-jest/27.2.1_7hfwvekd5cgjoxqyvesymwuacm:
|
||||
resolution: {integrity: sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
peerDependencies:
|
||||
@@ -1962,8 +2027,8 @@ packages:
|
||||
jest:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 5.51.0_z4swst3wuuqk4hlme4ajzslgh4
|
||||
'@typescript-eslint/utils': 5.51.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
'@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza
|
||||
'@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
|
||||
eslint: 8.34.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -2050,7 +2115,7 @@ packages:
|
||||
strip-indent: 3.0.0
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-unused-imports/2.0.0_b5d7vn5fvb66hlq4xz6bd5gdxm:
|
||||
/eslint-plugin-unused-imports/2.0.0_vqeavzxdzk2atb75l6fx3anzpi:
|
||||
resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
@@ -2060,7 +2125,7 @@ packages:
|
||||
'@typescript-eslint/eslint-plugin':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 5.51.0_z4swst3wuuqk4hlme4ajzslgh4
|
||||
'@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza
|
||||
eslint: 8.34.0
|
||||
eslint-rule-composer: 0.3.0
|
||||
dev: true
|
||||
@@ -2618,11 +2683,27 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/iconv-lite/0.6.3:
|
||||
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dependencies:
|
||||
safer-buffer: 2.1.2
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/ignore/5.2.4:
|
||||
resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==}
|
||||
engines: {node: '>= 4'}
|
||||
dev: true
|
||||
|
||||
/image-size/0.5.5:
|
||||
resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/import-fresh/3.3.0:
|
||||
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -2858,6 +2939,10 @@ packages:
|
||||
call-bind: 1.0.2
|
||||
dev: true
|
||||
|
||||
/is-what/3.14.1:
|
||||
resolution: {integrity: sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==}
|
||||
dev: true
|
||||
|
||||
/isexe/2.0.0:
|
||||
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
||||
dev: true
|
||||
@@ -2943,6 +3028,26 @@ packages:
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/less/4.1.3:
|
||||
resolution: {integrity: sha512-w16Xk/Ta9Hhyei0Gpz9m7VS8F28nieJaL/VyShID7cYvP6IL5oHeL6p4TXSDJqZE/lNv0oJ2pGVjJsRkfwm5FA==}
|
||||
engines: {node: '>=6'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
copy-anything: 2.0.6
|
||||
parse-node-version: 1.0.1
|
||||
tslib: 2.5.0
|
||||
optionalDependencies:
|
||||
errno: 0.1.8
|
||||
graceful-fs: 4.2.10
|
||||
image-size: 0.5.5
|
||||
make-dir: 2.1.0
|
||||
mime: 1.6.0
|
||||
needle: 3.2.0
|
||||
source-map: 0.6.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/levn/0.4.1:
|
||||
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
@@ -2960,8 +3065,8 @@ packages:
|
||||
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
|
||||
dev: true
|
||||
|
||||
/lint-staged/13.1.1:
|
||||
resolution: {integrity: sha512-LLJLO0Kdbcv2a+CvSF4p1M7jBZOajKSMpBUvyR8+bXccsqPER0/NxTFQSpNHjqwV9kM3tkHczYerTB5wI+bksQ==}
|
||||
/lint-staged/13.1.2:
|
||||
resolution: {integrity: sha512-K9b4FPbWkpnupvK3WXZLbgu9pchUJ6N7TtVZjbaPsoizkqFUDkUReUL25xdrCljJs7uLUF3tZ7nVPeo/6lp+6w==}
|
||||
engines: {node: ^14.13.1 || >=16.0.0}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
@@ -3100,6 +3205,16 @@ packages:
|
||||
dependencies:
|
||||
sourcemap-codec: 1.4.8
|
||||
|
||||
/make-dir/2.1.0:
|
||||
resolution: {integrity: sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==}
|
||||
engines: {node: '>=6'}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
pify: 4.0.1
|
||||
semver: 5.7.1
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/make-error/1.3.6:
|
||||
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
|
||||
dev: true
|
||||
@@ -3190,6 +3305,14 @@ packages:
|
||||
mime-db: 1.52.0
|
||||
dev: true
|
||||
|
||||
/mime/1.6.0:
|
||||
resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==}
|
||||
engines: {node: '>=4'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/mimic-fn/2.1.0:
|
||||
resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -3211,8 +3334,8 @@ packages:
|
||||
brace-expansion: 1.1.11
|
||||
dev: true
|
||||
|
||||
/minimatch/5.1.6:
|
||||
resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}
|
||||
/minimatch/6.2.0:
|
||||
resolution: {integrity: sha512-sauLxniAmvnhhRjFwPNnJKaPFYyddAgbYdeUpHULtCT/GhzdCx/MDNy+Y40lBxTQUrMzDE8e0S43Z5uqfO0REg==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
brace-expansion: 2.0.1
|
||||
@@ -3239,8 +3362,8 @@ packages:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
dev: true
|
||||
|
||||
/muggle-string/0.1.0:
|
||||
resolution: {integrity: sha512-Tr1knR3d2mKvvWthlk7202rywKbiOm4rVFLsfAaSIhJ6dt9o47W4S+JMtWhd/PW9Wrdew2/S2fSvhz3E2gkfEg==}
|
||||
/muggle-string/0.2.2:
|
||||
resolution: {integrity: sha512-YVE1mIJ4VpUMqZObFndk9CJu6DBJR/GB13p3tXuNbwD4XExaI5EOuRl6BHeIDxIqXZVxSfAC+y6U1Z/IxCfKUg==}
|
||||
dev: true
|
||||
|
||||
/naive-ui/2.34.3_vue@3.2.47:
|
||||
@@ -3282,6 +3405,20 @@ packages:
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
dev: true
|
||||
|
||||
/needle/3.2.0:
|
||||
resolution: {integrity: sha512-oUvzXnyLiVyVGoianLijF9O/RecZUf7TkBfimjGrLM4eQhXyeJwM6GeAWccwfQ9aa4gMCZKqhAOuLaMIcQxajQ==}
|
||||
engines: {node: '>= 4.4.x'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
debug: 3.2.7
|
||||
iconv-lite: 0.6.3
|
||||
sax: 1.2.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/nice-try/1.0.5:
|
||||
resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==}
|
||||
dev: true
|
||||
@@ -3496,6 +3633,11 @@ packages:
|
||||
lines-and-columns: 1.2.4
|
||||
dev: true
|
||||
|
||||
/parse-node-version/1.0.1:
|
||||
resolution: {integrity: sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==}
|
||||
engines: {node: '>= 0.10'}
|
||||
dev: true
|
||||
|
||||
/path-exists/4.0.0:
|
||||
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -3567,6 +3709,30 @@ packages:
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/pify/4.0.1:
|
||||
resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/pinia/2.0.30_hmuptsblhheur2tugfgucj7gc4:
|
||||
resolution: {integrity: sha512-q6DUmxWwe/mQgg+55QQjykpKC+aGeGdaJV3niminl19V08dE+LRTvSEuqi6/NLSGCKHI49KGL6tMNEOssFiMyA==}
|
||||
peerDependencies:
|
||||
'@vue/composition-api': ^1.4.0
|
||||
typescript: '>=4.4.4'
|
||||
vue: ^2.6.14 || ^3.2.0
|
||||
peerDependenciesMeta:
|
||||
'@vue/composition-api':
|
||||
optional: true
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@vue/devtools-api': 6.5.0
|
||||
typescript: 4.9.5
|
||||
vue: 3.2.47
|
||||
vue-demi: 0.13.11_vue@3.2.47
|
||||
dev: false
|
||||
|
||||
/pluralize/8.0.0:
|
||||
resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -3650,6 +3816,11 @@ packages:
|
||||
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
|
||||
dev: true
|
||||
|
||||
/prr/1.0.1:
|
||||
resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==}
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/punycode/2.3.0:
|
||||
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -3862,6 +4033,16 @@ packages:
|
||||
regexp-tree: 0.1.24
|
||||
dev: true
|
||||
|
||||
/safer-buffer/2.1.2:
|
||||
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/sax/1.2.4:
|
||||
resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==}
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/seemly/0.3.6:
|
||||
resolution: {integrity: sha512-lEV5VB8BUKTo/AfktXJcy+JeXns26ylbMkIUco8CYREsQijuz4mrXres2Q+vMLdwkuLxJdIPQ8IlCIxLYm71Yw==}
|
||||
dev: false
|
||||
@@ -4284,7 +4465,6 @@ packages:
|
||||
resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==}
|
||||
engines: {node: '>=4.2.0'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/unbox-primitive/1.0.2:
|
||||
resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==}
|
||||
@@ -4347,7 +4527,7 @@ packages:
|
||||
vue: 3.2.47
|
||||
dev: false
|
||||
|
||||
/vite/4.1.1_@types+node@18.13.0:
|
||||
/vite/4.1.1_edl3ajnhen4c5iqs57t4gqrzly:
|
||||
resolution: {integrity: sha512-LM9WWea8vsxhr782r9ntg+bhSFS06FJgCvvB0+8hf8UWtvaiDagKYWXndjfX6kGl74keHJUcpzrQliDXZlF5yg==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
hasBin: true
|
||||
@@ -4374,6 +4554,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/node': 18.13.0
|
||||
esbuild: 0.16.17
|
||||
less: 4.1.3
|
||||
postcss: 8.4.21
|
||||
resolve: 1.22.1
|
||||
rollup: 3.15.0
|
||||
@@ -4390,6 +4571,21 @@ packages:
|
||||
vue: 3.2.47
|
||||
dev: false
|
||||
|
||||
/vue-demi/0.13.11_vue@3.2.47:
|
||||
resolution: {integrity: sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==}
|
||||
engines: {node: '>=12'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
peerDependencies:
|
||||
'@vue/composition-api': ^1.0.0-rc.1
|
||||
vue: ^3.0.0-0 || ^2.6.0
|
||||
peerDependenciesMeta:
|
||||
'@vue/composition-api':
|
||||
optional: true
|
||||
dependencies:
|
||||
vue: 3.2.47
|
||||
dev: false
|
||||
|
||||
/vue-eslint-parser/9.1.0_eslint@8.34.0:
|
||||
resolution: {integrity: sha512-NGn/iQy8/Wb7RrRa4aRkokyCZfOUWk19OP5HP6JEozQFX5AoS/t+Z0ZN7FY4LlmWc4FNI922V7cvX28zctN8dQ==}
|
||||
engines: {node: ^14.17.0 || >=16.0.0}
|
||||
@@ -4424,14 +4620,14 @@ packages:
|
||||
he: 1.2.0
|
||||
dev: true
|
||||
|
||||
/vue-tsc/1.0.24_typescript@4.9.5:
|
||||
resolution: {integrity: sha512-mmU1s5SAqE1nByQAiQnao9oU4vX+mSdsgI8H57SfKH6UVzq/jP9+Dbi2GaV+0b4Cn361d2ln8m6xeU60ApiEXg==}
|
||||
/vue-tsc/1.1.0_typescript@4.9.5:
|
||||
resolution: {integrity: sha512-+JqTcuScA6OfyaVH3ezeCh2i2wRgzUScZ6EdTZ3AW69Nb+rmRyOAxmAjL6MPam8YCdwmmdfAUhmN/BNGVp5vQg==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
dependencies:
|
||||
'@volar/vue-language-core': 1.0.24
|
||||
'@volar/vue-typescript': 1.0.24
|
||||
'@volar/vue-language-core': 1.1.0
|
||||
'@volar/vue-typescript': 1.1.0
|
||||
typescript: 4.9.5
|
||||
dev: true
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
# OpenAI API Key
|
||||
# OpenAI API Key - https://platform.openai.com/overview
|
||||
OPENAI_API_KEY=
|
||||
|
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"root": true,
|
||||
"ignorePatterns": ["build"],
|
||||
"extends": ["@antfu"]
|
||||
}
|
||||
|
2
service/.gitignore
vendored
2
service/.gitignore
vendored
@@ -27,3 +27,5 @@ coverage
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
build
|
||||
|
1
service/.npmrc
Normal file
1
service/.npmrc
Normal file
@@ -0,0 +1 @@
|
||||
enable-pre-post-scripts=true
|
@@ -2,32 +2,40 @@
|
||||
"name": "chatgpt-web-service",
|
||||
"version": "1.0.0",
|
||||
"private": false,
|
||||
"description": "ChatGPT Web Bot node service",
|
||||
"description": "ChatGPT Web Service",
|
||||
"author": "ChenZhaoYu <chenzhaoyu1994@gmail.com>",
|
||||
"keywords": [
|
||||
"chatgpt-web",
|
||||
"chatgpt",
|
||||
"chatbot",
|
||||
"web",
|
||||
"vue"
|
||||
"express"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
"node": "^16 || ^18"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "esno ./src/index.ts",
|
||||
"prod": "esno ./build/index.js",
|
||||
"build": "pnpm clean && tsup",
|
||||
"clean": "rimraf build",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix"
|
||||
"lint:fix": "eslint . --fix",
|
||||
"common:cleanup": "rimraf node_modules && rimraf pnpm-lock.yaml"
|
||||
},
|
||||
"dependencies": {
|
||||
"chatgpt": "^4.2.0",
|
||||
"express": "^4.18.2"
|
||||
"chatgpt": "^4.3.2",
|
||||
"dotenv": "^16.0.3",
|
||||
"esno": "^0.16.3",
|
||||
"express": "^4.18.2",
|
||||
"isomorphic-fetch": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^0.35.2",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/node": "^18.13.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"eslint": "^8.34.0",
|
||||
"esno": "^0.16.3",
|
||||
"rimraf": "^4.1.2",
|
||||
"tsup": "^6.6.2",
|
||||
"typescript": "^4.9.5"
|
||||
}
|
||||
}
|
||||
|
669
service/pnpm-lock.yaml
generated
669
service/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
import * as dotenv from 'dotenv'
|
||||
import type { SendMessageOptions } from 'chatgpt'
|
||||
import { ChatGPTAPI } from 'chatgpt'
|
||||
import 'isomorphic-fetch'
|
||||
import type { ChatGPTAPI, SendMessageOptions } from 'chatgpt'
|
||||
import { sendResponse } from './utils'
|
||||
|
||||
export interface ChatContext {
|
||||
@@ -15,67 +15,35 @@ const apiKey = process.env.OPENAI_API_KEY
|
||||
if (apiKey === undefined)
|
||||
throw new Error('OPENAI_API_KEY is not defined')
|
||||
|
||||
const chatContext = new Set<ChatContext>()
|
||||
let api: ChatGPTAPI
|
||||
|
||||
/**
|
||||
* More Info: https://github.com/transitive-bullshit/chatgpt-api
|
||||
*/
|
||||
const api = new ChatGPTAPI({ apiKey })
|
||||
// To use ESM in CommonJS, you can use a dynamic import
|
||||
(async () => {
|
||||
// More Info: https://github.com/transitive-bullshit/chatgpt-api
|
||||
const { ChatGPTAPI } = await import('chatgpt')
|
||||
api = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY })
|
||||
})()
|
||||
|
||||
async function chatReply(message: string) {
|
||||
async function chatReply(
|
||||
message: string,
|
||||
lastContext?: { conversationId?: string; parentMessageId?: string },
|
||||
) {
|
||||
if (!message)
|
||||
return sendResponse({ type: 'Fail', message: 'Message is empty' })
|
||||
|
||||
try {
|
||||
// Get the last context from the chat context
|
||||
let options: SendMessageOptions = {}
|
||||
|
||||
const lastContext = Array.from(chatContext).pop()
|
||||
let options: SendMessageOptions = { timeoutMs: 30 * 1000 }
|
||||
|
||||
if (lastContext)
|
||||
options = { ...lastContext }
|
||||
|
||||
const response = await api.sendMessage(message, { ...options })
|
||||
|
||||
const { conversationId, id } = response
|
||||
|
||||
// Add the new context to the chat context
|
||||
if (conversationId && id)
|
||||
chatContext.add({ conversationId, parentMessageId: id })
|
||||
|
||||
return sendResponse({ type: 'Success', data: response })
|
||||
}
|
||||
catch (error: any) {
|
||||
global.console.log(error)
|
||||
return sendResponse({ type: 'Fail', message: error.message })
|
||||
}
|
||||
}
|
||||
|
||||
async function chatReplayOne(message: string, options?: ChatContext) {
|
||||
if (!message)
|
||||
return sendResponse({ type: 'Fail', message: 'Message is empty' })
|
||||
|
||||
try {
|
||||
let messageOptions: SendMessageOptions = {}
|
||||
|
||||
if (options) {
|
||||
const { conversationId, parentMessageId } = options
|
||||
messageOptions = { conversationId, parentMessageId }
|
||||
|
||||
const response = await api.sendMessage(message, { ...messageOptions })
|
||||
|
||||
return sendResponse({ type: 'Success', data: response })
|
||||
}
|
||||
}
|
||||
catch (error: any) {
|
||||
return sendResponse({ type: 'Fail', message: error.message })
|
||||
}
|
||||
}
|
||||
|
||||
async function clearChatContext() {
|
||||
// Clear the chat context
|
||||
chatContext.clear()
|
||||
return sendResponse({ type: 'Success', message: 'Chat context cleared' })
|
||||
}
|
||||
|
||||
export { chatReply, chatReplayOne, clearChatContext }
|
||||
export { chatReply }
|
||||
|
@@ -1,35 +1,24 @@
|
||||
import express from 'express'
|
||||
import type { ChatContext } from './chatgpt'
|
||||
import { chatReplayOne, chatReply, clearChatContext } from './chatgpt'
|
||||
import { chatReply } from './chatgpt'
|
||||
|
||||
const app = express()
|
||||
const router = express.Router()
|
||||
|
||||
app.use(express.static('public'))
|
||||
app.use(express.json())
|
||||
|
||||
app.all('*', (req, res, next) => {
|
||||
app.all('*', (_, res, next) => {
|
||||
res.header('Access-Control-Allow-Origin', '*')
|
||||
res.header('Access-Control-Allow-Headers', 'Content-Type')
|
||||
res.header('Access-Control-Allow-Methods', '*')
|
||||
next()
|
||||
})
|
||||
|
||||
app.listen(3002, () => globalThis.console.log('Server is running on port 3002'))
|
||||
|
||||
app.post('/chat', async (req, res) => {
|
||||
try {
|
||||
const { prompt } = req.body as { prompt: string }
|
||||
const response = await chatReply(prompt)
|
||||
res.send(response)
|
||||
}
|
||||
catch (error) {
|
||||
res.send(error)
|
||||
}
|
||||
})
|
||||
|
||||
app.post('./chatOne', async (req, res) => {
|
||||
router.post('/chat', async (req, res) => {
|
||||
try {
|
||||
const { prompt, options = {} } = req.body as { prompt: string; options?: ChatContext }
|
||||
const response = await chatReplayOne(prompt, options)
|
||||
const response = await chatReply(prompt, options)
|
||||
res.send(response)
|
||||
}
|
||||
catch (error) {
|
||||
@@ -37,7 +26,7 @@ app.post('./chatOne', async (req, res) => {
|
||||
}
|
||||
})
|
||||
|
||||
app.post('/clear', async (req, res) => {
|
||||
const response = await clearChatContext()
|
||||
res.send(response)
|
||||
})
|
||||
app.use('', router)
|
||||
app.use('/api', router)
|
||||
|
||||
app.listen(3002, () => globalThis.console.log('Server is running on port 3002'))
|
||||
|
27
service/tsconfig.json
Normal file
27
service/tsconfig.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"lib": [
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"baseUrl": ".",
|
||||
"outDir": "build",
|
||||
"noEmit": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"build"
|
||||
],
|
||||
"include": [
|
||||
"**/*.ts"
|
||||
]
|
||||
}
|
13
service/tsup.config.ts
Normal file
13
service/tsup.config.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { defineConfig } from 'tsup'
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
outDir: 'build',
|
||||
target: 'es2020',
|
||||
format: ['cjs'],
|
||||
splitting: false,
|
||||
sourcemap: true,
|
||||
minify: false,
|
||||
shims: true,
|
||||
dts: false,
|
||||
})
|
@@ -1,14 +1,14 @@
|
||||
import type { GenericAbortSignal } from 'axios'
|
||||
import { post } from '@/utils/request'
|
||||
|
||||
export function fetchChatAPI<T = any>(prompt: string) {
|
||||
export function fetchChatAPI<T = any>(
|
||||
prompt: string,
|
||||
options?: { conversationId?: string; parentMessageId?: string },
|
||||
signal?: GenericAbortSignal,
|
||||
) {
|
||||
return post<T>({
|
||||
url: '/chat',
|
||||
data: { prompt },
|
||||
})
|
||||
}
|
||||
|
||||
export function clearConversations<T = any>() {
|
||||
return post<T>({
|
||||
url: '/clear',
|
||||
data: { prompt, options },
|
||||
signal,
|
||||
})
|
||||
}
|
||||
|
@@ -1,52 +0,0 @@
|
||||
<script setup lang='ts'>
|
||||
import { SvgIcon } from '@/components/common'
|
||||
|
||||
interface Props {
|
||||
text: string
|
||||
}
|
||||
|
||||
interface Emit {
|
||||
(e: 'click',): void
|
||||
(e: 'edit',): void
|
||||
(e: 'delete',): void
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<Emit>()
|
||||
|
||||
function handleClick(event: Event) {
|
||||
emit('click')
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
function handleEdit() {
|
||||
emit('edit')
|
||||
}
|
||||
|
||||
function handleDelete() {
|
||||
emit('delete')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a
|
||||
class="relative flex items-center gap-3 px-3 py-3 break-all rounded-md cursor-pointer bg-neutral-50 pr-14 hover:bg-neutral-100 group"
|
||||
@click="handleClick"
|
||||
>
|
||||
<span>
|
||||
<SvgIcon icon="ri:message-3-line" />
|
||||
</span>
|
||||
<div class="relative flex-1 overflow-hidden break-all text-ellipsis whitespace-nowrap max-h-5">
|
||||
<span>{{ text }}</span>
|
||||
</div>
|
||||
<div class="absolute z-10 flex visible right-1">
|
||||
<button class="p-1" @click="handleEdit">
|
||||
<SvgIcon icon="ri:edit-line" />
|
||||
</button>
|
||||
<button class="p-1" @click="handleDelete">
|
||||
<SvgIcon icon="ri:delete-bin-line" />
|
||||
</button>
|
||||
</div>
|
||||
</a>
|
||||
</template>
|
@@ -9,8 +9,14 @@ defineProps<Props>()
|
||||
|
||||
<template>
|
||||
<div class="p-2 mt-2 rounded-md" :class="[reversal ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]']">
|
||||
<span class="leading-relaxed whitespace-pre-wrap" :class="[{ 'text-red-400': error }]">
|
||||
<span v-highlight class="leading-relaxed whitespace-pre-wrap">
|
||||
<slot />
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.hljs {
|
||||
background-color: #fff0 !important;
|
||||
}
|
||||
</style>
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import Message from './Message/index.vue'
|
||||
import ListItem from './ListItem/index.vue'
|
||||
|
||||
export { Message, ListItem }
|
||||
export { Message }
|
||||
|
26
src/components/business/Chat/hooks/useChat.ts
Normal file
26
src/components/business/Chat/hooks/useChat.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { useHistoryStore } from '@/store'
|
||||
|
||||
export function useChat() {
|
||||
const historyStore = useHistoryStore()
|
||||
|
||||
function addChat(
|
||||
message: string,
|
||||
args?: { reversal?: boolean; error?: boolean; options?: Chat.ChatOptions },
|
||||
) {
|
||||
historyStore.addChat(
|
||||
{
|
||||
dateTime: new Date().toLocaleString(),
|
||||
message,
|
||||
reversal: args?.reversal ?? false,
|
||||
error: args?.error ?? false,
|
||||
options: args?.options ?? undefined,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
function clearChat() {
|
||||
historyStore.clearChat()
|
||||
}
|
||||
|
||||
return { addChat, clearChat }
|
||||
}
|
@@ -1,55 +1,41 @@
|
||||
<script setup lang='ts'>
|
||||
import { nextTick, onMounted, ref } from 'vue'
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import type { MessageReactive } from 'naive-ui'
|
||||
import { NButton, NInput, useMessage } from 'naive-ui'
|
||||
import { Message } from './components'
|
||||
import { Layout } from './layout'
|
||||
import { clearConversations, fetchChatAPI } from '@/api'
|
||||
import { useChat } from './hooks/useChat'
|
||||
import { fetchChatAPI } from '@/api'
|
||||
import { HoverButton, SvgIcon } from '@/components/common'
|
||||
import { useHistoryStore } from '@/store'
|
||||
|
||||
interface ListProps {
|
||||
dateTime: string
|
||||
message: string
|
||||
reversal?: boolean
|
||||
error?: boolean
|
||||
}
|
||||
|
||||
const scrollRef = ref<HTMLDivElement>()
|
||||
let controller = new AbortController()
|
||||
|
||||
const ms = useMessage()
|
||||
|
||||
const prompt = ref('')
|
||||
const historyStore = useHistoryStore()
|
||||
|
||||
let messageReactive: MessageReactive | null = null
|
||||
|
||||
const scrollRef = ref<HTMLDivElement>()
|
||||
|
||||
const { addChat, clearChat } = useChat()
|
||||
|
||||
const prompt = ref('')
|
||||
const loading = ref(false)
|
||||
|
||||
const list = ref<ListProps[]>([])
|
||||
const currentActive = computed(() => historyStore.active)
|
||||
const heartbeat = computed(() => historyStore.heartbeat)
|
||||
|
||||
onMounted(initChat)
|
||||
|
||||
function initChat() {
|
||||
addMessage('Hi, I am ChatGPT, a chatbot based on GPT-3.', false)
|
||||
}
|
||||
|
||||
async function handleClear() {
|
||||
try {
|
||||
const { message } = await clearConversations()
|
||||
ms.success(message ?? 'Success')
|
||||
}
|
||||
catch (error) {
|
||||
ms.error('Clear failed, please try again later.')
|
||||
list.value = []
|
||||
setTimeout(initChat, 100)
|
||||
}
|
||||
}
|
||||
|
||||
function handleEnter(event: KeyboardEvent) {
|
||||
if (event.key === 'Enter')
|
||||
handleSubmit()
|
||||
}
|
||||
const list = computed<Chat.Chat[]>(() => historyStore.getCurrentChat)
|
||||
const chatList = computed<Chat.Chat[]>(() => list.value.filter(item => (!item.reversal && !item.error)))
|
||||
|
||||
async function handleSubmit() {
|
||||
if (loading.value)
|
||||
return
|
||||
|
||||
controller = new AbortController()
|
||||
|
||||
const message = prompt.value.trim()
|
||||
|
||||
if (!message || !message.length) {
|
||||
@@ -57,26 +43,100 @@ async function handleSubmit() {
|
||||
return
|
||||
}
|
||||
|
||||
addMessage(message, true)
|
||||
addMessage(message, { reversal: true })
|
||||
prompt.value = ''
|
||||
|
||||
let options: Chat.ChatOptions = {}
|
||||
const lastContext = chatList.value[chatList.value.length - 1]?.options
|
||||
|
||||
if (lastContext)
|
||||
options = { ...lastContext }
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const { data } = await fetchChatAPI(message)
|
||||
addMessage(data?.text ?? '', false)
|
||||
createMessage()
|
||||
const { data } = await fetchChatAPI(message, options, controller.signal)
|
||||
addMessage(data?.text ?? '', { options: { conversationId: data.conversationId, parentMessageId: data.id } })
|
||||
}
|
||||
catch (error: any) {
|
||||
addMessage(`Error: ${error.message ?? 'Request failed, please try again later.'}`, false, true)
|
||||
if (error.message !== 'canceled')
|
||||
addMessage(`${error.message ?? 'Request failed, please try again later.'}`, { error: true })
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
removeMessage()
|
||||
}
|
||||
}
|
||||
|
||||
function addMessage(message: string, reversal = false, error = false) {
|
||||
list.value.push({ dateTime: new Date().toLocaleString(), message, reversal, error })
|
||||
function handleEnter(event: KeyboardEvent) {
|
||||
if (event.key === 'Enter')
|
||||
handleSubmit()
|
||||
}
|
||||
|
||||
function addMessage(
|
||||
message: string,
|
||||
args?: { reversal?: boolean; error?: boolean; options?: Chat.ChatOptions },
|
||||
) {
|
||||
addChat(message, args)
|
||||
scrollToBottom()
|
||||
}
|
||||
|
||||
function scrollToBottom() {
|
||||
nextTick(() => scrollRef.value && (scrollRef.value.scrollTop = scrollRef.value.scrollHeight))
|
||||
}
|
||||
|
||||
function handleClear() {
|
||||
handleCancel()
|
||||
clearChat()
|
||||
}
|
||||
|
||||
function handleCancel() {
|
||||
controller.abort()
|
||||
controller = new AbortController()
|
||||
loading.value = false
|
||||
removeMessage()
|
||||
}
|
||||
|
||||
function createMessage() {
|
||||
if (!messageReactive) {
|
||||
messageReactive = ms.loading('Thinking...', {
|
||||
duration: 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function removeMessage() {
|
||||
if (messageReactive) {
|
||||
messageReactive.destroy()
|
||||
messageReactive = null
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
scrollToBottom()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
handleCancel()
|
||||
})
|
||||
|
||||
watch(
|
||||
heartbeat,
|
||||
() => {
|
||||
handleCancel()
|
||||
scrollToBottom()
|
||||
},
|
||||
)
|
||||
|
||||
watch(
|
||||
currentActive,
|
||||
(_, oldActive) => {
|
||||
if (oldActive !== null) {
|
||||
handleCancel()
|
||||
scrollToBottom()
|
||||
}
|
||||
},
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -84,27 +144,31 @@ function addMessage(message: string, reversal = false, error = false) {
|
||||
<div class="flex flex-col h-full">
|
||||
<main class="flex-1 overflow-hidden">
|
||||
<div ref="scrollRef" class="h-full p-4 overflow-hidden overflow-y-auto">
|
||||
<div>
|
||||
<Message
|
||||
v-for="(item, index) of list"
|
||||
:key="index"
|
||||
:date-time="item.dateTime"
|
||||
:message="item.message"
|
||||
:reversal="item.reversal"
|
||||
:error="item.error"
|
||||
/>
|
||||
</div>
|
||||
<template v-if="!list.length">
|
||||
<div class="flex items-center justify-center mt-4 text-center text-neutral-300">
|
||||
<SvgIcon icon="ri:bubble-chart-fill" class="mr-2 text-3xl" />
|
||||
<span>Aha~</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div>
|
||||
<Message
|
||||
v-for="(item, index) of list" :key="index" :date-time="item.dateTime" :message="item.message"
|
||||
:reversal="item.reversal" :error="item.error"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</main>
|
||||
<footer class="p-4">
|
||||
<div class="flex items-center justify-between space-x-2">
|
||||
<HoverButton tooltip="Clear conversations" @click="handleClear">
|
||||
<span class="text-xl text-[#4f555e]">
|
||||
<HoverButton tooltip="Clear conversations">
|
||||
<span class="text-xl text-[#4f555e]" @click="handleClear">
|
||||
<SvgIcon icon="ri:delete-bin-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
<NInput v-model:value="prompt" placeholder="Type a message..." @keypress="handleEnter" />
|
||||
<NButton type="primary" :loading="loading" @click="handleSubmit">
|
||||
<NButton type="primary" :disabled="loading" @click="handleSubmit">
|
||||
<template #icon>
|
||||
<SvgIcon icon="ri:send-plane-fill" />
|
||||
</template>
|
||||
|
@@ -1,19 +1,42 @@
|
||||
<script setup lang='ts'>
|
||||
import { computed } from 'vue'
|
||||
import { NLayout, NLayoutContent } from 'naive-ui'
|
||||
import Sider from './sider/index.vue'
|
||||
import Header from './header/index.vue'
|
||||
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
||||
import { useAppStore } from '@/store'
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
const { isMobile } = useBasicLayout()
|
||||
|
||||
const collapsed = computed(() => appStore.siderCollapsed)
|
||||
|
||||
const getMobileClass = computed(() => {
|
||||
if (isMobile.value)
|
||||
return ['rounded-none', 'shadow-none']
|
||||
return ['border', 'rounded-md', 'shadow-md']
|
||||
})
|
||||
|
||||
const getContainerClass = computed(() => {
|
||||
return [
|
||||
'h-full',
|
||||
{ 'pt-14': isMobile.value },
|
||||
{ 'pl-[260px]': !isMobile.value && !collapsed.value },
|
||||
]
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="h-full overflow-hidden border rounded-md shadow-md min-w-[640px]">
|
||||
<NLayout class="h-full" has-sider>
|
||||
<Sider />
|
||||
<NLayoutContent class="h-full">
|
||||
<slot />
|
||||
</NLayoutContent>
|
||||
</NLayout>
|
||||
<div class="h-screen p-4" :class="[{ 'p-0': isMobile }]">
|
||||
<div class="h-full overflow-hidden" :class="getMobileClass">
|
||||
<NLayout class="z-40 transition" :class="getContainerClass" has-sider>
|
||||
<Sider />
|
||||
<Header v-if="isMobile" />
|
||||
<NLayoutContent class="h-full">
|
||||
<slot />
|
||||
</NLayoutContent>
|
||||
</NLayout>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
36
src/components/business/Chat/layout/header/index.vue
Normal file
36
src/components/business/Chat/layout/header/index.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { SvgIcon } from '@/components/common'
|
||||
import { useAppStore, useHistoryStore } from '@/store'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const historyStore = useHistoryStore()
|
||||
|
||||
const collapsed = computed(() => appStore.siderCollapsed)
|
||||
|
||||
function handleAdd() {
|
||||
historyStore.addHistory({
|
||||
title: 'New Chat',
|
||||
isEdit: false,
|
||||
data: [],
|
||||
})
|
||||
}
|
||||
|
||||
function handleUpdateCollapsed() {
|
||||
appStore.setSiderCollapsed(!collapsed.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="fixed top-0 left-0 right-0 z-50 border-b bg-white/80 backdrop-blur">
|
||||
<div class="relative flex items-center justify-between px-4 h-14">
|
||||
<button class="flex items-center justify-center w-11 h-11" @click="handleUpdateCollapsed">
|
||||
<SvgIcon v-if="collapsed" class="text-2xl" icon="ri:align-justify" />
|
||||
<SvgIcon v-else class="text-2xl" icon="ri:align-right" />
|
||||
</button>
|
||||
<button class="flex items-center justify-center w-11 h-11" @click="handleAdd">
|
||||
<SvgIcon class="text-2xl" icon="ri:add-fill" />
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
@@ -1,15 +0,0 @@
|
||||
<script setup lang='ts'>
|
||||
import { HoverButton, SvgIcon, UserAvatar } from '@/components/common'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<footer class="flex items-center justify-between p-4 overflow-hidden border-t">
|
||||
<UserAvatar />
|
||||
|
||||
<HoverButton tooltip="Setting">
|
||||
<span class="text-xl text-[#4f555e]">
|
||||
<SvgIcon icon="ri:settings-4-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
</footer>
|
||||
</template>
|
@@ -1,14 +1,79 @@
|
||||
<script setup lang='ts'>
|
||||
import { NScrollbar } from 'naive-ui'
|
||||
import ListItem from './ListItem.vue'
|
||||
import { ref } from 'vue'
|
||||
import { NInput, NScrollbar } from 'naive-ui'
|
||||
import { SvgIcon } from '@/components/common'
|
||||
import { useHistoryStore } from '@/store'
|
||||
|
||||
const historyStore = useHistoryStore()
|
||||
|
||||
const dataSources = ref(historyStore.historyChat)
|
||||
|
||||
function handleSelect(index: number) {
|
||||
historyStore.chooseHistory(index)
|
||||
}
|
||||
|
||||
function handleEdit(index: number, isEdit: boolean, event?: MouseEvent) {
|
||||
historyStore.editHistory(index, isEdit)
|
||||
event?.stopPropagation()
|
||||
}
|
||||
|
||||
function handleRemove(index: number, event?: MouseEvent) {
|
||||
historyStore.removeHistory(index)
|
||||
event?.stopPropagation()
|
||||
}
|
||||
|
||||
function handleEnter(index: number, isEdit: boolean, event: KeyboardEvent) {
|
||||
if (event.key === 'Enter') {
|
||||
handleEdit(index, isEdit)
|
||||
event.stopPropagation()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NScrollbar class="px-4">
|
||||
<div class="flex flex-col gap-2 text-sm">
|
||||
<ListItem text="Learning correlation" />
|
||||
<ListItem text="Write Code" />
|
||||
<ListItem text="docs..." />
|
||||
<template v-if="!dataSources.length">
|
||||
<div class="flex flex-col items-center mt-4 text-center text-neutral-300">
|
||||
<SvgIcon icon="ri:inbox-line" class="mb-2 text-3xl" />
|
||||
<span>No history</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-for="(item, index) of dataSources" :key="index">
|
||||
<a
|
||||
class="relative flex items-center gap-3 px-3 py-3 break-all border rounded-md cursor-pointer hover:bg-neutral-100 group"
|
||||
:class="historyStore.active === index && ['border-[#4b9e5f]', 'bg-neutral-100', 'text-[#4b9e5f]', 'pr-14']"
|
||||
@click="handleSelect(index)"
|
||||
>
|
||||
<span>
|
||||
<SvgIcon icon="ri:message-3-line" />
|
||||
</span>
|
||||
<div class="relative flex-1 overflow-hidden break-all text-ellipsis whitespace-nowrap">
|
||||
<NInput
|
||||
v-if="item.isEdit" v-model:value="item.title" size="tiny"
|
||||
@keypress="handleEnter(index, false, $event)"
|
||||
/>
|
||||
<span v-else>{{ item.title }}</span>
|
||||
</div>
|
||||
<div v-if="historyStore.active === index" class="absolute z-10 flex visible right-1">
|
||||
<template v-if="item.isEdit">
|
||||
<button class="p-1" @click="handleEdit(index, false, $event)">
|
||||
<SvgIcon icon="ri:save-line" />
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button class="p-1">
|
||||
<SvgIcon icon="ri:edit-line" @click="handleEdit(index, true, $event)" />
|
||||
</button>
|
||||
<button class="p-1" @click="handleRemove(index, $event)">
|
||||
<SvgIcon icon="ri:delete-bin-line" />
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</NScrollbar>
|
||||
</template>
|
||||
|
@@ -1,52 +0,0 @@
|
||||
<script setup lang='ts'>
|
||||
import { SvgIcon } from '@/components/common'
|
||||
|
||||
interface Props {
|
||||
text: string
|
||||
}
|
||||
|
||||
interface Emit {
|
||||
(e: 'click',): void
|
||||
(e: 'edit',): void
|
||||
(e: 'delete',): void
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<Emit>()
|
||||
|
||||
function handleClick(event: Event) {
|
||||
emit('click')
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
function handleEdit() {
|
||||
emit('edit')
|
||||
}
|
||||
|
||||
function handleDelete() {
|
||||
emit('delete')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a
|
||||
class="relative flex items-center gap-3 px-3 py-3 break-all rounded-md cursor-pointer bg-neutral-50 pr-14 hover:bg-neutral-100 group"
|
||||
@click="handleClick"
|
||||
>
|
||||
<span>
|
||||
<SvgIcon icon="ri:message-3-line" />
|
||||
</span>
|
||||
<div class="relative flex-1 overflow-hidden break-all text-ellipsis whitespace-nowrap max-h-5">
|
||||
<span>{{ text }}</span>
|
||||
</div>
|
||||
<div class="absolute z-10 flex visible right-1">
|
||||
<button class="p-1" @click="handleEdit">
|
||||
<SvgIcon icon="ri:edit-line" />
|
||||
</button>
|
||||
<button class="p-1" @click="handleDelete">
|
||||
<SvgIcon icon="ri:delete-bin-line" />
|
||||
</button>
|
||||
</div>
|
||||
</a>
|
||||
</template>
|
@@ -1,43 +1,36 @@
|
||||
<script setup lang='ts'>
|
||||
import { ref, watch } from 'vue'
|
||||
import { NButton, NLayoutSider, useMessage } from 'naive-ui'
|
||||
import { computed, watch } from 'vue'
|
||||
import { NButton, NLayoutSider } from 'naive-ui'
|
||||
import List from './List.vue'
|
||||
import Footer from './Footer.vue'
|
||||
import { HoverButton, SvgIcon, UserAvatar } from '@/components/common'
|
||||
import { useAppStore, useHistoryStore } from '@/store'
|
||||
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
||||
|
||||
interface Props {
|
||||
collapsed?: boolean
|
||||
}
|
||||
const appStore = useAppStore()
|
||||
const historyStore = useHistoryStore()
|
||||
const { isMobile } = useBasicLayout()
|
||||
|
||||
interface Emit {
|
||||
(e: 'update:collapsed', value: boolean): void
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
collapsed: false,
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emit>()
|
||||
|
||||
const ms = useMessage()
|
||||
|
||||
const collapsed = ref(props.collapsed)
|
||||
|
||||
watch(
|
||||
() => props.collapsed,
|
||||
(value: boolean) => {
|
||||
collapsed.value = value
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
const collapsed = computed(() => appStore.siderCollapsed)
|
||||
|
||||
function handleAdd() {
|
||||
ms.info('Coming soon...')
|
||||
historyStore.addHistory({
|
||||
title: 'New Chat',
|
||||
isEdit: false,
|
||||
data: [],
|
||||
})
|
||||
}
|
||||
|
||||
function handleCollapsed() {
|
||||
collapsed.value = !collapsed.value
|
||||
emit('update:collapsed', collapsed.value)
|
||||
function handleUpdateCollapsed() {
|
||||
appStore.setSiderCollapsed(!collapsed.value)
|
||||
}
|
||||
|
||||
watch(
|
||||
isMobile,
|
||||
(val) => {
|
||||
appStore.setSiderCollapsed(val)
|
||||
},
|
||||
{ flush: 'post' },
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -45,12 +38,13 @@ function handleCollapsed() {
|
||||
:collapsed="collapsed"
|
||||
:collapsed-width="0"
|
||||
:width="260"
|
||||
collapse-mode="width"
|
||||
show-trigger="arrow-circle"
|
||||
:show-trigger="isMobile ? false : 'arrow-circle'"
|
||||
collapse-mode="transform"
|
||||
position="absolute"
|
||||
bordered
|
||||
@update:collapsed="handleCollapsed"
|
||||
@update-collapsed="handleUpdateCollapsed"
|
||||
>
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex flex-col h-full" :class="[{ 'pt-14': isMobile }]">
|
||||
<main class="flex-1 min-h-0 overflow-hidden">
|
||||
<div class="p-4">
|
||||
<NButton dashed block @click="handleAdd">
|
||||
@@ -59,7 +53,14 @@ function handleCollapsed() {
|
||||
</div>
|
||||
<List />
|
||||
</main>
|
||||
<Footer />
|
||||
<footer class="flex items-center justify-between min-w-0 p-4 overflow-hidden border-t h-[70px]">
|
||||
<UserAvatar />
|
||||
<HoverButton tooltip="Setting">
|
||||
<span class="text-xl text-[#4f555e]">
|
||||
<SvgIcon icon="ri:settings-4-line" />
|
||||
</span>
|
||||
</HoverButton>
|
||||
</footer>
|
||||
</div>
|
||||
</NLayoutSider>
|
||||
</template>
|
||||
|
@@ -17,7 +17,3 @@ import { GithubSite } from '@/components/custom'
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
15
src/directives/highlight.ts
Normal file
15
src/directives/highlight.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { App, Directive } from 'vue'
|
||||
import hljs from 'highlight.js'
|
||||
|
||||
const regexp = /^(?:\s{4}|\t).+/gm
|
||||
|
||||
export default function setupHighlightDirective(app: App) {
|
||||
const highLightDirective: Directive<HTMLElement> = {
|
||||
mounted(el: HTMLElement) {
|
||||
if (el.textContent?.indexOf(' = ') !== -1 || el.textContent.match(regexp))
|
||||
hljs.highlightBlock(el)
|
||||
},
|
||||
}
|
||||
|
||||
app.directive('highlight', highLightDirective)
|
||||
}
|
6
src/directives/index.ts
Normal file
6
src/directives/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { App } from 'vue'
|
||||
import setupHighlightDirective from './highlight'
|
||||
|
||||
export function setupDirectives(app: App) {
|
||||
setupHighlightDirective(app)
|
||||
}
|
8
src/hooks/useBasicLayout.ts
Normal file
8
src/hooks/useBasicLayout.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
|
||||
|
||||
export function useBasicLayout() {
|
||||
const breakpoints = useBreakpoints(breakpointsTailwind)
|
||||
const isMobile = breakpoints.smaller('sm')
|
||||
|
||||
return { isMobile }
|
||||
}
|
21
src/main.ts
21
src/main.ts
@@ -1,21 +1,20 @@
|
||||
import './styles/global.css'
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import { setupDirectives } from './directives'
|
||||
import { setupAssets } from '@/plugins'
|
||||
import { setupStore } from '@/store'
|
||||
import { setupRouter } from '@/router'
|
||||
|
||||
/** Tailwind's Preflight Style Override */
|
||||
function naiveStyleOverride() {
|
||||
const meta = document.createElement('meta')
|
||||
meta.name = 'naive-ui-style'
|
||||
document.head.appendChild(meta)
|
||||
}
|
||||
|
||||
/** Setup */
|
||||
async function bootstrap() {
|
||||
const app = createApp(App)
|
||||
naiveStyleOverride()
|
||||
setupAssets()
|
||||
|
||||
setupStore(app)
|
||||
|
||||
setupDirectives(app)
|
||||
|
||||
await setupRouter(app)
|
||||
|
||||
app.mount('#app')
|
||||
}
|
||||
|
||||
|
15
src/plugins/assets.ts
Normal file
15
src/plugins/assets.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'highlight.js/styles/xcode.css'
|
||||
import '@/styles/global.css'
|
||||
|
||||
/** Tailwind's Preflight Style Override */
|
||||
function naiveStyleOverride() {
|
||||
const meta = document.createElement('meta')
|
||||
meta.name = 'naive-ui-style'
|
||||
document.head.appendChild(meta)
|
||||
}
|
||||
|
||||
function setupAssets() {
|
||||
naiveStyleOverride()
|
||||
}
|
||||
|
||||
export default setupAssets
|
3
src/plugins/index.ts
Normal file
3
src/plugins/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import setupAssets from './assets'
|
||||
|
||||
export { setupAssets }
|
@@ -1,6 +1,6 @@
|
||||
import type { App } from 'vue'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
@@ -11,7 +11,7 @@ const routes: RouteRecordRaw[] = [
|
||||
]
|
||||
|
||||
export const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
})
|
||||
|
9
src/store/index.ts
Normal file
9
src/store/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { App } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
export function setupStore(app: App) {
|
||||
const store = createPinia()
|
||||
app.use(store)
|
||||
}
|
||||
|
||||
export * from './modules'
|
20
src/store/modules/app/helper.ts
Normal file
20
src/store/modules/app/helper.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ss } from '@/utils/storage'
|
||||
|
||||
const LOCAL_NAME = 'appSetting'
|
||||
|
||||
export interface AppState {
|
||||
siderCollapsed: boolean
|
||||
}
|
||||
|
||||
export function defaultSetting() {
|
||||
return { siderCollapsed: false }
|
||||
}
|
||||
|
||||
export function getLocalSetting() {
|
||||
const localSetting: AppState | undefined = ss.get(LOCAL_NAME)
|
||||
return localSetting ?? defaultSetting()
|
||||
}
|
||||
|
||||
export function setLocalSetting(setting: AppState) {
|
||||
ss.set(LOCAL_NAME, setting)
|
||||
}
|
13
src/store/modules/app/index.ts
Normal file
13
src/store/modules/app/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import type { AppState } from './helper'
|
||||
import { getLocalSetting, setLocalSetting } from './helper'
|
||||
|
||||
export const useAppStore = defineStore('app-store', {
|
||||
state: (): AppState => getLocalSetting(),
|
||||
actions: {
|
||||
setSiderCollapsed(collapsed: boolean) {
|
||||
this.siderCollapsed = collapsed
|
||||
setLocalSetting(this.$state)
|
||||
},
|
||||
},
|
||||
})
|
22
src/store/modules/history/helper.ts
Normal file
22
src/store/modules/history/helper.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { ss } from '@/utils/storage'
|
||||
|
||||
const LOCAL_NAME = 'historyChat'
|
||||
|
||||
export interface HistoryState {
|
||||
historyChat: Chat.HistoryChat[]
|
||||
active: number | null
|
||||
heartbeat: boolean
|
||||
}
|
||||
|
||||
export function defaultSetting() {
|
||||
return { historyChat: [], active: null, heartbeat: false }
|
||||
}
|
||||
|
||||
export function getLocalHistory() {
|
||||
const localSetting: HistoryState | undefined = ss.get(LOCAL_NAME)
|
||||
return localSetting ?? defaultSetting()
|
||||
}
|
||||
|
||||
export function setLocalHistory(data: HistoryState) {
|
||||
ss.set(LOCAL_NAME, data)
|
||||
}
|
83
src/store/modules/history/index.ts
Normal file
83
src/store/modules/history/index.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import type { HistoryState } from './helper'
|
||||
import { getLocalHistory, setLocalHistory } from './helper'
|
||||
|
||||
export const useHistoryStore = defineStore('history-store', {
|
||||
state: (): HistoryState => getLocalHistory(),
|
||||
getters: {
|
||||
getCurrentHistory(state): Chat.HistoryChat {
|
||||
if (state.historyChat.length) {
|
||||
if (state.active === null || state.active >= state.historyChat.length || state.active < 0)
|
||||
state.active = 0
|
||||
return state.historyChat[state.active] ?? { title: '', isEdit: false, data: [] }
|
||||
}
|
||||
state.active = null
|
||||
return { title: '', isEdit: false, data: [] }
|
||||
},
|
||||
getCurrentChat(): Chat.Chat[] {
|
||||
return this.getCurrentHistory.data ?? []
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
addChat(data: Chat.Chat) {
|
||||
if (this.active === null) {
|
||||
this.historyChat.push({ title: data.message, isEdit: false, data: [data] })
|
||||
this.active = this.historyChat.length - 1
|
||||
}
|
||||
else {
|
||||
if (this.historyChat[this.active].title === 'New Chat')
|
||||
this.historyChat[this.active].title = data.message
|
||||
|
||||
this.historyChat[this.active].data.push(data)
|
||||
}
|
||||
setLocalHistory(this.$state)
|
||||
},
|
||||
|
||||
clearChat() {
|
||||
if (this.active !== null) {
|
||||
this.historyChat[this.active].data = []
|
||||
setLocalHistory(this.$state)
|
||||
}
|
||||
},
|
||||
|
||||
addHistory(data: Chat.HistoryChat) {
|
||||
this.historyChat.push(data)
|
||||
this.active = this.historyChat.length - 1
|
||||
setLocalHistory(this.$state)
|
||||
},
|
||||
|
||||
editHistory(index: number, isEdit: boolean) {
|
||||
this.historyChat[index].isEdit = isEdit
|
||||
setLocalHistory(this.$state)
|
||||
},
|
||||
|
||||
removeHistory(index: number) {
|
||||
this.historyChat.splice(index, 1)
|
||||
|
||||
if (this.active === index) {
|
||||
if (this.historyChat.length === 0)
|
||||
this.active = null
|
||||
else if (this.active === this.historyChat.length)
|
||||
this.active = this.historyChat.length - 1
|
||||
}
|
||||
|
||||
if (this.historyChat.length === 0)
|
||||
this.active = null
|
||||
|
||||
this.toggleHeartbeat()
|
||||
|
||||
setLocalHistory(this.$state)
|
||||
},
|
||||
|
||||
chooseHistory(index: number) {
|
||||
if (this.active === index)
|
||||
return
|
||||
this.active = index
|
||||
setLocalHistory(this.$state)
|
||||
},
|
||||
|
||||
toggleHeartbeat() {
|
||||
this.heartbeat = !this.heartbeat
|
||||
},
|
||||
},
|
||||
})
|
2
src/store/modules/index.ts
Normal file
2
src/store/modules/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './app'
|
||||
export * from './history'
|
20
src/typings/chat.d.ts
vendored
Normal file
20
src/typings/chat.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
declare namespace Chat{
|
||||
interface ChatOptions {
|
||||
conversationId?: string
|
||||
parentMessageId?: string
|
||||
}
|
||||
|
||||
interface Chat {
|
||||
dateTime: string
|
||||
message: string
|
||||
reversal?: boolean
|
||||
error?: boolean
|
||||
options?: ChatOptions
|
||||
}
|
||||
|
||||
interface HistoryChat {
|
||||
title: string
|
||||
isEdit: boolean
|
||||
data: Chat[]
|
||||
}
|
||||
}
|
2
src/typings/env.d.ts
vendored
2
src/typings/env.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
/** api url */
|
||||
readonly VITE_GLOB_API_URL: string;
|
||||
readonly VITE_APP_API_BASE_URL: string;
|
||||
}
|
||||
|
18
src/utils/crypto/index.ts
Normal file
18
src/utils/crypto/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import CryptoJS from 'crypto-js'
|
||||
|
||||
const CryptoSecret = '__CRYPTO_SECRET__'
|
||||
|
||||
export function enCrypto(data: any) {
|
||||
const str = JSON.stringify(data)
|
||||
return CryptoJS.AES.encrypt(str, CryptoSecret).toString()
|
||||
}
|
||||
|
||||
export function deCrypto(data: string) {
|
||||
const bytes = CryptoJS.AES.decrypt(data, CryptoSecret)
|
||||
const str = bytes.toString(CryptoJS.enc.Utf8)
|
||||
|
||||
if (str)
|
||||
return JSON.parse(str)
|
||||
|
||||
return null
|
||||
}
|
55
src/utils/is/index.ts
Normal file
55
src/utils/is/index.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
export function isNumber<T extends number>(value: T | unknown): value is number {
|
||||
return Object.prototype.toString.call(value) === '[object Number]'
|
||||
}
|
||||
|
||||
export function isString<T extends string>(value: T | unknown): value is string {
|
||||
return Object.prototype.toString.call(value) === '[object String]'
|
||||
}
|
||||
|
||||
export function isBoolean<T extends boolean>(value: T | unknown): value is boolean {
|
||||
return Object.prototype.toString.call(value) === '[object Boolean]'
|
||||
}
|
||||
|
||||
export function isNull<T extends null>(value: T | unknown): value is null {
|
||||
return Object.prototype.toString.call(value) === '[object Null]'
|
||||
}
|
||||
|
||||
export function isUndefined<T extends undefined>(value: T | unknown): value is undefined {
|
||||
return Object.prototype.toString.call(value) === '[object Undefined]'
|
||||
}
|
||||
|
||||
export function isObject<T extends object>(value: T | unknown): value is object {
|
||||
return Object.prototype.toString.call(value) === '[object Object]'
|
||||
}
|
||||
|
||||
export function isArray<T extends any[]>(value: T | unknown): value is T {
|
||||
return Object.prototype.toString.call(value) === '[object Array]'
|
||||
}
|
||||
|
||||
export function isFunction<T extends (...args: any[]) => any | void | never>(value: T | unknown): value is T {
|
||||
return Object.prototype.toString.call(value) === '[object Function]'
|
||||
}
|
||||
|
||||
export function isDate<T extends Date>(value: T | unknown): value is T {
|
||||
return Object.prototype.toString.call(value) === '[object Date]'
|
||||
}
|
||||
|
||||
export function isRegExp<T extends RegExp>(value: T | unknown): value is T {
|
||||
return Object.prototype.toString.call(value) === '[object RegExp]'
|
||||
}
|
||||
|
||||
export function isPromise<T extends Promise<any>>(value: T | unknown): value is T {
|
||||
return Object.prototype.toString.call(value) === '[object Promise]'
|
||||
}
|
||||
|
||||
export function isSet<T extends Set<any>>(value: T | unknown): value is T {
|
||||
return Object.prototype.toString.call(value) === '[object Set]'
|
||||
}
|
||||
|
||||
export function isMap<T extends Map<any, any>>(value: T | unknown): value is T {
|
||||
return Object.prototype.toString.call(value) === '[object Map]'
|
||||
}
|
||||
|
||||
export function isFile<T extends File>(value: T | unknown): value is T {
|
||||
return Object.prototype.toString.call(value) === '[object File]'
|
||||
}
|
@@ -2,7 +2,7 @@ import axios, { type AxiosResponse } from 'axios'
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: import.meta.env.VITE_GLOB_API_URL,
|
||||
timeout: 10 * 1000,
|
||||
timeout: 30 * 1000,
|
||||
})
|
||||
|
||||
service.interceptors.request.use(
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import type { AxiosResponse } from 'axios'
|
||||
import type { AxiosResponse, GenericAbortSignal } from 'axios'
|
||||
import request from './axios'
|
||||
|
||||
export interface HttpOption {
|
||||
@@ -6,21 +6,18 @@ export interface HttpOption {
|
||||
data?: any
|
||||
method?: string
|
||||
headers?: any
|
||||
signal?: GenericAbortSignal
|
||||
beforeRequest?: () => void
|
||||
afterRequest?: () => void
|
||||
}
|
||||
|
||||
export interface ExtraOption {
|
||||
notification?: boolean
|
||||
}
|
||||
|
||||
export interface Response<T = any> {
|
||||
data: T
|
||||
message: string | null
|
||||
status: string
|
||||
}
|
||||
|
||||
function http<T = any>({ url, data, method, headers, beforeRequest, afterRequest }: HttpOption) {
|
||||
function http<T = any>({ url, data, method, headers, signal, beforeRequest, afterRequest }: HttpOption) {
|
||||
const successHandler = (res: AxiosResponse<Response<T>>) => {
|
||||
if (res.data.status === 'Success')
|
||||
return res.data
|
||||
@@ -40,30 +37,32 @@ function http<T = any>({ url, data, method, headers, beforeRequest, afterRequest
|
||||
const params = Object.assign(typeof data === 'function' ? data() : data ?? {}, {})
|
||||
|
||||
return method === 'GET'
|
||||
? request.get(url, { params }).then(successHandler, failHandler)
|
||||
: request.post(url, params, { headers }).then(successHandler, failHandler)
|
||||
? request.get(url, { params, signal }).then(successHandler, failHandler)
|
||||
: request.post(url, params, { headers, signal }).then(successHandler, failHandler)
|
||||
}
|
||||
|
||||
export function get<T = any>(
|
||||
{ url, data, method = 'GET', beforeRequest, afterRequest }: HttpOption,
|
||||
{ url, data, method = 'GET', signal, beforeRequest, afterRequest }: HttpOption,
|
||||
): Promise<Response<T>> {
|
||||
return http<T>({
|
||||
url,
|
||||
method,
|
||||
data,
|
||||
signal,
|
||||
beforeRequest,
|
||||
afterRequest,
|
||||
})
|
||||
}
|
||||
|
||||
export function post<T = any>(
|
||||
{ url, data, method = 'POST', headers, beforeRequest, afterRequest }: HttpOption,
|
||||
{ url, data, method = 'POST', headers, signal, beforeRequest, afterRequest }: HttpOption,
|
||||
): Promise<Response<T>> {
|
||||
return http<T>({
|
||||
url,
|
||||
method,
|
||||
data,
|
||||
headers,
|
||||
signal,
|
||||
beforeRequest,
|
||||
afterRequest,
|
||||
})
|
||||
|
1
src/utils/storage/index.ts
Normal file
1
src/utils/storage/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './local'
|
70
src/utils/storage/local.ts
Normal file
70
src/utils/storage/local.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { deCrypto, enCrypto } from '../crypto'
|
||||
|
||||
interface StorageData<T = any> {
|
||||
data: T
|
||||
expire: number | null
|
||||
}
|
||||
|
||||
export function createLocalStorage(options?: { expire?: number | null; crypto?: boolean }) {
|
||||
const DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7
|
||||
|
||||
const { expire, crypto } = Object.assign(
|
||||
{
|
||||
expire: DEFAULT_CACHE_TIME,
|
||||
crypto: true,
|
||||
},
|
||||
options,
|
||||
)
|
||||
|
||||
function set<T = any>(key: string, data: T) {
|
||||
const storageData: StorageData<T> = {
|
||||
data,
|
||||
expire: expire !== null ? new Date().getTime() + expire * 1000 : null,
|
||||
}
|
||||
|
||||
const json = crypto ? enCrypto(storageData) : JSON.stringify(storageData)
|
||||
window.localStorage.setItem(key, json)
|
||||
}
|
||||
|
||||
function get(key: string) {
|
||||
const json = window.localStorage.getItem(key)
|
||||
if (json) {
|
||||
let storageData: StorageData | null = null
|
||||
|
||||
try {
|
||||
storageData = crypto ? deCrypto(json) : JSON.parse(json)
|
||||
}
|
||||
catch {
|
||||
// Prevent failure
|
||||
}
|
||||
|
||||
if (storageData) {
|
||||
const { data, expire } = storageData
|
||||
if (expire === null || expire >= Date.now())
|
||||
return data
|
||||
}
|
||||
|
||||
remove(key)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function remove(key: string) {
|
||||
window.localStorage.removeItem(key)
|
||||
}
|
||||
|
||||
function clear() {
|
||||
window.localStorage.clear()
|
||||
}
|
||||
|
||||
return {
|
||||
set,
|
||||
get,
|
||||
remove,
|
||||
clear,
|
||||
}
|
||||
}
|
||||
|
||||
export const ls = createLocalStorage()
|
||||
|
||||
export const ss = createLocalStorage({ expire: null, crypto: false })
|
@@ -3,11 +3,5 @@ import { Chat } from '@/components/business'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="h-full p-4 overflow-hidden">
|
||||
<Chat />
|
||||
</div>
|
||||
<Chat />
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
11
start.sh
Normal file
11
start.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
cd ./service
|
||||
nohup pnpm start > service.log &
|
||||
echo "Start service complete!"
|
||||
|
||||
|
||||
cd ..
|
||||
echo "" > front.log
|
||||
nohup pnpm dev > front.log &
|
||||
echo "Start front complete!"
|
||||
tail -f front.log
|
@@ -16,7 +16,8 @@
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
"types": ["vite/client", "node", "naive-ui/volar"]
|
||||
// @vueuse/core 不能通过 vue-tsc 检查,所以这里需要忽略,以后将移除
|
||||
"types": ["vite/client", "node", "naive-ui/volar", "web-bluetooth"]
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
"exclude": ["node_modules", "dist", "service"]
|
||||
}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import path from 'path'
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig(() => {
|
||||
export default defineConfig((env) => {
|
||||
const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv
|
||||
|
||||
return {
|
||||
resolve: {
|
||||
alias: {
|
||||
@@ -14,6 +16,13 @@ export default defineConfig(() => {
|
||||
port: 1002,
|
||||
host: '0.0.0.0',
|
||||
open: false,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: viteEnv.VITE_APP_API_BASE_URL,
|
||||
changeOrigin: true, // 允许跨域
|
||||
rewrite: path => path.replace('/api/', '/'),
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
reportCompressedSize: false,
|
||||
|
Reference in New Issue
Block a user