增加rag服务
This commit is contained in:
@@ -12,6 +12,7 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.local
|
*.local
|
||||||
|
*.bak
|
||||||
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
|||||||
@@ -257,3 +257,51 @@ server {
|
|||||||
- **自动导入插件 DTS 生成已关闭**:组件类型声明已预生成。如需添加新组件,临时开启 `vite.config.ts` 中 AutoImport/Components 的 `dts` 选项,运行一次开发服务器后重新关闭。
|
- **自动导入插件 DTS 生成已关闭**:组件类型声明已预生成。如需添加新组件,临时开启 `vite.config.ts` 中 AutoImport/Components 的 `dts` 选项,运行一次开发服务器后重新关闭。
|
||||||
- **Node 20.6.0 不可用**:该版本存在已知问题,请使用其他 18+ 版本。
|
- **Node 20.6.0 不可用**:该版本存在已知问题,请使用其他 18+ 版本。
|
||||||
- **IDE 爆红**:如遇组件、函数或引用标红,尝试重启 VSCode 或重新执行 `pnpm install`。
|
- **IDE 爆红**:如遇组件、函数或引用标红,尝试重启 VSCode 或重新执行 `pnpm install`。
|
||||||
|
|
||||||
|
## RAG 智能问答管理
|
||||||
|
|
||||||
|
前端集成了 RAG 知识库管理和问答审核功能。
|
||||||
|
|
||||||
|
### 管理页面
|
||||||
|
|
||||||
|
| 页面 | 路径 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| 知识库管理 | `/website/rag` | 上传/删除文档,查看统计信息 |
|
||||||
|
| 问答管理 | `/website/question` | 审核 AI 回答,入库/移出问题库 |
|
||||||
|
| 帮助中心 | `/helper` | 面向用户的 Q&A 展示页面 |
|
||||||
|
|
||||||
|
### 知识库管理 (rag/index.vue)
|
||||||
|
|
||||||
|
- 上传文档:支持 `.txt`、`.md` 格式,单文件 ≤ 50MB,单选
|
||||||
|
- 文件分类:上传时选择「手册」或「FAQ」(category=0/1,FAQ 走 `/py/rag/addQAF`)
|
||||||
|
- 选择帮助类型(PC端/Android/iOS/专业版)
|
||||||
|
- 文件列表:文件名、分类(FAQ/手册标签)、帮助类型、上传时间、分块数、删除操作
|
||||||
|
- 上传进度条 + 实时状态显示(XHR 直传)
|
||||||
|
|
||||||
|
### 问答管理 (question/index.vue)
|
||||||
|
|
||||||
|
- 分页表格:编号、用户、问题、回复、软件类型、版本、状态、置信度、已入库、提交/处理时间
|
||||||
|
- 搜索筛选:按用户ID、软件类型、状态
|
||||||
|
- 批量操作:不处理(state=3)、无效(state=5)、加入问题库(embedded=1)、移出问题库(embedded=0)
|
||||||
|
- 编辑抽屉:修改问题/回复/软件类型/状态
|
||||||
|
- 状态值:0=未查阅、1=已查阅、2=待处理、3=不处理、4=已处理、5=无效、6=公开
|
||||||
|
|
||||||
|
### 帮助中心 (helper/index.vue)
|
||||||
|
|
||||||
|
- 左侧菜单:「唱作软件帮助」(4 个软件,`HelpAPI.listQnA(id)` 加载 QA 列表)+「唱作网帮助」(5 个静态页面)
|
||||||
|
- 网站帮助:iframe 加载 `public/html/*.html`(coin/vip/user/privacy/contact)
|
||||||
|
- 路由参数:`/helper?id=:id`(软件帮助)、`/helper?page=:page`(网站帮助)
|
||||||
|
|
||||||
|
### API 模块
|
||||||
|
|
||||||
|
| 文件 | 说明 |
|
||||||
|
|------|------|
|
||||||
|
| `src/api/rag.ts` | 知识库 API:上传(含 category 分类)、统计、文件列表、删除 |
|
||||||
|
| `src/api/helper.ts` | 问答 API:列表、分页、编辑、状态设置、向量同步 |
|
||||||
|
|
||||||
|
### 向量库操作
|
||||||
|
|
||||||
|
"加入问题库" / "移出问题库" 通过 `HelperAPI.updateVector(ids, embedded)` 调用:
|
||||||
|
- `embedded=1`:将选中问题加入 Question Vector Index(仅 state=4/6 的问题)
|
||||||
|
- `embedded=0`:从 Question Vector Index 移除选中问题
|
||||||
|
- 前端预过滤:仅处理当前 embedded 状态与目标状态不同的记录
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
import { defineMock } from "./base";
|
|
||||||
|
|
||||||
export default defineMock([
|
|
||||||
{
|
|
||||||
url: "auth/captcha",
|
|
||||||
method: ["GET"],
|
|
||||||
body: {
|
|
||||||
code: "00000",
|
|
||||||
data: {
|
|
||||||
captchaKey: "534b8ef2b0a24121bec76391ddd159f9",
|
|
||||||
captchaBase64:
|
|
||||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAkCAIAAADNSmkJAAAFKUlEQVR4Xu2ZXUwcVRiGV70wMWo08V5NvPXCrDbFaGpMaZW2hqQxaoiJTRsaMBCNSYtpa2JTKiFSelFa+Q/QZcMWqEhBlh+htbEpZhMrBQrlJ0hBywLLyrJ0WZbje3bqOvPNLHPWrDvdOE9ONmfe78zkzMs335wzWJhJQrBQweS/wTQ6QWgYHdoIOcecOe05O+t2WkutO+p2ZF3Ksg/YV9ZW6FATYajR3nveg60H9327r3O8c35lHgp+r05dPdJzBL73TPSQ8SaCKIxGLsPlop+K0JHrEkPuoT31e5qGmmjARACF0agYyGVNlyVm/pzZXrN9fHGcBkz0UBid+31u93i3XFFT80vN8cvHqWqih8Lo1NpUqS5vwh3vnd223VQ10UNh9NbyrcFQUK6oCawHUipSqGqiB83oBf+CXFGDMp1mS6OqiR4Ko7FexkpOrqhpHGw82nOUqiZ6KIzGrkRuorW0dJMmOy+hOCfYGzb2RBFv6HRO0gEJw/U7y+pgL1bwmTxexN6sZ31TdEwEhdG+gA+7EqyXpUO1uZH20cWL8hMTRt1N9tBXzCJrOIRoCPJpSO2RAp4HmtCdIfZ+2JWgEBN9LbR28seTGU0Zue1tMLp+YIAMSADzfvbkKX4/eb28j4YODiGin3heqmIlLja5hAUCu+nmGY3JWKvpMAlqNGgebsauBOvlqSX+JEx7p7EbTLen53XlzfmWUioqXikrc68Y8N2juJ/fyVsNChGHEE//rBANYWaZz+TRQqpLaBgNsPfDrgSpbS21YtV87IdjrlkX9JZbt5DOma2t9ITo5F+5glN22WwL/n+yDv00mw06orKxOqQ5+J04hhViwzAXETIcJDVm8uxZqktoGx2Nj9t43Wgaul/ERQiGQvtbWnDWgZYW9CXlQFjZ/7ciyHNn+Z2MexTimIeLz59TiIln0M1e+IbPpOAaDUnEYPTi6iqKxpbycs/qKo1tCslfKcffPn9enuMiPPY1vxO/ckeFQ4h46cdGqUWoidE/y54q5tPY5WDrGzQqIXot4BgchEE57e00IMCw2/1qZSVO/7SjA78o9INzcxsbrL+fnTnDDh9mmZn8F30oG1Hm+nABv5mQMopDS/h1HxtqTzWbABMe9sxpPoe9zezeOo1GELqWhPS8t46M0IAYHbdvR1aHbaOjbjfLz2eFhez6dba4yAfgF30o0BFVE8+Mjh/wFxPI+I5mAEHU6Ls+38vhTFwOBGhMDF8gkFpbC5ffsdv/uBs6dIj19dExEtARVXv9YNbop8NFY3aZ6gRRo+tu3IBHnzmdNCBMXldXJKPfL74WzWUJRE+coDUknqsOdZXQbAJYwluVTbOZI3Qt8GFzMwxyjo3RgBiN4fr+elXVpZGRLWXl6PdOTtJBSlBDUK/lnIrjOlrtqWYTQDJaF6FrTXu9sOa1ysrVoM5HVE1GFxZQcyJ/p+xzv6K/rbr6N6+XDpUBl0tKFIrbz78qWB6YnWFMCBld4XLBms+7df75ook/GNzb0GCV7U1Qfz9p64TyQWNjYD3qe9rj4SMJtQP3MyjSDPzWIRHPjH7X4YAvfXoPuyZf9Pbi3PcuXIh4mp3NllYC6XY79C+jl2o8PBipxjnBttn4MgMNnWgfcRJGPI2OL8hTj3LloIlmRicvBhiNykvecpqoa3RSY4DRcLAwyicuOepVR1JjgNFYHWONHL04czTX0UmNAUYD7Pr+xc4wqTHGaBb2OtZvHUmNYUazcA2J6etdUmOk0f8rTKMTxF91RG0D1SwYGwAAAABJRU5ErkJggg==",
|
|
||||||
},
|
|
||||||
msg: "一切ok",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
url: "auth/login",
|
|
||||||
method: ["POST"],
|
|
||||||
body: {
|
|
||||||
code: "00000",
|
|
||||||
data: {
|
|
||||||
accessToken:
|
|
||||||
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImp0aSI6IjE2YWJkNTlkOTAxNzQwZDliYmI3ZjczODBhZDkyNzNhIiwidXNlcklkIjoyLCJ1c2VybmFtZSI6ImFkbWluIiwiZGVwdElkIjoxLCJkYXRhU2NvcGUiOjEsImF1dGhvcml0aWVzIjpbIlJPTEVfQURNSU4iXSwiZXhwIjoxNjkxMTAzMzgyfQ.P4cuIfmPepl3HuguhMS7NXn5a7IUPpsLbmtA_rHOhHk",
|
|
||||||
tokenType: "Bearer",
|
|
||||||
refreshToken: null,
|
|
||||||
expires: null,
|
|
||||||
},
|
|
||||||
msg: "一切ok",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
url: "auth/logout",
|
|
||||||
method: ["DELETE"],
|
|
||||||
body: {
|
|
||||||
code: "00000",
|
|
||||||
data: {},
|
|
||||||
msg: "string",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import path from "path";
|
|
||||||
import { createDefineMock } from "vite-plugin-mock-dev-server";
|
|
||||||
|
|
||||||
export const defineMock = createDefineMock((mock) => {
|
|
||||||
// 拼接url
|
|
||||||
mock.url = path.join(
|
|
||||||
import.meta.env.VITE_APP_BASE_API + "/api/v1/",
|
|
||||||
mock.url
|
|
||||||
);
|
|
||||||
});
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
import { defineMock } from "./base";
|
|
||||||
|
|
||||||
export default defineMock([
|
|
||||||
{
|
|
||||||
url: "menus/routes",
|
|
||||||
method: ["GET"],
|
|
||||||
body: {
|
|
||||||
code: "00000",
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
path: "/doc",
|
|
||||||
component: "Layout",
|
|
||||||
redirect: "https://juejin.cn/post/7228990409909108793",
|
|
||||||
name: "/doc",
|
|
||||||
meta: {
|
|
||||||
title: "平台文档",
|
|
||||||
icon: "document",
|
|
||||||
hidden: false,
|
|
||||||
alwaysShow: false,
|
|
||||||
params: null,
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "internal-doc",
|
|
||||||
component: "demo/internal-doc",
|
|
||||||
name: "InternalDoc",
|
|
||||||
meta: {
|
|
||||||
title: "平台文档(内嵌)",
|
|
||||||
icon: "document",
|
|
||||||
hidden: false,
|
|
||||||
alwaysShow: false,
|
|
||||||
params: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "https://juejin.cn/post/7228990409909108793",
|
|
||||||
name: "Https://juejin.cn/post/7228990409909108793",
|
|
||||||
meta: {
|
|
||||||
title: "平台文档(外链)",
|
|
||||||
icon: "el-icon-Link",
|
|
||||||
hidden: false,
|
|
||||||
alwaysShow: false,
|
|
||||||
params: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/multi-level",
|
|
||||||
component: "Layout",
|
|
||||||
name: "/multiLevel",
|
|
||||||
meta: {
|
|
||||||
title: "多级菜单",
|
|
||||||
icon: "cascader",
|
|
||||||
hidden: false,
|
|
||||||
alwaysShow: true,
|
|
||||||
params: null,
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "multi-level1",
|
|
||||||
component: "demo/multi-level/level1",
|
|
||||||
name: "MultiLevel1",
|
|
||||||
meta: {
|
|
||||||
title: "菜单一级",
|
|
||||||
icon: "",
|
|
||||||
hidden: false,
|
|
||||||
alwaysShow: true,
|
|
||||||
params: null,
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "multi-level2",
|
|
||||||
component: "demo/multi-level/children/level2",
|
|
||||||
name: "MultiLevel2",
|
|
||||||
meta: {
|
|
||||||
title: "菜单二级",
|
|
||||||
icon: "",
|
|
||||||
hidden: false,
|
|
||||||
alwaysShow: false,
|
|
||||||
params: null,
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "multi-level3-1",
|
|
||||||
component: "demo/multi-level/children/children/level3-1",
|
|
||||||
name: "MultiLevel31",
|
|
||||||
meta: {
|
|
||||||
title: "菜单三级-1",
|
|
||||||
icon: "",
|
|
||||||
hidden: false,
|
|
||||||
keepAlive: true,
|
|
||||||
alwaysShow: false,
|
|
||||||
params: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "multi-level3-2",
|
|
||||||
component: "demo/multi-level/children/children/level3-2",
|
|
||||||
name: "MultiLevel32",
|
|
||||||
meta: {
|
|
||||||
title: "菜单三级-2",
|
|
||||||
icon: "",
|
|
||||||
hidden: false,
|
|
||||||
keepAlive: true,
|
|
||||||
alwaysShow: false,
|
|
||||||
params: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
msg: "一切ok",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
import { defineMock } from "./base";
|
|
||||||
|
|
||||||
export default defineMock([
|
|
||||||
{
|
|
||||||
url: "users/me",
|
|
||||||
method: ["GET"],
|
|
||||||
body: {
|
|
||||||
code: "00000",
|
|
||||||
data: {
|
|
||||||
userId: 2,
|
|
||||||
nickname: "系统管理员",
|
|
||||||
username: "admin",
|
|
||||||
avatar:
|
|
||||||
"https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif?imageView2/1/w/80/h/80",
|
|
||||||
roles: ["ROOT"],
|
|
||||||
perms: [
|
|
||||||
"sys:menu:delete",
|
|
||||||
"sys:dept:edit",
|
|
||||||
"sys:dict_type:add",
|
|
||||||
"sys:dict:edit",
|
|
||||||
"sys:dict:delete",
|
|
||||||
"sys:dict_type:edit",
|
|
||||||
"sys:menu:add",
|
|
||||||
"sys:user:add",
|
|
||||||
"sys:role:edit",
|
|
||||||
"sys:dept:delete",
|
|
||||||
"sys:user:edit",
|
|
||||||
"sys:user:delete",
|
|
||||||
"sys:user:password:reset",
|
|
||||||
"sys:dept:add",
|
|
||||||
"sys:role:delete",
|
|
||||||
"sys:dict_type:delete",
|
|
||||||
"sys:menu:edit",
|
|
||||||
"sys:dict:add",
|
|
||||||
"sys:role:add",
|
|
||||||
"sys:user:query",
|
|
||||||
"sys:user:export",
|
|
||||||
"sys:user:import",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
msg: "一切ok",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ichangzuo",
|
"name": "ichangzuo",
|
||||||
"version": "1.1.1",
|
"version": "1.2.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import request from "@/utils/request";
|
|||||||
import { ColoredType } from "@/enums/SoftwareEnum";
|
import { ColoredType } from "@/enums/SoftwareEnum";
|
||||||
|
|
||||||
const HELPER_BASE_URL = "/api/v1/helper";
|
const HELPER_BASE_URL = "/api/v1/helper";
|
||||||
|
const RAG_BASE_URL = "/api/v1/rag";
|
||||||
|
|
||||||
class HelpAPI {
|
class HelpAPI {
|
||||||
static listQnA(id: number) {
|
static listQnA(id: number) {
|
||||||
@@ -34,6 +35,20 @@ class HelpAPI {
|
|||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新问题库(入库/移出)
|
||||||
|
* 后端通过 help_ids 从 MySQL 获取问题和状态,统一处理向量索引
|
||||||
|
* @param ids 逗号分隔的问题ID字符串,如 "1,2,3"
|
||||||
|
* @param embedded 1=入库, 0=移出
|
||||||
|
*/
|
||||||
|
static updateVector(ids: string, embedded: number) {
|
||||||
|
return request<any, { successIds: number[] }>({
|
||||||
|
url: `${HELPER_BASE_URL}/updateVectors`,
|
||||||
|
method: "post",
|
||||||
|
params: { ids, embedded },
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default HelpAPI;
|
export default HelpAPI;
|
||||||
@@ -71,8 +86,10 @@ export interface FullQnA {
|
|||||||
userName?: string;
|
userName?: string;
|
||||||
nickname?: string;
|
nickname?: string;
|
||||||
state?: number; //编辑状态
|
state?: number; //编辑状态
|
||||||
|
confidence?: number; //置信度 0-10000
|
||||||
editTime?: number; //提交时间
|
editTime?: number; //提交时间
|
||||||
answerTime?: number; //处理时间
|
answerTime?: number; //处理时间
|
||||||
|
embedded?: number; // 是否已入库 0=未入库 1=已入库
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 问题简要信息 */
|
/** 问题简要信息 */
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
const RAG_BASE_URL = "/api/v1/rag";
|
||||||
|
|
||||||
|
/** 知识库统计信息 */
|
||||||
|
export interface KBStats {
|
||||||
|
chunkCount: number;
|
||||||
|
docCount: number;
|
||||||
|
lastUpdate: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 已上传文件记录 */
|
||||||
|
export interface KBFileRecord {
|
||||||
|
fileId: number;
|
||||||
|
fileName: string;
|
||||||
|
helpTypeId: string;
|
||||||
|
uploadTime: number;
|
||||||
|
chunkCount: number;
|
||||||
|
fileCategory: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 上传文件响应 */
|
||||||
|
export interface KBUploadResponse {
|
||||||
|
chunkCount: number;
|
||||||
|
success: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 知识库管理API */
|
||||||
|
export const KBAPI = {
|
||||||
|
/**
|
||||||
|
* 上传文档到知识库
|
||||||
|
* @param file 文件对象
|
||||||
|
* @param helpTypeId 帮助类型ID (0=pc, 3=android, 4=ios, 6=pro)
|
||||||
|
* @param category 文件分类 (0=manual, 1=faq)
|
||||||
|
*/
|
||||||
|
upload(file: File, helpTypeId: number, category: number = 0): Promise<KBUploadResponse> {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("file", file);
|
||||||
|
formData.append("helpTypeId", String(helpTypeId));
|
||||||
|
formData.append("category", String(category));
|
||||||
|
return request({
|
||||||
|
url: `${RAG_BASE_URL}/kb/upload`,
|
||||||
|
method: "post",
|
||||||
|
data: formData,
|
||||||
|
headers: { "Content-Type": "multipart/form-data" },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 获取知识库统计信息 */
|
||||||
|
getStats(): Promise<KBStats> {
|
||||||
|
return request({
|
||||||
|
url: `${RAG_BASE_URL}/kb/stats`,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 获取已上传文件列表 */
|
||||||
|
getFiles(): Promise<KBFileRecord[]> {
|
||||||
|
return request({
|
||||||
|
url: `${RAG_BASE_URL}/kb/files`,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 删除知识库文件 */
|
||||||
|
deleteFile(fileId: number): Promise<void> {
|
||||||
|
return request({
|
||||||
|
url: `${RAG_BASE_URL}/kb/files/${fileId}`,
|
||||||
|
method: "delete",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -458,7 +458,7 @@
|
|||||||
v-if="contentConfig.importTemplate"
|
v-if="contentConfig.importTemplate"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="download"
|
icon="download"
|
||||||
:underline="false"
|
underline="never"
|
||||||
@click="handleDownloadTemplate"
|
@click="handleDownloadTemplate"
|
||||||
>
|
>
|
||||||
下载模板
|
下载模板
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
v-if="isExpandable && formItems.length > showNumber"
|
v-if="isExpandable && formItems.length > showNumber"
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
type="primary"
|
type="primary"
|
||||||
:underline="false"
|
underline="never"
|
||||||
@click="isExpand = !isExpand"
|
@click="isExpand = !isExpand"
|
||||||
>
|
>
|
||||||
<template v-if="isExpand">
|
<template v-if="isExpand">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-divider />
|
<el-divider />
|
||||||
<div class="flex-x-between">
|
<div class="flex-x-between">
|
||||||
<el-link type="primary" :underline="false" @click="showMore">
|
<el-link type="primary" underline="never" @click="showMore">
|
||||||
<span class="text-xs">查看更多</span>
|
<span class="text-xs">查看更多</span>
|
||||||
<el-icon class="text-xs"><ArrowRight /></el-icon>
|
<el-icon class="text-xs"><ArrowRight /></el-icon>
|
||||||
</el-link>
|
</el-link>
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export function usePageSize<T extends { pageSize: number }>(queryParams: T, key: string) {
|
||||||
|
const cached = useStorage<number>(key, queryParams.pageSize)
|
||||||
|
queryParams.pageSize = cached.value
|
||||||
|
watch(() => queryParams.pageSize, (val) => {
|
||||||
|
cached.value = val
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
export interface ColoredType {
|
||||||
|
color: string;
|
||||||
|
value: number;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const helpTypes: ColoredType[] = [
|
||||||
|
{
|
||||||
|
color: "#E63415",
|
||||||
|
value: 0,
|
||||||
|
label: "pc_win",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: "#FF6600",
|
||||||
|
value: 3,
|
||||||
|
label: "ac_android",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: "#6222C9",
|
||||||
|
value: 4,
|
||||||
|
label: "ac_iOS",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: "#1EC79D",
|
||||||
|
value: 6,
|
||||||
|
label: "pro_win",
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -54,7 +54,7 @@ export const innerTypes: ColoredType[] = [
|
|||||||
label: "ac_android",
|
label: "ac_android",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color: "#F05650",
|
color: "#6222C9",
|
||||||
value: 4,
|
value: 4,
|
||||||
label: "ac_iOS",
|
label: "ac_iOS",
|
||||||
},
|
},
|
||||||
@@ -69,7 +69,7 @@ export const innerTypes: ColoredType[] = [
|
|||||||
label: "pro_win",
|
label: "pro_win",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color: "#6222C9",
|
color: "##F05650",
|
||||||
value: 7,
|
value: 7,
|
||||||
label: "styleTool",
|
label: "styleTool",
|
||||||
},
|
},
|
||||||
|
|||||||
Vendored
+3
-1
@@ -13,8 +13,10 @@ interface ImportMetaEnv {
|
|||||||
VITE_APP_PORT: number;
|
VITE_APP_PORT: number;
|
||||||
/** API 基础路径(代理前缀) */
|
/** API 基础路径(代理前缀) */
|
||||||
VITE_APP_BASE_API: string;
|
VITE_APP_BASE_API: string;
|
||||||
/** API 地址 */
|
/** API 地址 (Spring Boot) */
|
||||||
VITE_APP_API_URL: string;
|
VITE_APP_API_URL: string;
|
||||||
|
/** RAG API 地址 (Python FastAPI) */
|
||||||
|
VITE_APP_RAG_API_URL: string;
|
||||||
/** 是否开启 Mock 服务 */
|
/** 是否开启 Mock 服务 */
|
||||||
VITE_MOCK_DEV_SERVER: boolean;
|
VITE_MOCK_DEV_SERVER: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ import { TabPaneName } from "element-plus";
|
|||||||
import { MessageTypeLabels } from "@/enums/MessageTypeEnum";
|
import { MessageTypeLabels } from "@/enums/MessageTypeEnum";
|
||||||
import { formatTimeToSeconds } from "@/utils/format";
|
import { formatTimeToSeconds } from "@/utils/format";
|
||||||
import { MessagePageQuery, WebMessage } from "@/api/message";
|
import { MessagePageQuery, WebMessage } from "@/api/message";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
import { useUserStore } from "@/store";
|
import { useUserStore } from "@/store";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
@@ -124,6 +125,7 @@ const queryParams = reactive<MessagePageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "account:messages:pageSize");
|
||||||
|
|
||||||
function stateText(status: number) {
|
function stateText(status: number) {
|
||||||
if (status == 0) return "未读";
|
if (status == 0) return "未读";
|
||||||
|
|||||||
@@ -82,6 +82,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import IntegralAPI, { IntegralPageQuery, IntegralPageUserVO } from "@/api/integral";
|
import IntegralAPI, { IntegralPageQuery, IntegralPageUserVO } from "@/api/integral";
|
||||||
import { formatTimeToMinutes } from "@/utils/format";
|
import { formatTimeToMinutes } from "@/utils/format";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
@@ -89,6 +90,7 @@ const queryParams = reactive<IntegralPageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "account:notes:statement:pageSize");
|
||||||
|
|
||||||
const detailList = ref<IntegralPageUserVO[]>([]);
|
const detailList = ref<IntegralPageUserVO[]>([]);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<template #tip>
|
<template #tip>
|
||||||
<div class="el-upload__tip">
|
<div class="el-upload__tip">
|
||||||
格式为*.xlsx / *.xls,文件不超过一个
|
格式为*.xlsx / *.xls,文件不超过一个
|
||||||
<el-link type="primary" icon="download" :underline="false" @click="handleDownloadTemplate">
|
<el-link type="primary" icon="download" underline="never" @click="handleDownloadTemplate">
|
||||||
下载模板
|
下载模板
|
||||||
</el-link>
|
</el-link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -92,12 +92,14 @@ import UserAPI, { DrawPageVO } from "@/api/user";
|
|||||||
import { formatTimeToMinutes } from "@/utils/format";
|
import { formatTimeToMinutes } from "@/utils/format";
|
||||||
import Editor from "@/components/WangEditor/index.vue";
|
import Editor from "@/components/WangEditor/index.vue";
|
||||||
import { rgb2Hex, rgbFind } from "@/enums/MessageTypeEnum";
|
import { rgb2Hex, rgbFind } from "@/enums/MessageTypeEnum";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const queryParams = reactive<PageQuery>({
|
const queryParams = reactive<PageQuery>({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:audition:draw:pageSize");
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const drawList = ref<DrawPageVO[]>();
|
const drawList = ref<DrawPageVO[]>();
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ import { DocumentType } from "@/enums/DocumentTypeEnum";
|
|||||||
import { BASE_NAME_URL } from "@/utils/baseurls";
|
import { BASE_NAME_URL } from "@/utils/baseurls";
|
||||||
import Editor from "@/components/WangEditor/index.vue";
|
import Editor from "@/components/WangEditor/index.vue";
|
||||||
import { rgb2Hex, rgbFind } from "@/enums/MessageTypeEnum";
|
import { rgb2Hex, rgbFind } from "@/enums/MessageTypeEnum";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
|
|
||||||
const audFormRef = ref();
|
const audFormRef = ref();
|
||||||
const queryFormRef = ref();
|
const queryFormRef = ref();
|
||||||
@@ -151,6 +152,7 @@ const queryParams = reactive<RealNameInfoPageQuery>({
|
|||||||
|
|
||||||
isName: 3,
|
isName: 3,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:audition:realname:pageSize");
|
||||||
|
|
||||||
const realnameList = ref<RealNameInfo[]>();
|
const realnameList = ref<RealNameInfo[]>();
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ import MessageAPI from "@/api/message";
|
|||||||
import { ElForm, FormRules, TabPaneName } from "element-plus";
|
import { ElForm, FormRules, TabPaneName } from "element-plus";
|
||||||
import { MessageTypeLabels, rgb2Hex, rgbFind } from "@/enums/MessageTypeEnum";
|
import { MessageTypeLabels, rgb2Hex, rgbFind } from "@/enums/MessageTypeEnum";
|
||||||
import { formatTimeToSeconds } from "@/utils/format";
|
import { formatTimeToSeconds } from "@/utils/format";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
import { MessagePageQuery, WebMessage } from "@/api/message";
|
import { MessagePageQuery, WebMessage } from "@/api/message";
|
||||||
import Editor from "@/components/WangEditor/index.vue";
|
import Editor from "@/components/WangEditor/index.vue";
|
||||||
|
|
||||||
@@ -197,6 +198,7 @@ const queryParams = reactive<MessagePageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:notices:pageSize");
|
||||||
|
|
||||||
function handleRead(msg: WebMessage) {
|
function handleRead(msg: WebMessage) {
|
||||||
ElMessageBox({
|
ElMessageBox({
|
||||||
|
|||||||
@@ -53,6 +53,14 @@
|
|||||||
<el-icon :size="16"><CloseBold /></el-icon>
|
<el-icon :size="16"><CloseBold /></el-icon>
|
||||||
无效
|
无效
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button type="primary" :disabled="ids.length === 0" @click="handleVectorOp(1)">
|
||||||
|
<el-icon :size="16"><Refresh /></el-icon>
|
||||||
|
加入问题库
|
||||||
|
</el-button>
|
||||||
|
<el-button type="warning" :disabled="ids.length === 0" @click="handleVectorOp(0)">
|
||||||
|
<el-icon :size="16"><Delete /></el-icon>
|
||||||
|
移出问题库
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="qnaList" @selection-change="handleSelectionChange" stripe border>
|
<el-table v-loading="loading" :data="qnaList" @selection-change="handleSelectionChange" stripe border>
|
||||||
@@ -88,6 +96,20 @@
|
|||||||
<el-text :type="stateType(scope.row.state)">{{ stateText(scope.row.state) }}</el-text>
|
<el-text :type="stateType(scope.row.state)">{{ stateText(scope.row.state) }}</el-text>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="置信度" align="center" prop="confidence" width="90">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="confidenceType(scope.row.confidence)">
|
||||||
|
{{ confidenceText(scope.row.confidence) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="已入库" align="center" prop="embedded" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="scope.row.embedded === 1 ? 'success' : 'info'">
|
||||||
|
{{ scope.row.embedded === 1 ? "是" : "否" }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="提交时间" align="center" prop="editTime" width="180">
|
<el-table-column label="提交时间" align="center" prop="editTime" width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatTimeToMinutes(scope.row.editTime) }}
|
{{ formatTimeToMinutes(scope.row.editTime) }}
|
||||||
@@ -98,7 +120,7 @@
|
|||||||
{{ formatTimeToMinutes(scope.row.answerTime) }}
|
{{ formatTimeToMinutes(scope.row.answerTime) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" fixed="right" width="100">
|
<el-table-column label="操作" align="center" fixed="right" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="success" link size="small" @click="handleOpenDialog(scope.row)">
|
<el-button type="success" link size="small" @click="handleOpenDialog(scope.row)">
|
||||||
<el-icon :size="14"><EditPen /></el-icon>
|
<el-icon :size="14"><EditPen /></el-icon>
|
||||||
@@ -199,6 +221,9 @@ defineOptions({
|
|||||||
import HelperAPI, { FullQnA, QnAPageQuery, UpdateQnA } from "@/api/helper";
|
import HelperAPI, { FullQnA, QnAPageQuery, UpdateQnA } from "@/api/helper";
|
||||||
import { ColoredType, innerTypes } from "@/enums/SoftwareEnum";
|
import { ColoredType, innerTypes } from "@/enums/SoftwareEnum";
|
||||||
import { formatTimeToMinutes } from "@/utils/format";
|
import { formatTimeToMinutes } from "@/utils/format";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
|
import { ElMessageBox } from "element-plus";
|
||||||
|
import { EditPen, Plus, SemiSelect, CloseBold, Refresh, Delete } from "@element-plus/icons-vue";
|
||||||
|
|
||||||
const queryFormRef = ref();
|
const queryFormRef = ref();
|
||||||
const qnaFormRef = ref();
|
const qnaFormRef = ref();
|
||||||
@@ -211,6 +236,7 @@ const queryParams = reactive<QnAPageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:question:pageSize");
|
||||||
const optionHide = "display: none";
|
const optionHide = "display: none";
|
||||||
function optionShow(value: number) {
|
function optionShow(value: number) {
|
||||||
if (value == 5 || value == 7) return optionHide;
|
if (value == 5 || value == 7) return optionHide;
|
||||||
@@ -229,7 +255,7 @@ watch(queryTypes, (types) => {
|
|||||||
// console.log(queryParams.typeIds);
|
// console.log(queryParams.typeIds);
|
||||||
});
|
});
|
||||||
|
|
||||||
const qnaList = ref<FullQnA[]>();
|
const qnaList = ref<FullQnA[]>([]);
|
||||||
|
|
||||||
// 弹窗
|
// 弹窗
|
||||||
const dialog = reactive({
|
const dialog = reactive({
|
||||||
@@ -314,6 +340,18 @@ function stateType(state: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function confidenceText(confidence: number | undefined | null) {
|
||||||
|
if (confidence == null) return "";
|
||||||
|
return (confidence / 100).toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function confidenceType(confidence: number | undefined | null) {
|
||||||
|
if (confidence == null) return "info";
|
||||||
|
if (confidence >= 9000) return "success";
|
||||||
|
if (confidence >= 6000) return "warning";
|
||||||
|
return "danger";
|
||||||
|
}
|
||||||
|
|
||||||
function userText(nickname: string | undefined, userName: string | undefined) {
|
function userText(nickname: string | undefined, userName: string | undefined) {
|
||||||
if (nickname) return nickname;
|
if (nickname) return nickname;
|
||||||
if (userName) return userName;
|
if (userName) return userName;
|
||||||
@@ -471,6 +509,45 @@ function handleState(state: number) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 向量库操作:入库/移出 */
|
||||||
|
async function handleVectorOp(embedded: number) {
|
||||||
|
if (ids.value.length === 0) {
|
||||||
|
ElMessage.warning("请勾选问题");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const action = embedded === 1 ? "加入" : "移出";
|
||||||
|
const actionType = embedded === 1 ? "info" : "warning";
|
||||||
|
|
||||||
|
// 预过滤:仅处理当前 embedded 状态相反的记录
|
||||||
|
const targetIds = qnaList.value
|
||||||
|
.filter((item) => ids.value.includes(item.helpId!) && item.embedded !== embedded)
|
||||||
|
.map((item) => item.helpId);
|
||||||
|
|
||||||
|
if (targetIds.length === 0) {
|
||||||
|
ElMessage.info(embedded === 1 ? "选中问题均已在库中" : "选中问题均未入库");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(`确定将选中的 ${targetIds.length} 个问题${action}问题库吗?`, `${action}问题库`, {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: actionType,
|
||||||
|
});
|
||||||
|
|
||||||
|
loading.value = true;
|
||||||
|
const res = await HelperAPI.updateVector(targetIds.join(","), embedded);
|
||||||
|
const successCount = res?.successIds?.length || 0;
|
||||||
|
ElMessage.success(`${action}成功 ${successCount} 条`);
|
||||||
|
handleQuery(); // 刷新列表
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error(`${action}失败`);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
handleQuery();
|
handleQuery();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,559 @@
|
|||||||
|
<template>
|
||||||
|
<div class="rag-knowledge-container">
|
||||||
|
<!-- 页面标题 -->
|
||||||
|
<div class="page-header">
|
||||||
|
<h2 class="page-title">知识库管理</h2>
|
||||||
|
<el-button type="primary" @click="uploadDialogVisible = true">
|
||||||
|
<el-icon :size="16"><Upload /></el-icon>
|
||||||
|
上传文档
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 统计卡片 -->
|
||||||
|
<!-- <el-row :gutter="20" class="stats-row" v-if="stats">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-card shadow="never" class="stat-card">
|
||||||
|
<div class="stat-value">{{ stats.chunkCount }}</div>
|
||||||
|
<div class="stat-label">文档分块数</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-card shadow="never" class="stat-card">
|
||||||
|
<div class="stat-value">{{ stats.docCount }}</div>
|
||||||
|
<div class="stat-label">文档数量</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-card shadow="never" class="stat-card">
|
||||||
|
<div class="stat-value">{{ formatDate(stats.lastUpdate) }}</div>
|
||||||
|
<div class="stat-label">最后更新</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-card shadow="never" class="stat-card">
|
||||||
|
<el-button link @click="fetchStats" :loading="statsLoading" size="small">
|
||||||
|
<el-icon :size="14"><Refresh /></el-icon>
|
||||||
|
刷新统计
|
||||||
|
</el-button>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row> -->
|
||||||
|
|
||||||
|
<!-- 上传文档对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="uploadDialogVisible"
|
||||||
|
title="上传文档到知识库"
|
||||||
|
width="600px"
|
||||||
|
:before-close="handleUploadDialogClose"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<el-form ref="uploadFormRef" :model="uploadForm" :rules="uploadRules" label-width="100px">
|
||||||
|
<el-form-item label="选择文件" prop="file">
|
||||||
|
<el-upload
|
||||||
|
class="upload-demo"
|
||||||
|
drag
|
||||||
|
:action="uploadUrl"
|
||||||
|
:headers="uploadHeaders"
|
||||||
|
:data="uploadData"
|
||||||
|
:on-success="handleUploadSuccess"
|
||||||
|
:on-error="handleUploadError"
|
||||||
|
:on-progress="handleUploadProgress"
|
||||||
|
:on-change="handleFileChange"
|
||||||
|
:auto-upload="false"
|
||||||
|
:limit="1"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
:file-list="fileListForUpload"
|
||||||
|
accept=".txt,.md"
|
||||||
|
>
|
||||||
|
<i-ep-upload class="el-icon--upload" />
|
||||||
|
<div class="el-upload__text">
|
||||||
|
将文件拖到此处,或<em>点击上传</em>
|
||||||
|
</div>
|
||||||
|
<div class="el-upload__tip" slot="tip">
|
||||||
|
仅支持 TXT、MD 格式,单文件不超过 50MB
|
||||||
|
</div>
|
||||||
|
</el-upload>
|
||||||
|
<div v-if="uploadProgress > 0 && uploadProgress < 100" class="upload-progress">
|
||||||
|
<el-progress :percentage="uploadProgress" :stroke-width="12" status="success" />
|
||||||
|
<div class="progress-text">{{ uploadStatusText }}</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="帮助类型" prop="helpTypeId">
|
||||||
|
<el-select v-model="uploadFormTypes" multiple placeholder="请选择帮助类型" clearable style="width: 100%" collapse-tags>
|
||||||
|
<span v-for="(item, index) in helpTypes" :key="item.value" :style="optionShow(item.value)">
|
||||||
|
<el-option :label="item.label" :value="helpTypes[index]">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<el-tag :color="item.color" style="margin-right: 8px" size="small" />
|
||||||
|
<span :style="{ color: item.color }">{{ item.label }}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</span>
|
||||||
|
<template #tag>
|
||||||
|
<el-tag v-for="item in uploadFormTypes" :key="item.value" :color="item.color" />
|
||||||
|
</template>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="文件分类" prop="category">
|
||||||
|
<el-radio-group v-model="uploadForm.category">
|
||||||
|
<el-radio :value="0">手册·说明</el-radio>
|
||||||
|
<el-radio :value="1">FAQ</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="uploadDialogVisible = false">取消</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:loading="uploading"
|
||||||
|
:disabled="!uploadForm.file || !uploadForm.helpTypeId"
|
||||||
|
@click="submitUpload"
|
||||||
|
>
|
||||||
|
确定上传
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 已上传文件列表 -->
|
||||||
|
<el-card shadow="never" class="file-list-card">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span>已上传文件列表</span>
|
||||||
|
<el-button link @click="fetchFiles" :loading="filesLoading" size="small">
|
||||||
|
<el-icon :size="14"><Refresh /></el-icon>
|
||||||
|
刷新
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-table v-loading="filesLoading" :data="fileList" stripe border style="width: 100%">
|
||||||
|
<el-table-column label="ID" prop="fileId" width="80" />
|
||||||
|
<el-table-column label="文件名" prop="fileName" width="280" show-overflow-tooltip />
|
||||||
|
<el-table-column label="帮助类型" prop="helpTypeId" width="200">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip
|
||||||
|
v-for="item in getHelpTypes(scope.row.helpTypeId)"
|
||||||
|
:key="item.value"
|
||||||
|
class="box-item"
|
||||||
|
effect="dark"
|
||||||
|
:content="item.label"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<el-tag :color="item.color" class="ml-1" />
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="分类" width="100" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="scope.row.fileCategory === 1 ? 'warning' : 'info'">
|
||||||
|
{{ scope.row.fileCategory === 1 ? 'FAQ' : '手册' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="上传时间" prop="uploadTime" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatDateTime(scope.row.uploadTime) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="分块数" prop="chunkCount" width="100" align="center" />
|
||||||
|
<el-table-column label="状态" width="120" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag type="success">已完成</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="120" align="center" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
link
|
||||||
|
@click="handleDeleteFile(scope.row as KBFileRecord)"
|
||||||
|
:disabled="deletingFileId === String(scope.row.fileId)"
|
||||||
|
>
|
||||||
|
<el-icon :size="14"><Delete /></el-icon>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<div v-if="fileList.length === 0 && !filesLoading" class="empty-state">
|
||||||
|
<i-ep-folder-opened class="empty-icon" />
|
||||||
|
<p>暂无上传文档</p>
|
||||||
|
<p class="empty-hint">点击"上传文档"按钮开始构建知识库</p>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Upload, Refresh, Delete } from "@element-plus/icons-vue";
|
||||||
|
import { KBAPI, KBFileRecord } from "@/api/rag";
|
||||||
|
import { helpTypes, ColoredType } from "@/enums/HelpTypeEnum";
|
||||||
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
|
||||||
|
const userStore = useUserStoreHook();
|
||||||
|
|
||||||
|
// 响应式状态
|
||||||
|
const fileList = ref<KBFileRecord[]>([]);
|
||||||
|
const filesLoading = ref(false);
|
||||||
|
const uploadDialogVisible = ref(false);
|
||||||
|
const uploading = ref(false);
|
||||||
|
const uploadProgress = ref(0);
|
||||||
|
const uploadStatusText = ref("");
|
||||||
|
const deletingFileId = ref<string | null>(null);
|
||||||
|
|
||||||
|
// 表单
|
||||||
|
const uploadFormRef = ref();
|
||||||
|
const uploadForm = reactive({
|
||||||
|
file: null as File | null,
|
||||||
|
helpTypeId: "" as string,
|
||||||
|
category: 0 as number,
|
||||||
|
});
|
||||||
|
|
||||||
|
const uploadFormTypes = ref<ColoredType[]>([]);
|
||||||
|
|
||||||
|
function optionShow(_value: number): string | undefined {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(uploadFormTypes, (types) => {
|
||||||
|
const tIds = types.map((item) => item.value);
|
||||||
|
if (tIds.length > 0) uploadForm.helpTypeId = tIds.join(",");
|
||||||
|
else uploadForm.helpTypeId = "";
|
||||||
|
});
|
||||||
|
|
||||||
|
const uploadRules = reactive({
|
||||||
|
file: [{ required: true, message: "请选择文件", trigger: "change" }],
|
||||||
|
helpTypeId: [{ required: true, message: "请选择帮助类型", trigger: "change" }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 上传配置
|
||||||
|
const uploadUrl = computed(() => `${import.meta.env.VITE_APP_BASE_API}/api/v1/rag/kb/upload`);
|
||||||
|
const uploadHeaders = computed(() => ({
|
||||||
|
Authorization: `Bearer ${userStore.sessionToken}`,
|
||||||
|
}));
|
||||||
|
const uploadData = computed(() => ({
|
||||||
|
helpTypeId: uploadForm.helpTypeId,
|
||||||
|
category: uploadForm.category,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 文件列表(用于 el-upload)
|
||||||
|
const fileListForUpload = ref<Array<{ name: string; url?: string }>>([]);
|
||||||
|
|
||||||
|
const ALLOWED_EXTENSIONS = [".txt", ".md"];
|
||||||
|
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
||||||
|
|
||||||
|
function validateFile(file: File): string | null {
|
||||||
|
const ext = file.name.substring(file.name.lastIndexOf(".")).toLowerCase();
|
||||||
|
if (!ALLOWED_EXTENSIONS.includes(ext)) return "仅支持 TXT、MD 格式";
|
||||||
|
if (file.size > MAX_FILE_SIZE) return "文件大小不能超过 50MB";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 方法
|
||||||
|
async function fetchStats() {
|
||||||
|
try {
|
||||||
|
await KBAPI.getStats();
|
||||||
|
} catch {
|
||||||
|
ElMessage.error("获取统计信息失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchFiles() {
|
||||||
|
filesLoading.value = true;
|
||||||
|
try {
|
||||||
|
const resp = await KBAPI.getFiles();
|
||||||
|
fileList.value = (resp as any)?.files ?? [];
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error("获取文件列表失败");
|
||||||
|
} finally {
|
||||||
|
filesLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFileChange(file: any, _fileList: any) {
|
||||||
|
// :on-change 在 auto-upload=false 下可靠触发,用于捕获所选文件
|
||||||
|
const raw = file?.raw as File | undefined;
|
||||||
|
if (!raw) {
|
||||||
|
uploadForm.file = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const error = validateFile(raw);
|
||||||
|
if (error) {
|
||||||
|
ElMessage.error(error);
|
||||||
|
uploadForm.file = null;
|
||||||
|
fileListForUpload.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uploadForm.file = raw;
|
||||||
|
fileListForUpload.value = [{ name: raw.name }];
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUploadProgress(event: any, file: any) {
|
||||||
|
uploadProgress.value = Math.round((event.loaded / event.total) * 100);
|
||||||
|
uploadStatusText.value = `上传中... ${uploadProgress.value}%`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUploadSuccess(response: any, file: any, fileList: any) {
|
||||||
|
uploadProgress.value = 100;
|
||||||
|
uploadStatusText.value = "上传完成,正在处理...";
|
||||||
|
fileListForUpload.value = [];
|
||||||
|
ElMessage.success("文件上传成功,后台正在解析和向量化...");
|
||||||
|
fetchStats();
|
||||||
|
fetchFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUploadError(err: any, file: any, fileList: any) {
|
||||||
|
uploadProgress.value = 0;
|
||||||
|
uploadStatusText.value = "";
|
||||||
|
ElMessage.error("上传失败:" + (err.message || "未知错误"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleExceed(files: any, fileList: any) {
|
||||||
|
ElMessage.warning("每次只能上传一个文件");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitUpload() {
|
||||||
|
const form = uploadFormRef.value as any;
|
||||||
|
form.validate(async (valid: boolean) => {
|
||||||
|
if (!valid) return;
|
||||||
|
|
||||||
|
// 真实提交路径校验(before-upload 在 auto-upload=false 下不触发)
|
||||||
|
const file = uploadForm.file;
|
||||||
|
if (!file) {
|
||||||
|
ElMessage.error("请选择文件");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const error = validateFile(file);
|
||||||
|
if (error) {
|
||||||
|
ElMessage.error(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uploading.value = true;
|
||||||
|
uploadProgress.value = 0;
|
||||||
|
uploadStatusText.value = "准备上传...";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("file", file);
|
||||||
|
formData.append("helpTypeId", uploadForm.helpTypeId);
|
||||||
|
formData.append("category", String(uploadForm.category));
|
||||||
|
|
||||||
|
await requestUpload(formData);
|
||||||
|
ElMessage.success("上传成功,后台正在处理...");
|
||||||
|
uploadDialogVisible.value = false;
|
||||||
|
resetUploadForm();
|
||||||
|
fetchStats();
|
||||||
|
fetchFiles();
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error?.message || "上传失败");
|
||||||
|
} finally {
|
||||||
|
uploading.value = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestUpload(formData: FormData) {
|
||||||
|
return new Promise<void>((resolve, reject) => {
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("POST", uploadUrl.value);
|
||||||
|
xhr.setRequestHeader("Authorization", uploadHeaders.value.Authorization);
|
||||||
|
|
||||||
|
xhr.upload.onprogress = (event) => {
|
||||||
|
if (event.lengthComputable) {
|
||||||
|
uploadProgress.value = Math.round((event.loaded / event.total) * 100);
|
||||||
|
uploadStatusText.value = `上传中... ${uploadProgress.value}%`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.onload = () => {
|
||||||
|
if (xhr.status >= 200 && xhr.status < 300) {
|
||||||
|
// Java 网关统一返回 Result{code, data, msg};失败时 data 为 null,错误在 msg
|
||||||
|
try {
|
||||||
|
const body = JSON.parse(xhr.responseText);
|
||||||
|
if (body && body.code && body.code !== "00000") {
|
||||||
|
reject(new Error(body.msg || "上传失败"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 响应非 JSON,忽略
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject(new Error(`HTTP ${xhr.status}`));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.onerror = () => reject(new Error("网络错误"));
|
||||||
|
xhr.send(formData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUploadDialogClose(done: () => void) {
|
||||||
|
if (uploading.value) {
|
||||||
|
ElMessage.warning("正在上传中,请稍候...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
resetUploadForm();
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetUploadForm() {
|
||||||
|
uploadForm.file = null;
|
||||||
|
uploadForm.helpTypeId = "";
|
||||||
|
uploadForm.category = 0;
|
||||||
|
uploadFormTypes.value = [];
|
||||||
|
fileListForUpload.value = [];
|
||||||
|
uploadProgress.value = 0;
|
||||||
|
uploadStatusText.value = "";
|
||||||
|
const form = uploadFormRef.value as any;
|
||||||
|
form?.clearValidate?.();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDeleteFile(file: KBFileRecord) {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
`确定要删除文件 "${file.fileName}" 吗?此操作不可恢复。`,
|
||||||
|
"确认删除",
|
||||||
|
{ confirmButtonText: "删除", cancelButtonText: "取消", type: "warning" }
|
||||||
|
);
|
||||||
|
|
||||||
|
deletingFileId.value = String(file.fileId);
|
||||||
|
await KBAPI.deleteFile(file.fileId);
|
||||||
|
ElMessage.success("删除成功");
|
||||||
|
fetchFiles();
|
||||||
|
} catch (error) {
|
||||||
|
// 用户取消或请求失败
|
||||||
|
if (error !== false) {
|
||||||
|
ElMessage.error("删除失败");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
deletingFileId.value = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHelpTypes(ids?: string): ColoredType[] {
|
||||||
|
const types: ColoredType[] = [];
|
||||||
|
if (ids) {
|
||||||
|
const lst = ids.split(",");
|
||||||
|
for (const idStr of lst) {
|
||||||
|
const id = Number(idStr);
|
||||||
|
const found = helpTypes.find((t) => t.value === id);
|
||||||
|
if (found) types.push(found);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toDate(value: string | number): Date {
|
||||||
|
if (!value) return new Date();
|
||||||
|
const num = typeof value === "number" ? value : Number(value);
|
||||||
|
if (!Number.isNaN(num) && num > 0) {
|
||||||
|
// Unix timestamp in seconds (< 1e12) vs milliseconds (>= 1e12)
|
||||||
|
return new Date(num < 1e12 ? num * 1000 : num);
|
||||||
|
}
|
||||||
|
return new Date(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDateTime(dateStr: string): string {
|
||||||
|
if (!dateStr) return "-";
|
||||||
|
return toDate(dateStr).toLocaleString("zh-CN");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
onMounted(() => {
|
||||||
|
fetchFiles();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.rag-knowledge-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--el-text-color-primary);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-row {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
.stat-card {
|
||||||
|
text-align: center;
|
||||||
|
padding: 16px 0;
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-progress {
|
||||||
|
margin-top: 12px;
|
||||||
|
|
||||||
|
.progress-text {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-list-card {
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 60px 20px;
|
||||||
|
color: var(--el-text-color-placeholder);
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
font-size: 48px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-hint {
|
||||||
|
font-size: 13px;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -91,6 +91,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import IntegralAPI, { IntegralPageQuery, IntegralPageAdminVO } from "@/api/integral";
|
import IntegralAPI, { IntegralPageQuery, IntegralPageAdminVO } from "@/api/integral";
|
||||||
import { formatTimeToMinutes } from "@/utils/format";
|
import { formatTimeToMinutes } from "@/utils/format";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
@@ -98,6 +99,7 @@ const queryParams = reactive<IntegralPageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:statement:notes:pageSize");
|
||||||
|
|
||||||
const detailList = ref<IntegralPageAdminVO[]>([]);
|
const detailList = ref<IntegralPageAdminVO[]>([]);
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import OrderAPI, { OrderPageQuery, OrderPageVO } from "@/api/order";
|
import OrderAPI, { OrderPageQuery, OrderPageVO } from "@/api/order";
|
||||||
import { formatTimeToSeconds } from "@/utils/format";
|
import { formatTimeToSeconds } from "@/utils/format";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
@@ -112,6 +113,7 @@ const queryParams = reactive<OrderPageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:statement:orders:pageSize");
|
||||||
|
|
||||||
const detailList = ref<OrderPageVO[]>([]);
|
const detailList = ref<OrderPageVO[]>([]);
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import StatisticsAPI, { StatisticsPageQuery, StatisticsVO, StatisticsBO } from "@/api/statistics";
|
import StatisticsAPI, { StatisticsPageQuery, StatisticsVO, StatisticsBO } from "@/api/statistics";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
import { ThemeEnum } from "@/enums/ThemeEnum";
|
import { ThemeEnum } from "@/enums/ThemeEnum";
|
||||||
import { useSettingsStore } from "@/store/modules/settings";
|
import { useSettingsStore } from "@/store/modules/settings";
|
||||||
import { dateToNumber, dayToWeek } from "@/utils/format";
|
import { dateToNumber, dayToWeek } from "@/utils/format";
|
||||||
@@ -78,6 +79,7 @@ const queryParams = reactive<StatisticsPageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:statistics:pageSize");
|
||||||
|
|
||||||
const queryRange = ref();
|
const queryRange = ref();
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import StyleAPI, { StylePageQuery, StyleStatistic, StyleUpdate, StyleVO } from "@/api/style";
|
import StyleAPI, { StylePageQuery, StyleStatistic, StyleUpdate, StyleVO } from "@/api/style";
|
||||||
import { formatDate } from "@/utils/format";
|
import { formatDate } from "@/utils/format";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
|
|
||||||
const collapseOpen = ref(0);
|
const collapseOpen = ref(0);
|
||||||
const stat = ref<StyleStatistic>();
|
const stat = ref<StyleStatistic>();
|
||||||
@@ -180,6 +181,7 @@ const queryParams = reactive<StylePageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:styles:pageSize");
|
||||||
|
|
||||||
const tsTypes = [
|
const tsTypes = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -304,6 +304,7 @@ import SoftwareAPI, { FullVersion, VersionPageQuery } from "@/api/software";
|
|||||||
import { BASE_SOFTWARE_URL } from "@/utils/baseurls";
|
import { BASE_SOFTWARE_URL } from "@/utils/baseurls";
|
||||||
import { formatTimeToMinutes } from "@/utils/format";
|
import { formatTimeToMinutes } from "@/utils/format";
|
||||||
import { innerTypes, softwareTypes } from "@/enums/SoftwareEnum";
|
import { innerTypes, softwareTypes } from "@/enums/SoftwareEnum";
|
||||||
|
import { usePageSize } from "@/composables/usePageSize";
|
||||||
import { genFileId, UploadFile, UploadInstance, UploadProps, UploadRawFile, UploadUserFile } from "element-plus";
|
import { genFileId, UploadFile, UploadInstance, UploadProps, UploadRawFile, UploadUserFile } from "element-plus";
|
||||||
|
|
||||||
const queryFormRef = ref();
|
const queryFormRef = ref();
|
||||||
@@ -317,6 +318,7 @@ const queryParams = reactive<VersionPageQuery>({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
|
usePageSize(queryParams, "website:swVersions:pageSize");
|
||||||
|
|
||||||
const versionList = ref<FullVersion[]>([]);
|
const versionList = ref<FullVersion[]>([]);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "node16",
|
"module": "esnext",
|
||||||
"moduleResolution": "node16",
|
"moduleResolution": "bundler",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noLib": false,
|
"noLib": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
|||||||
+5
-1
@@ -53,7 +53,11 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||||||
// 应用端口 (默认:3000)
|
// 应用端口 (默认:3000)
|
||||||
port: Number(env.VITE_APP_PORT),
|
port: Number(env.VITE_APP_PORT),
|
||||||
// 运行是否自动打开浏览器
|
// 运行是否自动打开浏览器
|
||||||
open: true,
|
open: false,
|
||||||
|
headers: {
|
||||||
|
// 允许百度统计 hm.js 使用 unload 事件(Chrome v109+ Permissions-Policy 限制)
|
||||||
|
"Permissions-Policy": "unload=*",
|
||||||
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
/** 代理前缀为 /dev-api 的请求 */
|
/** 代理前缀为 /dev-api 的请求 */
|
||||||
[env.VITE_APP_BASE_API]: {
|
[env.VITE_APP_BASE_API]: {
|
||||||
|
|||||||
Reference in New Issue
Block a user