This commit is contained in:
vastxie 2024-04-20 22:15:08 +08:00
parent 133b89076e
commit 1c9e023c08
221 changed files with 6107 additions and 6478 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
node_modules
pnpm-lock.yaml
sql
data
.env.docker

View File

@ -4,6 +4,9 @@ FROM node:18-alpine AS build
WORKDIR /app
COPY . .
# 使用腾讯源(国内服务器可取消下方注释以提升安装速度)
# RUN npm config set registry https://mirrors.cloud.tencent.com/npm/
# 使用 pnpm 安装项目依赖
RUN npm install -g pnpm
RUN pnpm install

209
README.md
View File

@ -4,6 +4,7 @@
未编译源码暂不开源,相比稳定版,开发版进度更快一些。
## 页面预览
<img width="1226" alt="image" src="https://github.com/vastxie/99AI/assets/24899308/9b6f3e28-1cfa-4c76-8f43-d898c7f72a08">
@ -22,6 +23,39 @@
## 更新日志
### 稳定版 v3.3.0
- 重构流式回复逻辑,加入错误反馈并优化用户端等待动画
- 调整文档显示 UI提升视觉体验
- 新增 AI 回复 TTS 播报功能【后台模型管理-模型设置-添加特殊模型 `tts-1`
- 对话页新增 Dalle 绘图风格选择与连续对话绘画选项,配置入口:后台模型管理-绘画设置-Dalle 绘图配置
- 新增对话页 Midjourney 图片尺寸及风格选择功能
- 重构应用广场 UI注意**本次升级可能会导致应用广场图片丢失,请务必提前备份**
- 优化侧边栏显示,现支持应用收藏,允许同一应用开启多个对话窗口
- 新增 `GPTs` 适配及应用固定模型功能,需先在后台添加 `GPTs` 模型后进行设置
- 创意模型 【后台模型管理-模型设置-添加创意模型】现已针对以下模型特别优化:
- 【dalle-e-3】OpenAI 格式)
- 【midjourney】Mj-Plus 格式)
- 【stable-diffusion】[LightAI API](https://api.lightai.io) 中转格式)
- 【suno】[LightAI API](https://api.lightai.io) 中转格式)
- 邮箱 SMTP 配置已迁移至后台【用户管理-邮件登录配置】,同时【基础配置】新增网页链接选项,增强发信显示效果
- 重构应用逻辑,翻译及导图特殊模型不再需配置,已整合至【模型管理-系统应用】
- 新增模型配置选项,允许设置模型调用频率限制,确保用户体验
### 开发版已/将支持
- 对话页 Midjourney 绘图支持 `图生图` `人脸一致性` `风格一致性` 以及更多自定义参数选择
- 全模型文件分析功能(只支持带文字的 pdfwordppttxtmd 等文件)
- 全新的插件系统——联网搜索、思维导图等 ··· ···
- `SD3` / `SD3 Turbo` 绘图模型,`Stable Video` 图生视频模型(`stability.ai` API 格式)
- Azure TTS 模型支持,语音播报更生动自然
- 临时文件支持本地存储并自动清空
- 更多功能持续开发中 ··· ···
<details>
<summary>历史日志</summary>
### v3.0.0
**前端改进**
@ -46,18 +80,6 @@
- 模型配置支持扣除积分类型选择。
- 后台管理菜单重新排版,精简非必要配置。
**开发版已支持**
- [x] 应用页支持GPTS及固定模型功能。
- [x] 对话使用TTS进行语音播报。
- [x] Dalle绘图支持添加风格参数支持交互式连续绘画。
- [ ] ...
<details>
<summary>历史日志</summary>
### v2.6.0
1. **新增 mj-proxy-plus 支持**:支持[第三方](https://api.lightai.io)中转,添加容错和重试机制。(可联系作者获得 mj-proxy-plus 支持)
@ -83,44 +105,11 @@
</details>
## 环境准备
## 安装部署
1. **安装 Node.js 环境**
推荐使用 Docker 环境来编译和部署镜像,或者直接在 Node.js 环境中进行安装。虽然安装文档可能不是非常详细,但绝对够用。如果在安装或配置过程中遇到任何问题,优先使用 AI助手 货交流群内提出问题,以获得更多帮助和支持。
- 请根据您的操作系统下载并安装 Node.js。
- 可以从[Node.js 官网](https://nodejs.org/)下载。
2. **安装 PM2**
- 使用 npm 安装 PM2`npm install pm2 -g`
- PM2 是一个带有负载均衡功能的 Node 应用的进程管理器。
3. **安装 PNPM**
- 使用 npm 安装 PNPM`npm install -g pnpm`
- PNPM 是一个快速、节省磁盘空间的包管理工具。
## 配置项目
1. **配置环境变量**
- 复制`.env.example`文件为`.env`。
- 根据需要修改`.env`文件中的配置项。
2. **安装项目依赖**
- 运行命令:`pnpm install`(若安装失败可尝试使用国内源)
- 这将根据`package.json`文件安装所有必需的依赖。
## 启动项目
1. **启动服务**
- 使用命令:`pnpm start`
- 这将启动项目,并默认在 9520 端口监听。
2. **访问项目**
- 在浏览器中访问`http://localhost:9520`,或者如果配置了 nginx 反向代理,则通过配置的域名访问。
## docker-compose 部署 (推荐)
## Docker 部署 (推荐)
1. **安装 Docker 及 Docker-compose**
@ -130,27 +119,108 @@
curl -fsSL https://get.docker.com | bash -s docker
```
2. **启动服务**
- 执行`docker-compose up -d`命令这将在后台启动服务。
- 如果您需要查看日志,可以使用 `docker-compose logs` 命令。
- 如果您需要停止服务,可以使用 `docker-compose down` 命令。
- 如果您需要重新构建并启动服务,可以使用 `docker-compose up -d --build` 命令。
2. **服务管理**
- 后台启动服务
```bash
docker-compose up -d
```
- 查看日志
```bash
docker-compose logs
```
- 停止服务
```bash
docker-compose down
```
- 重新构建并启动服务
```bash
docker-compose up -d --build
```
3. **访问项目**
- 在浏览器中访问`http://localhost:9520`,或者如果配置了 nginx 反向代理,则通过配置的域名访问。
- 在浏览器中访问 `http://localhost:9520`,如果配置了 nginx 反向代理,则通过配置的域名访问。
## 管理平台
## Node.js + PM2 部署
- **管理端地址**`/admin`
- **普通管理员账号**`admin`
- **超级管理员账号**`super`
- **密码**`123456`
### 环境准备
普通管理员,可以预览后台非敏感信息。登入后台后请及时修改管理员密码,或按需要禁用普通管理员。
1. **安装 Node.js 环境**
请确保遵循上述步骤进行配置和启动,以保证系统的正确运行。
推荐使用 `nvm` (Node Version Manager) 来安装 Node.js
## 项目升级
- 首先,安装 `nvm`,你可以从 `nvm` 的 GitHub 仓库找到安装指南:
[nvm GitHub 仓库](https://github.com/nvm-sh/nvm)
- 按照仓库中的安装说明进行操作,安装完成后,重启你的终端或命令行界面。
- 安装 Node.js 版本 16.0 或更高版本:
```bash
nvm install 16
nvm use 16
```
- 验证 Node.js 安装成功及版本:
```bash
node -v
```
使用这种方法安装 Node.js可以确保你的开发环境中 Node.js 的版本管理更为灵活和方便。
2. **安装 PM2 / PNPM**
- 使用 npm 安装 PM2
```bash
npm install pm2 -g
```
- 使用 npm 安装 pnpm
```bash
npm install -g pnpm
```
- 确认`PM2`, 和 `pnpm` 都已正确安装并且可以运行:
```bash
pm2 -v
pnpm -v
```
- 这一步确保所有必需的工具和软件已正确安装,并且它们的版本符合项目需求。
### 配置项目
1. **配置环境变量**
- 复制`.env.example`文件为`.env`。
- 根据需要修改`.env`文件中的配置项。
2. **安装项目依赖**
- 运行命令:`pnpm install`(若安装缓慢可尝试使用国内源)。
- 这将根据`package.json`文件安装所有必需的依赖。
### 启动项目
1. **启动服务**
- 使用命令:`pnpm start`
- 这将启动项目,并默认在 9520 端口监听。
2. **访问项目**
- 在浏览器中访问 `http://localhost:9520`,如果配置了 nginx 反向代理,则通过配置的域名访问。
### 项目升级
1. **拉取更新**
@ -165,10 +235,23 @@
- 运行命令:`pnpm install` 以安装 `package.json` 中定义的必需依赖。
4. **启动服务**
- 使用命令:`pnpm start` 来启动项目,它将默认在 9520 端口监听。
## 管理平台
- **管理端地址**`/admin`
- **普通管理员账号**`admin`
- **超级管理员账号**`super`
- **密码**`123456`
普通管理员,可以预览后台非敏感信息,默认不激活。请使用超级管理员账号登入后台,并及时修改密码。
## 学习交流
扫码添加微信备注 99拉交流群
扫码添加微信备注 `99`,拉交流群。(不接受私聊技术咨询,有问题优先群内交流)
<img src="https://github.com/vastxie/NineAIQuickDeploy/assets/24899308/ee20578f-063d-48d8-bff6-85ac3e38fe60" width="300">

44
dist/app.module.js vendored
View File

@ -7,42 +7,41 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppModule = void 0;
const abort_interceptor_1 = require("./common/interceptors/abort.interceptor");
const common_1 = require("@nestjs/common");
const nestjs_config_1 = require("nestjs-config");
const abort_interceptor_1 = require("./common/interceptors/abort.interceptor");
const database_module_1 = require("./modules/database/database.module");
const path_1 = require("path");
const user_module_1 = require("./modules/user/user.module");
const auth_module_1 = require("./modules/auth/auth.module");
const mailer_module_1 = require("./modules/mailer/mailer.module");
const verification_module_1 = require("./modules/verification/verification.module");
const chat_module_1 = require("./modules/chat/chat.module");
const crami_module_1 = require("./modules/crami/crami.module");
const userBalance_module_1 = require("./modules/userBalance/userBalance.module");
const chatLog_module_1 = require("./modules/chatLog/chatLog.module");
const crami_module_1 = require("./modules/crami/crami.module");
const database_module_1 = require("./modules/database/database.module");
const upload_module_1 = require("./modules/upload/upload.module");
const redisCache_module_1 = require("./modules/redisCache/redisCache.module");
const globalConfig_module_1 = require("./modules/globalConfig/globalConfig.module");
const statistic_module_1 = require("./modules/statistic/statistic.module");
const badwords_module_1 = require("./modules/badwords/badwords.module");
const autoreply_module_1 = require("./modules/autoreply/autoreply.module");
const user_module_1 = require("./modules/user/user.module");
const userBalance_module_1 = require("./modules/userBalance/userBalance.module");
const verification_module_1 = require("./modules/verification/verification.module");
const app_module_1 = require("./modules/app/app.module");
const pay_module_1 = require("./modules/pay/pay.module");
const autoreply_module_1 = require("./modules/autoreply/autoreply.module");
const badwords_module_1 = require("./modules/badwords/badwords.module");
const globalConfig_module_1 = require("./modules/globalConfig/globalConfig.module");
const redisCache_module_1 = require("./modules/redisCache/redisCache.module");
const statistic_module_1 = require("./modules/statistic/statistic.module");
const order_module_1 = require("./modules/order/order.module");
const official_module_1 = require("./modules/official/official.module");
const task_module_1 = require("./modules/task/task.module");
const queue_module_1 = require("./modules/queue/queue.module");
const midjourney_module_1 = require("./modules/midjourney/midjourney.module");
const chatGroup_module_1 = require("./modules/chatGroup/chatGroup.module");
const pay_module_1 = require("./modules/pay/pay.module");
const core_1 = require("@nestjs/core");
const serve_static_1 = require("@nestjs/serve-static");
const fetch = require("isomorphic-fetch");
const path_2 = require("path");
global.fetch = fetch;
const core_1 = require("@nestjs/core");
const chatGroup_module_1 = require("./modules/chatGroup/chatGroup.module");
const menu_module_1 = require("./modules/menu/menu.module");
const midjourney_module_1 = require("./modules/midjourney/midjourney.module");
const models_module_1 = require("./modules/models/models.module");
const official_module_1 = require("./modules/official/official.module");
const queue_module_1 = require("./modules/queue/queue.module");
const sales_module_1 = require("./modules/sales/sales.module");
const signin_module_1 = require("./modules/signin/signin.module");
const menu_module_1 = require("./modules/menu/menu.module");
const models_module_1 = require("./modules/models/models.module");
const task_module_1 = require("./modules/task/task.module");
global.fetch = fetch;
let AppModule = class AppModule {
};
AppModule = __decorate([
@ -56,7 +55,6 @@ AppModule = __decorate([
database_module_1.DatabaseModule,
user_module_1.UserModule,
auth_module_1.AuthModule,
mailer_module_1.MailerModule,
verification_module_1.VerificationModule,
chat_module_1.ChatModule,
crami_module_1.CramiModule,

View File

@ -7,7 +7,7 @@ var VerificationUseStatusEnum;
VerificationUseStatusEnum[VerificationUseStatusEnum["USED"] = 1] = "USED";
})(VerificationUseStatusEnum = exports.VerificationUseStatusEnum || (exports.VerificationUseStatusEnum = {}));
exports.ModelsMapCn = {
1: 'AI 模型',
2: '百度千帆大模型',
3: '清华智谱大模型'
1: '普通模型',
2: '绘画模型',
3: '特殊模型'
};

View File

@ -3,25 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.compileNetwork = void 0;
const axios_1 = require("axios");
function formatSearchData(searchData, question) {
const formatStr = searchData.map(({ title, body, href }) => `'${title}' : ${body} ;`).join('\n\n');
const instructions = 'Instructions: Reply to me in the language of my request or question above. Give a comprehensive answer to the question or request I have made above. Below are some results from a web search. Use the following results to summarize the answers \n\n';
return `${question}\n\n${instructions}\n${formatStr}`;
const formatStr = searchData.results.map(({ title, body, href }) => `'${title}' : ${body} ; (${href})`).join('\n\n');
const currentDate = new Date().toISOString().split('T')[0];
const instructions = '你的任务是优先利用网络搜索结果来回答问题,并使用提问时的语言风格进行回复。你应该提供一个全面而有条理的回答,在每条答案后面明确指出来源于哪个链接,使用 [[数字](链接)] 格式进行标注。以下是搜索结果:';
return `${instructions}\n今天是${currentDate}\n${formatStr}`;
}
async function compileNetwork(question, limit = 7) {
let searchData = [];
async function compileNetwork(question) {
const currentDate = new Date().toISOString().split('T')[0];
console.log(`Current date: ${currentDate}`);
console.log(`开始对问题“${question}”进行网络编译`);
const datedQuestion = `${currentDate} ${question}`;
let searchData = { results: [] };
try {
const responseData = await axios_1.default.get(`https://s0.awsl.app/search?q=${question}&max_results=${limit}`);
const url = ``;
console.log(`正在向搜索API发送请求URL为${url}`);
const responseData = await axios_1.default.get(url);
searchData = responseData.data;
console.log(`已成功接收问题“${question}”的搜索结果,结果数量:${searchData.results.length}`);
searchData.results.forEach((result, index) => {
console.log(`结果 ${index + 1}: 标题: ${result.title}, 链接: ${result.href}, 摘要: ${result.body.substring(0, 100)}...`);
});
}
catch (error) {
console.log('error: ', error);
searchData = [];
console.log(`在对问题“${question}”进行网络编译时出错:`, error);
}
if (searchData.length === 0) {
let formattedData = "";
if (searchData.results.length === 0) {
console.log(`未找到问题“${question}”的搜索结果,将返回原问题`);
return question;
}
else {
return formatSearchData(searchData, question);
formattedData = formatSearchData(searchData, question);
console.log(`格式化后的搜索结果为:\n${formattedData}`);
return formattedData;
}
}
exports.compileNetwork = compileNetwork;

24
dist/config/mailer.js vendored
View File

@ -1,24 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter");
const mailConfig = {
transport: {
host: process.env.MAILER_HOST || 'smtpdm.aliyun.com',
port: process.env.MAILER_PORT || '80',
auth: {
user: process.env.MAILER_USER,
pass: process.env.MAILER_PASS,
},
},
defaults: {
from: process.env.MAILER_FROM,
},
template: {
dir: 'templates/mail',
adapter: new handlebars_adapter_1.HandlebarsAdapter(),
options: {
strict: true,
},
},
};
exports.default = mailConfig;

View File

@ -55,6 +55,9 @@ let AppController = class AppController {
appList(req, query) {
return this.appService.appList(req, query);
}
appSystemList() {
return this.appService.appSystemList();
}
list(req, query) {
return this.appService.frontAppList(req, query);
}
@ -67,6 +70,9 @@ let AppController = class AppController {
updateApp(body) {
return this.appService.updateApp(body);
}
updateSystemApp(body) {
return this.appService.updateSystemApp(body);
}
delApp(body) {
return this.appService.delApp(body);
}
@ -152,6 +158,15 @@ __decorate([
__metadata("design:paramtypes", [Object, queryApp_dto_1.QuerAppDto]),
__metadata("design:returntype", void 0)
], AppController.prototype, "appList", null);
__decorate([
(0, common_1.Get)('querySystemApp'),
(0, swagger_1.ApiOperation)({ summary: '获取系统App列表' }),
(0, common_1.UseGuards)(adminAuth_guard_1.AdminAuthGuard),
(0, swagger_1.ApiBearerAuth)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], AppController.prototype, "appSystemList", null);
__decorate([
(0, common_1.Get)('list'),
(0, swagger_1.ApiOperation)({ summary: '客户端获取App' }),
@ -192,6 +207,16 @@ __decorate([
__metadata("design:paramtypes", [updateApp_dto_1.UpdateAppDto]),
__metadata("design:returntype", void 0)
], AppController.prototype, "updateApp", null);
__decorate([
(0, common_1.Post)('updateSystemApp'),
(0, swagger_1.ApiOperation)({ summary: '修改系统App' }),
(0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
(0, swagger_1.ApiBearerAuth)(),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], AppController.prototype, "updateSystemApp", null);
__decorate([
(0, common_1.Post)('delApp'),
(0, swagger_1.ApiOperation)({ summary: '删除App' }),

View File

@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppEntity = void 0;
const typeorm_1 = require("typeorm");
const baseEntity_1 = require("../../common/entity/baseEntity");
const typeorm_1 = require("typeorm");
let AppEntity = class AppEntity extends baseEntity_1.BaseEntity {
};
__decorate([
@ -31,7 +31,7 @@ __decorate([
__metadata("design:type", String)
], AppEntity.prototype, "preset", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: 'App应用封面图片', nullable: true }),
(0, typeorm_1.Column)({ comment: 'App应用封面图片', nullable: true, type: 'text' }),
__metadata("design:type", String)
], AppEntity.prototype, "coverImg", void 0);
__decorate([
@ -50,6 +50,22 @@ __decorate([
(0, typeorm_1.Column)({ comment: 'App应用角色 system user', default: 'system' }),
__metadata("design:type", String)
], AppEntity.prototype, "role", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: 'App应用是否是GPTs', default: '0' }),
__metadata("design:type", Number)
], AppEntity.prototype, "isGPTs", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: 'App应用是否是固定使用模型', default: '0' }),
__metadata("design:type", Number)
], AppEntity.prototype, "isFixedModel", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: 'App应用使用的模型', type: 'text' }),
__metadata("design:type", String)
], AppEntity.prototype, "appModel", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: 'GPTs 的调用ID', default: '' }),
__metadata("design:type", String)
], AppEntity.prototype, "gizmoID", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: 'App是否共享到应用广场', default: false }),
__metadata("design:type", Boolean)
@ -58,6 +74,10 @@ __decorate([
(0, typeorm_1.Column)({ comment: '用户Id', nullable: true }),
__metadata("design:type", Number)
], AppEntity.prototype, "userId", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '是否系统预留', default: false, nullable: true }),
__metadata("design:type", Boolean)
], AppEntity.prototype, "isSystemReserved", void 0);
AppEntity = __decorate([
(0, typeorm_1.Entity)({ name: 'app' })
], AppEntity);

View File

@ -14,10 +14,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppService = void 0;
const common_1 = require("@nestjs/common");
const appCats_entity_1 = require("./appCats.entity");
const typeorm_1 = require("typeorm");
const typeorm_2 = require("@nestjs/typeorm");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const app_entity_1 = require("./app.entity");
const appCats_entity_1 = require("./appCats.entity");
const userApps_entity_1 = require("./userApps.entity");
let AppService = class AppService {
constructor(appCatsEntity, appEntity, userAppsEntity) {
@ -50,7 +50,7 @@ let AppService = class AppService {
}
async updateAppCats(body) {
const { id, name } = body;
const c = await this.appCatsEntity.findOne({ where: { name, id: (0, typeorm_1.Not)(id) } });
const c = await this.appCatsEntity.findOne({ where: { name, id: (0, typeorm_2.Not)(id) } });
if (c) {
throw new common_1.HttpException('该分类名称已存在!', common_1.HttpStatus.BAD_REQUEST);
}
@ -65,18 +65,21 @@ let AppService = class AppService {
throw new common_1.HttpException('缺失必要参数!', common_1.HttpStatus.BAD_REQUEST);
}
const app = await this.appEntity.findOne({ where: { id } });
const { demoData: demo, coverImg, des, name } = app;
const { demoData: demo, coverImg, des, name, isFixedModel, isGPTs, appModel } = app;
return {
demoData: demo ? demo.split('\n') : [],
coverImg,
des,
name,
isGPTs,
isFixedModel,
appModel,
};
}
async appCatsList(query) {
const { page = 1, size = 10, name, status } = query;
const where = {};
name && (where.name = (0, typeorm_1.Like)(`%${name}%`));
name && (where.name = (0, typeorm_2.Like)(`%${name}%`));
[0, 1, '0', '1'].includes(status) && (where.status = status);
const [rows, count] = await this.appCatsEntity.findAndCount({
where,
@ -85,7 +88,7 @@ let AppService = class AppService {
take: size,
});
const catIds = rows.map((item) => item.id);
const apps = await this.appEntity.find({ where: { catId: (0, typeorm_1.In)(catIds) } });
const apps = await this.appEntity.find({ where: { catId: (0, typeorm_2.In)(catIds) } });
const appCountMap = {};
apps.forEach((item) => {
if (appCountMap[item.catId]) {
@ -101,8 +104,8 @@ let AppService = class AppService {
async appList(req, query, orderKey = 'id') {
var _a;
const { page = 1, size = 10, name, status, catId, role } = query;
const where = {};
name && (where.name = (0, typeorm_1.Like)(`%${name}%`));
const where = { isSystemReserved: 0 };
name && (where.name = (0, typeorm_2.Like)(`%${name}%`));
catId && (where.catId = catId);
role && (where.role = role);
status && (where.status = status);
@ -113,7 +116,7 @@ let AppService = class AppService {
take: size,
});
const catIds = rows.map((item) => item.catId);
const cats = await this.appCatsEntity.find({ where: { id: (0, typeorm_1.In)(catIds) } });
const cats = await this.appCatsEntity.find({ where: { id: (0, typeorm_2.In)(catIds) } });
rows.forEach((item) => {
const cat = cats.find((c) => c.id === item.catId);
item.catName = cat ? cat.name : '';
@ -125,12 +128,20 @@ let AppService = class AppService {
}
return { rows, count };
}
async appSystemList() {
const where = { isSystemReserved: 1 };
const [rows, count] = await this.appEntity.findAndCount({
where,
order: { id: 'DESC' },
});
return { rows, count };
}
async frontAppList(req, query, orderKey = 'id') {
var _a;
const { page = 1, size = 1000, name, catId, role } = query;
const where = [
{ status: (0, typeorm_1.In)([1, 4]), userId: (0, typeorm_1.IsNull)(), public: false },
{ userId: (0, typeorm_1.MoreThan)(0), public: true },
{ status: (0, typeorm_2.In)([1, 4]), userId: (0, typeorm_2.IsNull)(), public: false, isSystemReserved: 0 },
{ userId: (0, typeorm_2.MoreThan)(0), public: true },
];
const [rows, count] = await this.appEntity.findAndCount({
where,
@ -139,7 +150,7 @@ let AppService = class AppService {
take: size,
});
const catIds = rows.map((item) => item.catId);
const cats = await this.appCatsEntity.find({ where: { id: (0, typeorm_1.In)(catIds) } });
const cats = await this.appCatsEntity.find({ where: { id: (0, typeorm_2.In)(catIds) } });
rows.forEach((item) => {
const cat = cats.find((c) => c.id === item.catId);
item.catName = cat ? cat.name : '';
@ -198,7 +209,7 @@ let AppService = class AppService {
}
async updateApp(body) {
const { id, name, catId, status } = body;
const a = await this.appEntity.findOne({ where: { name, id: (0, typeorm_1.Not)(id) } });
const a = await this.appEntity.findOne({ where: { name, id: (0, typeorm_2.Not)(id) } });
if (a) {
throw new common_1.HttpException('该应用名称已存在!', common_1.HttpStatus.BAD_REQUEST);
}
@ -215,6 +226,22 @@ let AppService = class AppService {
return '修改App信息成功';
throw new common_1.HttpException('修改App信息失败', common_1.HttpStatus.BAD_REQUEST);
}
async updateSystemApp(body) {
const { id, name } = body;
common_1.Logger.log(`尝试更新应用: ${name} (ID: ${id})`);
const existingApp = await this.appEntity.findOne({ where: { name, id: (0, typeorm_2.Not)(id) } });
if (existingApp) {
common_1.Logger.warn(`应用名称已存在:${name}`);
throw new common_1.HttpException('该应用名称已存在!', common_1.HttpStatus.BAD_REQUEST);
}
const res = await this.appEntity.update({ id }, body);
if (res.affected > 0) {
common_1.Logger.log(`修改系统应用信息成功: ${name}`);
return '修改系统应用信息成功';
}
common_1.Logger.error(`修改系统应用信息失败:${name}`);
throw new common_1.HttpException('修改系统应用信息失败!', common_1.HttpStatus.BAD_REQUEST);
}
async delApp(body) {
const { id } = body;
const a = await this.appEntity.findOne({ where: { id } });
@ -277,38 +304,45 @@ let AppService = class AppService {
const { id, role: appRole, catId } = app;
const collectInfo = { userId, appId: id, catId, appRole, public: true, status: 1 };
await this.userAppsEntity.save(collectInfo);
return '已将应用加入到我的个人工作台';
return '已将应用加入到我的收藏';
}
async mineApps(req, query = { page: 1, size: 30 }) {
const { id } = req.user;
const { page = 1, size = 30 } = query;
const [rows, count] = await this.userAppsEntity.findAndCount({
where: { userId: id, status: (0, typeorm_1.In)([1, 3, 4, 5]) },
let rows, count;
try {
[rows, count] = await this.userAppsEntity.findAndCount({
where: { userId: id, status: (0, typeorm_2.In)([1, 3, 4, 5]) },
order: { id: 'DESC' },
skip: (page - 1) * size,
take: size,
});
const appIds = rows.map((item) => item.appId);
const appsInfo = await this.appEntity.find({ where: { id: (0, typeorm_1.In)(appIds) } });
const appsInfo = await this.appEntity.find({ where: { id: (0, typeorm_2.In)(appIds) } });
rows.forEach((item) => {
const app = appsInfo.find((c) => c.id === item.appId);
item.appName = app ? app.name : '';
item.appRole = app ? app.role : '';
item.appDes = app ? app.des : '';
item.coverImg = app ? app.coverImg : '';
item.demoData = app ? app.demoData : '';
item.appName = app ? app.name : '未知';
item.appRole = app ? app.role : '未知';
item.appDes = app ? app.des : '未知';
item.coverImg = app ? app.coverImg : '未知';
item.demoData = app ? app.demoData : '未知';
item.preset = app.userId === id ? app.preset : '******';
});
}
catch (error) {
console.error(`处理用户ID: ${id} 的mineApps请求时发生错误`, error);
throw error;
}
return { rows, count };
}
};
AppService = __decorate([
(0, common_1.Injectable)(),
__param(0, (0, typeorm_2.InjectRepository)(appCats_entity_1.AppCatsEntity)),
__param(1, (0, typeorm_2.InjectRepository)(app_entity_1.AppEntity)),
__param(2, (0, typeorm_2.InjectRepository)(userApps_entity_1.UserAppsEntity)),
__metadata("design:paramtypes", [typeorm_1.Repository,
typeorm_1.Repository,
typeorm_1.Repository])
__param(0, (0, typeorm_1.InjectRepository)(appCats_entity_1.AppCatsEntity)),
__param(1, (0, typeorm_1.InjectRepository)(app_entity_1.AppEntity)),
__param(2, (0, typeorm_1.InjectRepository)(userApps_entity_1.UserAppsEntity)),
__metadata("design:paramtypes", [typeorm_2.Repository,
typeorm_2.Repository,
typeorm_2.Repository])
], AppService);
exports.AppService = AppService;

View File

@ -38,6 +38,16 @@ __decorate([
(0, class_validator_1.IsOptional)(),
__metadata("design:type", String)
], CreateAppDto.prototype, "preset", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'GPTs 的调用ID', description: 'GPTs 使用的 ID', required: false }),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", String)
], CreateAppDto.prototype, "gizmoID", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ description: '是否GPTs', required: false }),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", Number)
], CreateAppDto.prototype, "isGPTs", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'https://xxxx.png', description: '套餐封面图片', required: false }),
(0, class_validator_1.IsOptional)(),

View File

@ -13,18 +13,13 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthController = void 0;
const verifyCode_dto_1 = require("./../verification/dto/verifyCode.dto");
const authLogin_dto_1 = require("./dto/authLogin.dto");
const common_1 = require("@nestjs/common");
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const auth_service_1 = require("./auth.service");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const authRegister_dto_1 = require("./dto/authRegister.dto");
const updatePassword_dto_1 = require("./dto/updatePassword.dto");
const auth_service_1 = require("./auth.service");
const authLogin_dto_1 = require("./dto/authLogin.dto");
const updatePassByOther_dto_1 = require("./dto/updatePassByOther.dto");
const sendPhoneCode_dto_1 = require("./dto/sendPhoneCode.dto");
const userRegisterByPhone_dto_1 = require("./dto/userRegisterByPhone.dto");
const loginByPhone_dt_1 = require("./dto/loginByPhone.dt");
const updatePassword_dto_1 = require("./dto/updatePassword.dto");
let AuthController = class AuthController {
constructor(authService) {
this.authService = authService;
@ -32,15 +27,9 @@ let AuthController = class AuthController {
async register(body, req) {
return await this.authService.register(body, req);
}
async registerByPhone(body, req) {
return await this.authService.registerByPhone(body, req);
}
async login(body, req) {
return this.authService.login(body, req);
}
async loginByPhone(body, req) {
return this.authService.loginByPhone(body, req);
}
async updatePassword(req, body) {
return this.authService.updatePassword(req, body);
}
@ -50,22 +39,11 @@ let AuthController = class AuthController {
async getInfo(req) {
return this.authService.getInfo(req);
}
async activateAccount(parmas, res) {
return this.authService.activateAccount(parmas, res);
}
async registerSuccess(parmas) {
const { username, id, email, teamName, registerSuccessEmailTitle, registerSuccessEmailTeamName, registerSuccessEmaileAppend } = parmas;
return { username, id, email, teamName, registerSuccessEmailTitle, registerSuccessEmailTeamName, registerSuccessEmaileAppend };
}
async registerError(parmas) {
const { message, teamName, registerFailEmailTitle, registerFailEmailTeamName } = parmas;
return { message, teamName, registerFailEmailTitle, registerFailEmailTeamName };
}
async captcha(parmas) {
return this.authService.captcha(parmas);
}
async sendPhoneCode(parmas) {
return this.authService.sendPhoneCode(parmas);
async sendCode(parmas) {
return this.authService.sendCode(parmas);
}
};
__decorate([
@ -74,18 +52,9 @@ __decorate([
__param(0, (0, common_1.Body)()),
__param(1, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [authRegister_dto_1.UserRegisterDto, Object]),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "register", null);
__decorate([
(0, common_1.Post)('registerByPhone'),
(0, swagger_1.ApiOperation)({ summary: '用户通过手机号注册' }),
__param(0, (0, common_1.Body)()),
__param(1, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [userRegisterByPhone_dto_1.UserRegisterByPhoneDto, Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "registerByPhone", null);
__decorate([
(0, common_1.Post)('login'),
(0, swagger_1.ApiOperation)({ summary: '用户登录' }),
@ -95,15 +64,6 @@ __decorate([
__metadata("design:paramtypes", [authLogin_dto_1.UserLoginDto, Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "login", null);
__decorate([
(0, common_1.Post)('loginByPhone'),
(0, swagger_1.ApiOperation)({ summary: '用户手机号登录' }),
__param(0, (0, common_1.Body)()),
__param(1, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [loginByPhone_dt_1.LoginByPhoneDto, Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "loginByPhone", null);
__decorate([
(0, common_1.Post)('updatePassword'),
(0, swagger_1.ApiOperation)({ summary: '用户更改密码' }),
@ -136,33 +96,6 @@ __decorate([
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "getInfo", null);
__decorate([
(0, common_1.Get)('activateAccount'),
(0, swagger_1.ApiOperation)({ summary: '账户激活' }),
__param(0, (0, common_1.Query)()),
__param(1, (0, common_1.Res)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [verifyCode_dto_1.VerifyCodeDto, Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "activateAccount", null);
__decorate([
(0, common_1.Get)('registerSuccess'),
(0, swagger_1.ApiOperation)({ summary: '注册成功页面' }),
(0, common_1.Render)('registerSuccess'),
__param(0, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "registerSuccess", null);
__decorate([
(0, common_1.Get)('registerError'),
(0, swagger_1.ApiOperation)({ summary: '注册失败页面' }),
(0, common_1.Render)('registerError'),
__param(0, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "registerError", null);
__decorate([
(0, common_1.Post)('captcha'),
(0, swagger_1.ApiOperation)({ summary: '获取一个图形验证码' }),
@ -172,13 +105,13 @@ __decorate([
__metadata("design:returntype", Promise)
], AuthController.prototype, "captcha", null);
__decorate([
(0, common_1.Post)('sendPhoneCode'),
(0, swagger_1.ApiOperation)({ summary: '发送手机验证码' }),
(0, common_1.Post)('sendCode'),
(0, swagger_1.ApiOperation)({ summary: '发送验证码' }),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [sendPhoneCode_dto_1.SendPhoneCodeDto]),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "sendPhoneCode", null);
], AuthController.prototype, "sendCode", null);
AuthController = __decorate([
(0, swagger_1.ApiTags)('auth'),
(0, common_1.Controller)('auth'),

View File

@ -7,34 +7,34 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthModule = void 0;
const verifycation_entity_1 = require("./../verification/verifycation.entity");
const typeorm_1 = require("@nestjs/typeorm");
const verification_service_1 = require("./../verification/verification.service");
const mailer_service_1 = require("../mailer/mailer.service");
const nestjs_config_1 = require("nestjs-config");
const auth_controller_1 = require("./auth.controller");
const common_1 = require("@nestjs/common");
const auth_service_1 = require("./auth.service");
const user_module_1 = require("../user/user.module");
const passport_1 = require("@nestjs/passport");
const jwt_1 = require("@nestjs/jwt");
const jwt_strategy_1 = require("../../common/auth/jwt.strategy");
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const balance_entity_1 = require("../userBalance/balance.entity");
const accountLog_entity_1 = require("../userBalance/accountLog.entity");
const config_entity_1 = require("../globalConfig/config.entity");
const common_1 = require("@nestjs/common");
const jwt_1 = require("@nestjs/jwt");
const passport_1 = require("@nestjs/passport");
const typeorm_1 = require("@nestjs/typeorm");
const nestjs_config_1 = require("nestjs-config");
const whiteList_entity_1 = require("../chat/whiteList.entity");
const chatGroup_entity_1 = require("../chatGroup/chatGroup.entity");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const config_entity_1 = require("../globalConfig/config.entity");
const mailer_service_1 = require("../mailer/mailer.service");
const midjourney_entity_1 = require("../midjourney/midjourney.entity");
const redisCache_module_1 = require("../redisCache/redisCache.module");
const userBalance_entity_1 = require("../userBalance/userBalance.entity");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const salesUsers_entity_1 = require("../sales/salesUsers.entity");
const user_entity_1 = require("../user/user.entity");
const whiteList_entity_1 = require("../chat/whiteList.entity");
const user_module_1 = require("../user/user.module");
const accountLog_entity_1 = require("../userBalance/accountLog.entity");
const balance_entity_1 = require("../userBalance/balance.entity");
const fingerprint_entity_1 = require("../userBalance/fingerprint.entity");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const chatGroup_entity_1 = require("../chatGroup/chatGroup.entity");
const midjourney_entity_1 = require("../midjourney/midjourney.entity");
const userBalance_entity_1 = require("../userBalance/userBalance.entity");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const verification_service_1 = require("./../verification/verification.service");
const verifycation_entity_1 = require("./../verification/verifycation.entity");
const auth_controller_1 = require("./auth.controller");
const auth_service_1 = require("./auth.service");
let AuthModule = class AuthModule {
};
AuthModule = __decorate([

View File

@ -13,23 +13,22 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthService = void 0;
const user_constant_1 = require("../../common/constants/user.constant");
const utils_1 = require("../../common/utils");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const verification_constant_1 = require("../../common/constants/verification.constant");
const verification_service_1 = require("./../verification/verification.service");
const common_1 = require("@nestjs/common");
const jwt_1 = require("@nestjs/jwt");
const user_service_1 = require("../user/user.service");
const mailer_service_1 = require("../mailer/mailer.service");
const user_constant_1 = require("../../common/constants/user.constant");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const config_entity_1 = require("../globalConfig/config.entity");
const typeorm_1 = require("typeorm");
const typeorm_2 = require("@nestjs/typeorm");
const utils_1 = require("../../common/utils");
const os = require("os");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const svgCaptcha = require("svg-captcha");
const typeorm_1 = require("@nestjs/typeorm");
const bcrypt = require("bcryptjs");
const os = require("os");
const svgCaptcha = require("svg-captcha");
const typeorm_2 = require("typeorm");
const config_entity_1 = require("../globalConfig/config.entity");
const mailer_service_1 = require("../mailer/mailer.service");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const user_service_1 = require("../user/user.service");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const verification_service_1 = require("./../verification/verification.service");
let AuthService = class AuthService {
constructor(configEntity, userService, jwtService, mailerService, verificationService, userBalanceService, redisCacheService, globalConfigService) {
this.configEntity = configEntity;
@ -45,56 +44,75 @@ let AuthService = class AuthService {
this.getIp();
}
async register(body, req) {
await this.verificationService.verifyCaptcha(body);
const user = await this.userService.createUserAndVerifycation(body, req);
const { username, email, client, id } = user;
const res = { username, email, id };
client && (res.client = client);
return res;
const { username, password, contact, code, invitedBy } = body;
let email = '', phone = '';
const isEmail = /\S+@\S+\.\S+/.test(contact);
const isPhone = /^\d{10,}$/.test(contact);
if (isEmail) {
email = contact;
await this.userService.verifyUserRegister({ username, email });
}
else if (isPhone) {
phone = contact;
await this.userService.verifyUserRegister({ username, phone });
}
else {
throw new common_1.HttpException('请提供有效的邮箱地址或手机号码。', common_1.HttpStatus.BAD_REQUEST);
}
async registerByPhone(body, req) {
const { username, password, phone, phoneCode, invitedBy } = body;
await this.userService.verifyUserRegisterByPhone(body);
const nameSpace = await this.globalConfigService.getNamespace();
const key = `${nameSpace}:PHONECODE:${phone}`;
const redisPhoneCode = await this.redisCacheService.get({ key });
if (!redisPhoneCode) {
throw new common_1.HttpException('验证码已过期、请重新发送!', common_1.HttpStatus.BAD_REQUEST);
const key = `${nameSpace}:CODE:${contact}`;
const redisCode = await this.redisCacheService.get({ key });
if (!redisCode) {
common_1.Logger.log(`验证码过期: ${contact}`);
throw new common_1.HttpException('验证码已过期,请重新发送!', common_1.HttpStatus.BAD_REQUEST);
}
if (phoneCode !== redisPhoneCode) {
throw new common_1.HttpException('验证码填写错误、请重新输入!', common_1.HttpStatus.BAD_REQUEST);
if (code !== redisCode) {
common_1.Logger.log(`验证码错误: ${contact} 输入的验证码: ${code}, 期望的验证码: ${redisCode}`);
throw new common_1.HttpException('验证码填写错误,请重新输入!', common_1.HttpStatus.BAD_REQUEST);
}
const email = `${(0, utils_1.createRandomUid)()}@nine.com`;
const newUser = { username, password, phone, invitedBy, email, status: user_constant_1.UserStatusEnum.ACTIVE };
console.log('开始创建用户...');
let newUser;
if (isEmail) {
newUser = { username, password, email: contact, invitedBy, status: user_constant_1.UserStatusEnum.ACTIVE };
}
else {
const email = `${(0, utils_1.createRandomUid)()}@aiweb.com`;
newUser = { username, password, email, phone: contact, invitedBy, status: user_constant_1.UserStatusEnum.ACTIVE };
}
;
console.log('获取默认用户头像...');
const userDefautlAvatar = await this.globalConfigService.getConfigs(['userDefautlAvatar']);
console.log(`使用默认用户头像: ${userDefautlAvatar}`);
newUser.avatar = userDefautlAvatar;
console.log('加密用户密码...');
const hashedPassword = bcrypt.hashSync(password, 10);
newUser.password = hashedPassword;
console.log('保存新用户到数据库...');
const u = await this.userService.createUser(newUser);
console.log(`用户创建成功用户ID: ${u.id}`);
let inviteUser;
if (invitedBy) {
inviteUser = await this.userService.qureyUserInfoByInviteCode(invitedBy);
}
await this.userBalanceService.addBalanceToNewUser(u.id, inviteUser === null || inviteUser === void 0 ? void 0 : inviteUser.id);
return;
return { success: true, message: '注册成功' };
}
async login(user, req) {
console.log(`开始用户登录流程,用户名: ${user.username}`);
const u = await this.userService.verifyUserCredentials(user);
const { username, id, email, role, openId, client } = u;
const ip = (0, utils_1.getClientIp)(req);
await this.userService.savaLoginIp(id, ip);
const token = await this.jwtService.sign({ username, id, email, role, openId, client });
await this.redisCacheService.saveToken(id, token);
return token;
if (!u) {
console.error(`登录失败: 用户凭证无效 - 用户名: ${user.username}`);
throw new common_1.HttpException('登录失败,用户凭证无效。', common_1.HttpStatus.UNAUTHORIZED);
}
async loginByPhone(body, req) {
const u = await this.userService.verifyUserCredentials(body);
const { username, id, email, role, openId, client } = u;
const { username, id, email, role, openId, client, phone } = u;
console.log(`用户凭证验证成功用户ID: ${id}, 用户名: ${username}`);
const ip = (0, utils_1.getClientIp)(req);
await this.userService.savaLoginIp(id, ip);
const { phone } = body;
console.log(`保存登录IP: ${ip} - 用户ID: ${id}`);
const token = await this.jwtService.sign({ username, id, email, role, openId, client, phone });
console.log(`JWT令牌生成成功 - 用户ID: ${id}`);
await this.redisCacheService.saveToken(id, token);
console.log(`令牌已保存到Redis - 用户ID: ${id}`);
return token;
}
async loginByOpenId(user, req) {
@ -113,48 +131,6 @@ let AuthService = class AuthService {
const { id } = req.user;
return await this.userService.getUserInfo(id);
}
async activateAccount(params, res) {
const emailConfigs = await this.configEntity.find({
where: {
configKey: (0, typeorm_1.In)([
'registerSuccessEmailTitle',
'registerSuccessEmailTeamName',
'registerSuccessEmaileAppend',
'registerFailEmailTitle',
'registerFailEmailTeamName',
]),
},
});
const configMap = emailConfigs.reduce((pre, cur) => {
pre[cur.configKey] = cur.configVal;
return pre;
}, {});
try {
const v = await this.verificationService.verifyCode(params, verification_constant_1.VerificationEnum.Registration);
const { type, userId } = v;
if (type !== verification_constant_1.VerificationEnum.Registration) {
throw new common_1.HttpException('验证码类型错误', common_1.HttpStatus.BAD_REQUEST);
}
const status = await this.userService.getUserStatus(userId);
if (status === user_constant_1.UserStatusEnum.ACTIVE) {
throw new common_1.HttpException('账户已被激活过', common_1.HttpStatus.BAD_REQUEST);
}
await this.userService.updateUserStatus(v.userId, user_constant_1.UserStatusEnum.ACTIVE);
const u = await this.userService.queryUserInfoById(v.userId);
const { username, email, id, invitedBy } = u;
let inviteUser;
if (invitedBy) {
inviteUser = await this.userService.qureyUserInfoByInviteCode(invitedBy);
}
await this.userBalanceService.addBalanceToNewUser(id, inviteUser === null || inviteUser === void 0 ? void 0 : inviteUser.id);
res.redirect(`/api/auth/registerSuccess?id=${id.toString().padStart(4, '0')}&username=${username}&email=${email}&registerSuccessEmailTitle=${configMap.registerSuccessEmailTitle}&registerSuccessEmailTeamName=${configMap.registerSuccessEmailTeamName}&registerSuccessEmaileAppend=${configMap.registerSuccessEmaileAppend}`);
}
catch (error) {
console.log('error: ', error);
const message = error.response;
res.redirect(`/api/auth/registerError?message=${message}&registerFailEmailTitle=${configMap.registerFailEmailTitle}&registerFailEmailTeamName=${configMap.registerFailEmailTeamName}`);
}
}
async updatePassword(req, body) {
const { id, client, role } = req.user;
if (client && Number(client) > 0) {
@ -196,7 +172,7 @@ let AuthService = class AuthService {
async captcha(parmas) {
const nameSpace = await this.globalConfigService.getNamespace();
const { color = '#fff' } = parmas;
const captcha = svgCaptcha.createMathExpr({ background: color, height: 34, width: 120, noise: 3 });
const captcha = svgCaptcha.createMathExpr({ background: color, height: 30, width: 120, noise: 5 });
const text = captcha.text;
const randomId = (0, utils_1.createRandomUid)();
const key = `${nameSpace}:CAPTCHA:${randomId}`;
@ -206,20 +182,64 @@ let AuthService = class AuthService {
code: randomId,
};
}
async sendPhoneCode(body) {
async sendCode(body) {
await this.verificationService.verifyCaptcha(body);
const { phone } = body;
const nameSpace = await this.globalConfigService.getNamespace();
const key = `${nameSpace}:PHONECODE:${phone}`;
const ttl = await this.redisCacheService.ttl(key);
if (ttl && ttl > 0) {
throw new common_1.HttpException(`${ttl}秒内不得重复发送短信!`, common_1.HttpStatus.BAD_REQUEST);
}
const { contact, username } = body;
let email = '', phone = '';
const code = (0, utils_1.createRandomCode)();
const isEmail = /\S+@\S+\.\S+/.test(contact);
const isPhone = /^\d{10,}$/.test(contact);
if (isEmail) {
email = contact;
await this.userService.verifyUserRegister({ username, email });
}
else if (isPhone) {
phone = contact;
await this.userService.verifyUserRegister({ username, phone });
}
else {
throw new common_1.HttpException('请提供有效的邮箱地址或手机号码。', common_1.HttpStatus.BAD_REQUEST);
}
const nameSpace = await this.globalConfigService.getNamespace();
const key = `${nameSpace}:CODE:${contact}`;
const ttl = await this.redisCacheService.ttl(key);
if (ttl && ttl > 0 && isPhone) {
throw new common_1.HttpException(`${ttl}秒内不得重复发送验证码!`, common_1.HttpStatus.BAD_REQUEST);
}
if (isEmail) {
const existingCode = await this.redisCacheService.get({ key });
if (existingCode) {
await this.mailerService.sendMail({
to: email,
context: {
code: existingCode,
},
});
return `验证码发送成功、请填写验证码完成注册!`;
}
else {
try {
await this.mailerService.sendMail({
to: email,
context: {
code: code,
},
});
console.log('邮件发送成功');
}
catch (error) {
console.error('邮件发送失败', error);
}
await this.redisCacheService.set({ key, val: code }, 10 * 60);
return `验证码发送成功、请填写验证码完成注册!`;
}
}
else if (isPhone) {
const messageInfo = { phone, code };
await this.verificationService.sendPhoneCode(messageInfo);
await this.redisCacheService.set({ key, val: code }, 1 * 60);
return '验证码发送成功、请填写验证码完成注册!';
await this.redisCacheService.set({ key, val: code }, 10 * 60);
return `验证码发送成功、请填写验证码完成注册!`;
}
}
createTokenFromFingerprint(fingerprint) {
const token = this.jwtService.sign({
@ -235,8 +255,8 @@ let AuthService = class AuthService {
};
AuthService = __decorate([
(0, common_1.Injectable)(),
__param(0, (0, typeorm_2.InjectRepository)(config_entity_1.ConfigEntity)),
__metadata("design:paramtypes", [typeorm_1.Repository,
__param(0, (0, typeorm_1.InjectRepository)(config_entity_1.ConfigEntity)),
__metadata("design:paramtypes", [typeorm_2.Repository,
user_service_1.UserService,
jwt_1.JwtService,
mailer_service_1.MailerService,

View File

@ -0,0 +1,153 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var ApiDataService_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiDataService = void 0;
const common_1 = require("@nestjs/common");
const axios_1 = require("axios");
const uuid = require("uuid");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const upload_service_1 = require("../upload/upload.service");
let ApiDataService = ApiDataService_1 = class ApiDataService {
constructor(uploadService, globalConfigService) {
this.uploadService = uploadService;
this.globalConfigService = globalConfigService;
this.logger = new common_1.Logger(ApiDataService_1.name);
}
async chatFree(prompt, systemMessage, messagesHistory) {
const { openaiBaseUrl = '', openaiBaseKey = '', openaiBaseModel, } = await this.globalConfigService.getConfigs([
'openaiBaseKey',
'openaiBaseUrl',
'openaiBaseModel',
]);
const key = openaiBaseKey;
const proxyUrl = openaiBaseUrl;
let requestData = [];
if (systemMessage) {
requestData.push({
"role": "system",
"content": systemMessage
});
}
if (messagesHistory && messagesHistory.length > 0) {
requestData = requestData.concat(messagesHistory);
}
else {
requestData.push({
"role": "user",
"content": prompt
});
}
const options = {
method: 'POST',
url: `${proxyUrl}/v1/chat/completions`,
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${key}`,
},
data: {
model: openaiBaseModel || 'gpt-3.5-turbo-0125',
messages: requestData,
},
};
try {
const response = await (0, axios_1.default)(options);
common_1.Logger.log(`全局模型调用成功, 返回结果: ${response === null || response === void 0 ? void 0 : response.data.choices[0].message.content}`);
return response === null || response === void 0 ? void 0 : response.data.choices[0].message.content;
}
catch (error) {
console.log('error: ', error);
}
}
async dalleDraw(inputs, messagesHistory) {
var _a, _b, _c, _d;
common_1.Logger.log('开始提交 Dalle 绘图任务 ', 'DrawService');
const { apiKey, model, proxyUrl, prompt, extraParam, timeout, onSuccess, onFailure } = inputs;
const size = (extraParam === null || extraParam === void 0 ? void 0 : extraParam.size) || '1024x1024';
let result = { answer: '', fileInfo: '', status: 2 };
try {
const options = {
method: 'POST',
url: `${proxyUrl}/v1/images/generations`,
timeout: timeout,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKey}`,
},
data: {
model: model,
prompt: prompt,
size,
},
};
const response = await (0, axios_1.default)(options);
common_1.Logger.debug(`请求成功${JSON.stringify(response.data.data[0])}`);
common_1.Logger.debug(`请求状态${JSON.stringify(response.status)}`);
const url = response.data.data[0].url;
try {
const filename = `${Date.now()}-${uuid.v4().slice(0, 4)}.png`;
common_1.Logger.debug(`------> 开始上传图片!!!`, 'DrawService');
result.fileInfo = await this.uploadService.uploadFileFromUrl({ filename, url: url });
common_1.Logger.debug(`图片上传成功URL: ${result.fileInfo}`, 'DrawService');
}
catch (error) {
common_1.Logger.error(`上传图片过程中出现错误: ${error}`, 'DrawService');
}
let revised_prompt_cn;
try {
revised_prompt_cn = await this.chatFree(`根据提示词{${response.data.data[0].revised_prompt}}, 模拟AI绘画机器人的语气用中文回复告诉用户已经画好了`);
}
catch (error) {
revised_prompt_cn = `${prompt} 绘制成功`;
common_1.Logger.error("翻译失败: ", error);
}
result.answer = revised_prompt_cn;
result.status = 3;
onSuccess(result);
return;
}
catch (error) {
result.status = 5;
onFailure(result);
const status = ((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) || 500;
console.log('draw error: ', JSON.stringify(error), status);
const message = (_d = (_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) === null || _d === void 0 ? void 0 : _d.message;
if (status === 429) {
result.text = '当前请求已过载、请稍等会儿再试试吧!';
return result;
}
if (status === 400 && message.includes('This request has been blocked by our content filters')) {
result.text = '您的请求已被系统拒绝。您的提示可能存在一些非法的文本。';
return result;
}
if (status === 400 && message.includes('Billing hard limit has been reached')) {
result.text = '当前模型key已被封禁、已冻结当前调用Key、尝试重新对话试试吧';
return result;
}
if (status === 500) {
result.text = '绘制图片失败,请检查你的提示词是否有非法描述!';
return result;
}
if (status === 401) {
result.text = '绘制图片失败,此次绘画被拒绝了!';
return result;
}
result.text = '绘制图片失败,请稍后试试吧!';
return result;
}
}
};
ApiDataService = ApiDataService_1 = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [upload_service_1.UploadService,
globalConfig_service_1.GlobalConfigService])
], ApiDataService);
exports.ApiDataService = ApiDataService;

View File

@ -13,12 +13,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatController = void 0;
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const swagger_1 = require("@nestjs/swagger");
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const chat_service_1 = require("./chat.service");
const common_1 = require("@nestjs/common");
const chatProcess_dto_1 = require("./dto/chatProcess.dto");
const chatDraw_dto_1 = require("./dto/chatDraw.dto");
const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
@ -37,23 +36,10 @@ let ChatController = class ChatController {
return this.chatService.ttsProcess(body, req, res);
}
async mjFanyi(body, req) {
const mjTranslatePrompt = await this.globalConfigService.getConfigs(['mjTranslatePrompt']);
body.model = 'translation-';
body.systemMessage =
mjTranslatePrompt ||
`接下来我会给你一些内容、我希望你帮我翻译成英文、不管我给你任何语言、你都回复我英文、如果给你了英文、依然回复我更加优化的英文、并且期望你不需要做任何多余的解释、给我英文即可、不要加任何东西、我只需要英文!`;
return this.chatService.chatProcess(Object.assign(Object.assign({}, body), { specialModel: true }), req);
return this.chatService.chatProcess(Object.assign(Object.assign({}, body), { specialModel: 'PromptOptimization' }), req);
}
async chatmind(body, req, res) {
const mindCustomPrompt = await this.globalConfigService.getConfigs(['mindCustomPrompt']);
body.model = 'mindmap-';
body.systemMessage =
mindCustomPrompt ||
`我希望你使用markdown格式回答我得问题、我的需求是得到一份markdown格式的大纲、尽量做的精细、层级多一点、不管我问你什么、都需要您回复我一个大纲出来、我想使用大纲做思维导图、除了大纲之外、不要无关内容和总结。`;
return this.chatService.chatProcess(Object.assign(Object.assign({}, body), { specialModel: true }), req, res);
}
async draw(body, req) {
return await this.chatService.draw(body, req);
return this.chatService.chatProcess(Object.assign(Object.assign({}, body), { specialModel: 'MindMap' }), req, res);
}
async setChatBoxType(req, body) {
return await this.chatService.setChatBoxType(req, body);
@ -156,17 +142,6 @@ __decorate([
__metadata("design:paramtypes", [chatProcess_dto_1.ChatProcessDto, Object, Object]),
__metadata("design:returntype", Promise)
], ChatController.prototype, "chatmind", null);
__decorate([
(0, common_1.Post)('chat-draw'),
(0, swagger_1.ApiOperation)({ summary: 'gpt绘画' }),
(0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
(0, swagger_1.ApiBearerAuth)(),
__param(0, (0, common_1.Body)()),
__param(1, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [chatDraw_dto_1.ChatDrawDto, Object]),
__metadata("design:returntype", Promise)
], ChatController.prototype, "draw", null);
__decorate([
(0, common_1.Post)('setChatBoxType'),
(0, swagger_1.ApiOperation)({ summary: '添加修改分类类型' }),

View File

@ -8,32 +8,34 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatModule = void 0;
const common_1 = require("@nestjs/common");
const chat_controller_1 = require("./chat.controller");
const chat_service_1 = require("./chat.service");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const typeorm_1 = require("@nestjs/typeorm");
const balance_entity_1 = require("../userBalance/balance.entity");
const user_service_1 = require("../user/user.service");
const app_entity_1 = require("../app/app.entity");
const chatGroup_entity_1 = require("../chatGroup/chatGroup.entity");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const chatLog_service_1 = require("../chatLog/chatLog.service");
const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
const config_entity_1 = require("../globalConfig/config.entity");
const mailer_service_1 = require("../mailer/mailer.service");
const midjourney_entity_1 = require("../midjourney/midjourney.entity");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const salesUsers_entity_1 = require("../sales/salesUsers.entity");
const user_entity_1 = require("../user/user.entity");
const user_service_1 = require("../user/user.service");
const accountLog_entity_1 = require("../userBalance/accountLog.entity");
const balance_entity_1 = require("../userBalance/balance.entity");
const fingerprint_entity_1 = require("../userBalance/fingerprint.entity");
const userBalance_entity_1 = require("../userBalance/userBalance.entity");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const verification_service_1 = require("../verification/verification.service");
const verifycation_entity_1 = require("../verification/verifycation.entity");
const chatLog_service_1 = require("../chatLog/chatLog.service");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const accountLog_entity_1 = require("../userBalance/accountLog.entity");
const config_entity_1 = require("../globalConfig/config.entity");
const whiteList_entity_1 = require("./whiteList.entity");
const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
const chatGroup_entity_1 = require("../chatGroup/chatGroup.entity");
const app_entity_1 = require("../app/app.entity");
const userBalance_entity_1 = require("../userBalance/userBalance.entity");
const salesUsers_entity_1 = require("../sales/salesUsers.entity");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const fingerprint_entity_1 = require("../userBalance/fingerprint.entity");
const midjourney_entity_1 = require("../midjourney/midjourney.entity");
const chatBoxType_entity_1 = require("./chatBoxType.entity");
const apiDataService_service_1 = require("./apiDataService.service");
const chat_controller_1 = require("./chat.controller");
const chat_service_1 = require("./chat.service");
const chatBox_entity_1 = require("./chatBox.entity");
const chatPreType_entity_1 = require("./chatPreType.entity");
const chatBoxType_entity_1 = require("./chatBoxType.entity");
const chatPre_entity_1 = require("./chatPre.entity");
const chatPreType_entity_1 = require("./chatPreType.entity");
const whiteList_entity_1 = require("./whiteList.entity");
let ChatModule = class ChatModule {
};
ChatModule = __decorate([
@ -59,11 +61,11 @@ ChatModule = __decorate([
chatBoxType_entity_1.ChatBoxTypeEntity,
chatBox_entity_1.ChatBoxEntity,
chatPreType_entity_1.ChatPreTypeEntity,
chatPre_entity_1.ChatPreEntity
chatPre_entity_1.ChatPreEntity,
]),
],
controllers: [chat_controller_1.ChatController],
providers: [chat_service_1.ChatService, userBalance_service_1.UserBalanceService, user_service_1.UserService, verification_service_1.VerificationService, chatLog_service_1.ChatLogService, redisCache_service_1.RedisCacheService],
providers: [chat_service_1.ChatService, userBalance_service_1.UserBalanceService, user_service_1.UserService, verification_service_1.VerificationService, chatLog_service_1.ChatLogService, redisCache_service_1.RedisCacheService, apiDataService_service_1.ApiDataService, mailer_service_1.MailerService],
exports: [chat_service_1.ChatService]
})
], ChatModule);

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NineStore = void 0;
const uuid_1 = require("uuid");
const tiktoken_1 = require("@dqbd/tiktoken");
const uuid_1 = require("uuid");
const tokenizer = (0, tiktoken_1.get_encoding)('cl100k_base');
class NineStore {
constructor(options) {
@ -29,10 +29,14 @@ class NineStore {
let { systemMessage = '', fileInfo, model, groupId, maxRounds = 5, maxModelTokens = 4000, isFileUpload = 0 } = options;
let messages = [];
if (systemMessage) {
console.log('Adding system message:', systemMessage);
messages.push({ role: 'system', content: systemMessage });
}
if (groupId) {
console.log('Querying chat history for groupId:', groupId, 'with maxRounds:', maxRounds);
const history = await chatLogService.chatHistory(groupId, maxRounds);
console.log('Received history records:', history.length);
let tempUserMessage = null;
history.forEach((record) => {
let content;
if (isFileUpload === 2 && record.fileInfo) {
@ -47,7 +51,14 @@ class NineStore {
else {
content = record.text;
}
if (record.role === 'user') {
tempUserMessage = { role: record.role, content };
}
else if (record.role === 'assistant' && tempUserMessage && content.trim() !== '') {
messages.push(tempUserMessage);
messages.push({ role: record.role, content });
tempUserMessage = null;
}
});
}
let currentMessageContent;
@ -66,18 +77,29 @@ class NineStore {
messages.push({ role: 'user', content: currentMessageContent });
let totalTokens = await this._getTokenCount(messages);
while (totalTokens > maxModelTokens / 2) {
let foundNonSystemMessage = false;
if (messages.length === 2 && messages[0].role === 'system' && messages[1].role === 'user') {
break;
}
let foundPairToDelete = false;
for (let i = 0; i < messages.length; i++) {
if (messages[i].role !== 'system') {
if (messages[i].role !== 'system' && messages[i + 1] && messages[i + 1].role === 'assistant') {
messages.splice(i, 2);
foundNonSystemMessage = true;
foundPairToDelete = true;
break;
}
}
if (!foundNonSystemMessage) {
if (!foundPairToDelete) {
for (let i = 0; i < messages.length; i++) {
if (messages[i].role === 'user') {
messages.splice(i, 1);
break;
}
}
}
totalTokens = await this._getTokenCount(messages);
if (messages.length <= 2) {
break;
}
}
return {
messagesHistory: messages,

View File

@ -14,11 +14,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatGroupService = void 0;
const common_1 = require("@nestjs/common");
const chatGroup_entity_1 = require("./chatGroup.entity");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const app_entity_1 = require("../app/app.entity");
const models_service_1 = require("../models/models.service");
const chatGroup_entity_1 = require("./chatGroup.entity");
let ChatGroupService = class ChatGroupService {
constructor(chatGroupEntity, appEntity, modelsService) {
this.chatGroupEntity = chatGroupEntity;
@ -28,32 +28,39 @@ let ChatGroupService = class ChatGroupService {
async create(body, req) {
const { id } = req.user;
const { appId, modelConfig: bodyModelConfig } = body;
let modelConfig = bodyModelConfig;
if (!modelConfig) {
modelConfig = await this.modelsService.getBaseConfig(appId);
let modelConfig = bodyModelConfig || await this.modelsService.getBaseConfig(appId);
if (!modelConfig) {
throw new common_1.HttpException('管理员未配置任何AI模型、请先联系管理员开通聊天模型配置', common_1.HttpStatus.BAD_REQUEST);
}
}
const params = { title: '新对话', userId: id };
modelConfig = JSON.parse(JSON.stringify(modelConfig));
const params = { title: '新对话', userId: id, appId };
if (appId) {
const appInfo = await this.appEntity.findOne({ where: { id: appId } });
if (!appInfo) {
throw new common_1.HttpException('非法操作、您在使用一个不存在的应用!', common_1.HttpStatus.BAD_REQUEST);
}
const { status, name } = appInfo;
const existingGroupCount = await this.chatGroupEntity.count({ where: { userId: id, appId, isDelete: false } });
if (existingGroupCount > 0) {
throw new common_1.HttpException('当前应用已经开启了一个对话无需新建了!', common_1.HttpStatus.BAD_REQUEST);
const { status, name, isFixedModel, isGPTs, appModel, coverImg } = appInfo;
Object.assign(modelConfig.modelInfo, {
isGPTs,
isFixedModel,
modelAvatar: coverImg,
modelName: name
});
if (isGPTs === 1 || isFixedModel === 1) {
const appModelKey = await this.modelsService.getCurrentModelKeyInfo(isFixedModel === 1 ? appModel : 'gpts');
Object.assign(modelConfig.modelInfo, {
deductType: appModelKey.deductType,
deduct: appModelKey.deduct,
model: appModel,
isFileUpload: appModelKey.isFileUpload
});
}
if (![1, 3, 4, 5].includes(status)) {
throw new common_1.HttpException('非法操作、您在使用一个未启用的应用!', common_1.HttpStatus.BAD_REQUEST);
}
if (name) {
params['title'] = name;
params.title = name;
}
params['appId'] = appId;
modelConfig.appId = appId;
}
const newGroup = await this.chatGroupEntity.save(Object.assign(Object.assign({}, params), { config: JSON.stringify(modelConfig) }));
return newGroup;
@ -62,7 +69,8 @@ let ChatGroupService = class ChatGroupService {
try {
const { id } = req.user;
const params = { userId: id, isDelete: false };
const res = await this.chatGroupEntity.find({ where: params, order: { isSticky: 'DESC', id: 'DESC' } });
const res = await this.chatGroupEntity.find({ where: params, order: { isSticky: 'DESC', updatedAt: 'DESC' } });
return res;
const appIds = res.filter(t => t.appId).map(t => t.appId);
const appInfos = await this.appEntity.find({ where: { id: (0, typeorm_2.In)(appIds) } });
return res.map((item) => {
@ -105,6 +113,11 @@ let ChatGroupService = class ChatGroupService {
throw new common_1.HttpException('更新对话失败!', common_1.HttpStatus.BAD_REQUEST);
}
}
async updateTime(groupId) {
await this.chatGroupEntity.update(groupId, {
updatedAt: new Date()
});
}
async del(body, req) {
const { groupId } = body;
const { id } = req.user;

View File

@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatLogEntity = void 0;
const typeorm_1 = require("typeorm");
const baseEntity_1 = require("../../common/entity/baseEntity");
const typeorm_1 = require("typeorm");
let ChatLogEntity = class ChatLogEntity extends baseEntity_1.BaseEntity {
};
__decorate([
@ -42,6 +42,10 @@ __decorate([
(0, typeorm_1.Column)({ comment: '附加参数', nullable: true }),
__metadata("design:type", String)
], ChatLogEntity.prototype, "extraParam", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '插件参数', nullable: true }),
__metadata("design:type", String)
], ChatLogEntity.prototype, "pluginParam", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '回答的答案', type: 'text', nullable: true }),
__metadata("design:type", String)

View File

@ -13,20 +13,22 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatLogService = void 0;
const balance_constant_1 = require("../../common/constants/balance.constant");
const utils_1 = require("../../common/utils");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const chatLog_entity_1 = require("./chatLog.entity");
const typeorm_2 = require("typeorm");
const balance_constant_1 = require("../../common/constants/balance.constant");
const user_entity_1 = require("../user/user.entity");
const utils_1 = require("../../common/utils");
const exceljs_1 = require("exceljs");
const typeorm_2 = require("typeorm");
const chatGroup_entity_1 = require("../chatGroup/chatGroup.entity");
const user_entity_1 = require("../user/user.entity");
const chatLog_entity_1 = require("./chatLog.entity");
const models_service_1 = require("../models/models.service");
let ChatLogService = class ChatLogService {
constructor(chatLogEntity, userEntity, chatGroupEntity) {
constructor(chatLogEntity, userEntity, chatGroupEntity, modelsService) {
this.chatLogEntity = chatLogEntity;
this.userEntity = userEntity;
this.chatGroupEntity = chatGroupEntity;
this.modelsService = modelsService;
}
async saveChatLog(logInfo) {
const savedLog = await this.chatLogEntity.save(logInfo);
@ -71,14 +73,11 @@ let ChatLogService = class ChatLogService {
}
async querAllDrawLog(params) {
const { page = 1, size = 20, rec, userId, model } = params;
const where = { type: balance_constant_1.ChatType.PAINT, prompt: (0, typeorm_2.Not)(''), answer: (0, typeorm_2.Not)('') };
const where = { type: 2, prompt: (0, typeorm_2.Not)(''), answer: (0, typeorm_2.Not)(''), fileInfo: (0, typeorm_2.Not)(''), };
rec && Object.assign(where, { rec });
userId && Object.assign(where, { userId });
if (model) {
where.model = model;
if (model === 'DALL-E2') {
where.model = (0, typeorm_2.In)(['DALL-E2', 'dall-e-3']);
}
}
const [rows, count] = await this.chatLogEntity.findAndCount({
order: { id: 'DESC' },
@ -88,8 +87,7 @@ let ChatLogService = class ChatLogService {
});
rows.forEach((r) => {
var _a;
if (r.type === 'paintCount') {
const w = r.model === 'mj' ? 310 : 160;
const w = r.model === 'midjourney' ? 310 : 160;
const imgType = r.answer.includes('cos') ? 'tencent' : 'ali';
const compress = imgType === 'tencent' ? `?imageView2/1/w/${w}/q/55` : `?x-oss-process=image/resize,w_${w}`;
r.thumbImg = r.answer + compress;
@ -107,7 +105,6 @@ let ChatLogService = class ChatLogService {
catch (error) {
console.log('querAllDrawLog Json parse error', error);
}
}
});
return { rows, count };
}
@ -207,7 +204,7 @@ let ChatLogService = class ChatLogService {
}
const list = await this.chatLogEntity.find({ where });
return list.map((item) => {
const { prompt, role, answer, createdAt, model, modelName, type, status, action, drawId, id, fileInfo, ttsUrl, customId } = item;
const { prompt, role, answer, createdAt, model, modelName, type, status, action, drawId, id, fileInfo, ttsUrl, customId, pluginParam } = item;
return {
chatId: id,
dateTime: (0, utils_1.formatDate)(createdAt),
@ -223,15 +220,19 @@ let ChatLogService = class ChatLogService {
ttsUrl: ttsUrl,
model: model,
modelName: modelName,
pluginParam: pluginParam,
};
});
}
async chatHistory(groupId, rounds) {
if (rounds === 0) {
return [];
}
const where = { isDelete: false, groupId: groupId };
const list = await this.chatLogEntity.find({
where,
order: {
createdAt: 'ASC'
createdAt: 'DESC'
},
take: rounds * 2
});
@ -242,7 +243,7 @@ let ChatLogService = class ChatLogService {
text: role === 'user' ? prompt : answer,
fileInfo: fileInfo,
};
});
}).reverse();
}
async deleteChatLog(req, body) {
const { id: userId } = req.user;
@ -285,6 +286,28 @@ let ChatLogService = class ChatLogService {
});
return { rows, count };
}
async checkModelLimits(userId, model) {
const oneHourAgo = new Date(Date.now() - 3600 * 1000);
let adjustedUsageCount;
try {
const usageCount = await this.chatLogEntity.count({
where: {
userId: userId.id,
model,
createdAt: (0, typeorm_2.MoreThan)(oneHourAgo),
}
});
adjustedUsageCount = Math.ceil(usageCount / 2);
common_1.Logger.debug(`用户ID: ${userId.id} 模型: ${model} 一小时内已调用: ${adjustedUsageCount}`);
}
catch (error) {
common_1.Logger.error(`查询数据库出错 - 用户ID: ${userId}, 模型: ${model}, 错误信息: ${error.message}`);
}
const modelInfo = await this.modelsService.getCurrentModelKeyInfo(model);
if (adjustedUsageCount > modelInfo.modelLimits) {
throw new common_1.HttpException('1 小时内请求次数过多,请稍后再试!', common_1.HttpStatus.TOO_MANY_REQUESTS);
}
}
};
ChatLogService = __decorate([
(0, common_1.Injectable)(),
@ -293,6 +316,7 @@ ChatLogService = __decorate([
__param(2, (0, typeorm_1.InjectRepository)(chatGroup_entity_1.ChatGroupEntity)),
__metadata("design:paramtypes", [typeorm_2.Repository,
typeorm_2.Repository,
typeorm_2.Repository])
typeorm_2.Repository,
models_service_1.ModelsService])
], ChatLogService);
exports.ChatLogService = ChatLogService;

View File

@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatabaseService = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("typeorm");
const bcrypt = require("bcryptjs");
const typeorm_1 = require("typeorm");
let DatabaseService = class DatabaseService {
constructor(connection) {
this.connection = connection;
@ -20,6 +20,7 @@ let DatabaseService = class DatabaseService {
async onModuleInit() {
await this.checkSuperAdmin();
await this.checkSiteBaseConfig();
await this.createSystemReservedApps();
}
async checkSuperAdmin() {
const user = await this.connection.query(`SELECT * FROM users WHERE role = 'super'`);
@ -91,25 +92,6 @@ let DatabaseService = class DatabaseService {
{ configKey: 'openaiBaseKey', configVal: 'sk-', public: 0, encry: 0 },
{ configKey: 'mjTranslatePrompt', configVal: `Translate any given phrase from any language into English. For instance, when I input '{可爱的熊猫}', you should output '{cute panda}', with no period at the end.`, public: 0, encry: 0 },
{ configKey: 'noticeInfo', configVal: noticeInfo, public: 1, encry: 0 },
{ configKey: 'registerVerifyEmailTitle', configVal: 'AIWeb账号验证', public: 0, encry: 0 },
{
configKey: 'registerVerifyEmailDesc',
configVal: '欢迎使用AI Web团队的产品服务,请在五分钟内完成你的账号激活,点击以下按钮激活您的账号,',
public: 0,
encry: 0,
},
{ configKey: 'registerVerifyEmailFrom', configVal: 'AI Web团队', public: 0, encry: 0 },
{ configKey: 'registerVerifyExpir', configVal: '1800', public: 0, encry: 0 },
{ configKey: 'registerSuccessEmailTitle', configVal: 'AIWeb账号激活成功', public: 0, encry: 0 },
{ configKey: 'registerSuccessEmailTeamName', configVal: 'AIWeb', public: 0, encry: 0 },
{
configKey: 'registerSuccessEmaileAppend',
configVal: ',请妥善保管您的账号,祝您使用愉快',
public: 0,
encry: 0,
},
{ configKey: 'registerFailEmailTitle', configVal: 'AIWeb账号激活失败', public: 0, encry: 0 },
{ configKey: 'registerFailEmailTeamName', configVal: 'AIWeb团队', public: 0, encry: 0 },
{ configKey: 'registerSendStatus', configVal: '1', public: 1, encry: 0 },
{ configKey: 'registerSendModel3Count', configVal: '30', public: 1, encry: 0 },
{ configKey: 'registerSendModel4Count', configVal: '3', public: 1, encry: 0 },
@ -138,6 +120,26 @@ let DatabaseService = class DatabaseService {
throw new common_1.HttpException('创建默认网站配置失败!', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
}
}
async createSystemReservedApps() {
const systemApps = [
{ name: "提示词优化PromptOptimization", catId: 9900, des: "PromptOptimization", preset: "Translate any given phrase from any language into English. For instance, when I input '{可爱的熊猫}', you should output '{cute panda}', with no period at the end.", appModel: "gpt-3.5-turbo", isFixedModel: 1, isSystemReserved: 1 },
{ name: "思维导图MindMap", catId: 9900, des: "MindMap", preset: "我希望你使用markdown格式回答我得问题、我的需求是得到一份markdown格式的大纲、尽量做的精细、层级多一点、不管我问你什么、都需要您回复我一个大纲出来、我想使用大纲做思维导图、除了大纲之外、不要无关内容和总结。", appModel: "gpt-3.5-turbo", isFixedModel: 1, isSystemReserved: 1 },
];
try {
for (const app of systemApps) {
const result = await this.connection.query(`SELECT COUNT(*) AS count FROM app WHERE name = ? AND des = ? AND isSystemReserved = ?`, [app.name, app.des, app.isSystemReserved]);
const count = parseInt(result[0].count, 10);
if (count === 0) {
await this.connection.query(`INSERT INTO app (name, catId, des, preset, appModel, isFixedModel, isSystemReserved) VALUES (?, ?, ?, ?, ?, ?, ?)`, [app.name, app.catId, app.des, app.preset, app.appModel, app.isFixedModel, app.isSystemReserved]);
common_1.Logger.log(`系统预留应用${app.name}创建成功`, 'DatabaseService');
}
}
}
catch (error) {
console.log('创建系统预留应用过程中出现错误: ', error);
throw new Error('创建系统预留应用失败!');
}
}
};
DatabaseService = __decorate([
(0, common_1.Injectable)(),

View File

@ -1,54 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DrawController = void 0;
const draw_service_1 = require("./draw.service");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const chatDraw_dto_1 = require("./dto/chatDraw.dto");
let DrawController = class DrawController {
constructor(drawService) {
this.drawService = drawService;
}
getEngines() {
return this.drawService.getEngines();
}
textToImage(body) {
return this.drawService.drawTextToImage(body);
}
};
__decorate([
(0, common_1.Get)('engines'),
(0, swagger_1.ApiOperation)({ summary: '获取stable Diffusion 模型' }),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], DrawController.prototype, "getEngines", null);
__decorate([
(0, common_1.Post)('drawTextToImage'),
(0, swagger_1.ApiOperation)({ summary: 'stable Diffusion绘画' }),
(0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
(0, swagger_1.ApiBearerAuth)(),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [chatDraw_dto_1.StableDrawDto]),
__metadata("design:returntype", void 0)
], DrawController.prototype, "textToImage", null);
DrawController = __decorate([
(0, swagger_1.ApiTags)('draw'),
(0, common_1.Controller)('draw'),
__metadata("design:paramtypes", [draw_service_1.DrawService])
], DrawController);
exports.DrawController = DrawController;

View File

@ -1,81 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DrawService = void 0;
const common_1 = require("@nestjs/common");
const axios_1 = require("axios");
const uuid = require("uuid");
const upload_service_1 = require("../upload/upload.service");
let DrawService = class DrawService {
constructor(uploadService) {
this.uploadService = uploadService;
}
async onModuleInit() {
var _a;
this.apiHost = (_a = process.env.API_HOST) !== null && _a !== void 0 ? _a : 'https://api.stability.ai';
this.apiKey = process.env.STABILITY_API_KEY;
if (!this.apiKey) {
this.apiKey = '*********';
}
this.Authorization = `Bearer ${this.apiKey}`;
}
async getEngines() {
var _a, _b;
const url = `${this.apiHost}/v1/engines/list`;
const res = await (0, axios_1.default)(url, {
method: 'GET',
headers: { Authorization: this.Authorization },
});
if (res.status === 401) {
console.log(`stability api key is invalid, ${(_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.message}`);
}
if (res.status !== 200) {
console.log(`${res.status} ${(_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.message}}`);
throw new common_1.HttpException('获取列表失败', common_1.HttpStatus.BAD_REQUEST);
}
return res.data;
}
async drawTextToImage(body) {
const { engineId = 'stable-diffusion-768-v2-1' } = body;
const headers = {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: this.Authorization,
};
const url = `${this.apiHost}/v1/generation/${engineId}/text-to-image`;
try {
const response = await axios_1.default.post(url, body, { headers });
if (response.status !== 200) {
throw new common_1.HttpException('绘制失败', common_1.HttpStatus.BAD_REQUEST);
}
const resImageBasetask = [];
for (const item of response.data.artifacts) {
const filename = uuid.v4().slice(0, 10) + '.png';
const buffer = Buffer.from(item.base64, 'base64');
resImageBasetask.push(this.uploadService.uploadFile({ filename, buffer }));
}
const urls = await Promise.all(resImageBasetask);
return urls;
}
catch (error) {
if (!(error === null || error === void 0 ? void 0 : error.response)) {
throw new common_1.HttpException('绘制失败', common_1.HttpStatus.BAD_REQUEST);
}
const { status, data } = error.response;
throw new common_1.HttpException(data.message, status);
}
}
};
DrawService = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [upload_service_1.UploadService])
], DrawService);
exports.DrawService = DrawService;

View File

@ -1,112 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StableDrawDto = exports.TextPromptDto = void 0;
const class_validator_1 = require("class-validator");
const swagger_1 = require("@nestjs/swagger");
const class_transformer_1 = require("class-transformer");
class TextPromptDto {
}
__decorate([
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], TextPromptDto.prototype, "text", void 0);
__decorate([
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], TextPromptDto.prototype, "weight", void 0);
exports.TextPromptDto = TextPromptDto;
class StableDrawDto {
constructor() {
this.samples = 1;
this.width = 512;
this.height = 512;
this.cfg_scale = 7;
this.steps = 30;
this.clip_guidance_preset = 'NONE';
}
}
__decorate([
(0, swagger_1.ApiProperty)({ example: 'stable-diffusion-512-v2-1', default: 512, description: '模型id', required: true }),
(0, class_validator_1.IsDefined)({ message: '模型id是必传参数' }),
__metadata("design:type", String)
], StableDrawDto.prototype, "engineId", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
example: [
{
text: 'Draw a cute little dog',
weight: 0.5,
},
],
description: '绘画描述信息',
}),
(0, class_transformer_1.Type)(() => TextPromptDto),
(0, class_validator_1.ValidateNested)({ each: true }),
__metadata("design:type", Array)
], StableDrawDto.prototype, "text_prompts", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 1, description: '绘画张数', required: true }),
__metadata("design:type", Object)
], StableDrawDto.prototype, "samples", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 512, default: 512, description: '图片尺寸宽度' }),
(0, class_validator_1.Max)(1024, { message: '图片尺寸最大宽度1024' }),
(0, class_validator_1.Min)(512, { message: '图片尺寸最小宽度512' }),
__metadata("design:type", Object)
], StableDrawDto.prototype, "width", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 512, default: 512, description: '图片尺寸高度' }),
(0, class_validator_1.Max)(1024, { message: '图片高度尺寸最大宽度1024' }),
(0, class_validator_1.Min)(512, { message: '图片高度尺寸最小宽度512' }),
__metadata("design:type", Object)
], StableDrawDto.prototype, "height", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 15, default: 7, description: '图片绘制扩散思维[值越高,图像越接近提示]', required: true }),
(0, class_validator_1.Max)(35, { message: '扩散思维值最大为35' }),
(0, class_validator_1.Min)(0, { message: '扩散思维值最小为0' }),
__metadata("design:type", Object)
], StableDrawDto.prototype, "cfg_scale", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 50, description: '绘制步骤', required: true }),
(0, class_validator_1.Max)(150, { message: '最大步骤不大于150' }),
(0, class_validator_1.Min)(10, { message: '步骤不小于10' }),
__metadata("design:type", Object)
], StableDrawDto.prototype, "steps", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'anime', description: '样式预设', required: true }),
(0, class_validator_1.IsIn)([
'3d-model',
'analog-film',
'anime',
'cinematic',
'comic-book',
'digital-art',
'enhance',
'fantasy-art',
'isometric',
'line-art',
'low-poly',
'modeling-compound',
'neon-punk',
'origami',
'photographic',
'pixel-art',
'tile-texture',
]),
__metadata("design:type", String)
], StableDrawDto.prototype, "style_preset", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'NONE', description: '裁剪指南预设', required: true }),
(0, class_validator_1.IsIn)(['NONE', 'FAST_BLUE', 'FAST_GREEN', 'SIMPLE', 'SLOW', 'SLOWER', 'SLOWEST']),
__metadata("design:type", Object)
], StableDrawDto.prototype, "clip_guidance_preset", void 0);
exports.StableDrawDto = StableDrawDto;

View File

@ -13,15 +13,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GlobalConfigService = void 0;
const models_service_1 = require("./../models/models.service");
const chatLog_entity_1 = require("./../chatLog/chatLog.entity");
const common_1 = require("@nestjs/common");
const config_entity_1 = require("./config.entity");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const utils_1 = require("../../common/utils");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const axios_1 = require("axios");
const fs = require("fs");
const typeorm_2 = require("typeorm");
const chatLog_entity_1 = require("./../chatLog/chatLog.entity");
const models_service_1 = require("./../models/models.service");
const config_entity_1 = require("./config.entity");
const packageJsonContent = fs.readFileSync('package.json', 'utf-8');
const packageJson = JSON.parse(packageJsonContent);
const version = packageJson.version;
@ -356,7 +356,7 @@ let GlobalConfigService = class GlobalConfigService {
};
}
getNamespace() {
return process.env.NAMESPACE || 'NINEAI';
return process.env.NAMESPACE || 'AIWeb';
}
async getSignatureGiftConfig() {
const { signInStatus = 0, signInModel3Count = 0, signInModel4Count = 0, signInMjDrawToken = 0, } = await this.getConfigs(['signInStatus', 'signInModel3Count', 'signInModel4Count', 'signInMjDrawToken']);

View File

@ -6,16 +6,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DrawModule = void 0;
exports.KnowledgeBaseController = void 0;
const common_1 = require("@nestjs/common");
const draw_controller_1 = require("./draw.controller");
const draw_service_1 = require("./draw.service");
let DrawModule = class DrawModule {
let KnowledgeBaseController = class KnowledgeBaseController {
};
DrawModule = __decorate([
(0, common_1.Module)({
controllers: [draw_controller_1.DrawController],
providers: [draw_service_1.DrawService],
})
], DrawModule);
exports.DrawModule = DrawModule;
KnowledgeBaseController = __decorate([
(0, common_1.Controller)('knowledgeBase')
], KnowledgeBaseController);
exports.KnowledgeBaseController = KnowledgeBaseController;

View File

@ -0,0 +1,17 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.KnowledgeBaseEntity = void 0;
const typeorm_1 = require("typeorm");
const baseEntity_1 = require("../../common/entity/baseEntity");
let KnowledgeBaseEntity = class KnowledgeBaseEntity extends baseEntity_1.BaseEntity {
};
KnowledgeBaseEntity = __decorate([
(0, typeorm_1.Entity)({ name: 'knowledge_base' })
], KnowledgeBaseEntity);
exports.KnowledgeBaseEntity = KnowledgeBaseEntity;

View File

@ -0,0 +1,26 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.KnowledgeBaseModule = void 0;
const common_1 = require("@nestjs/common");
const knowledgeBase_controller_1 = require("./knowledgeBase.controller");
const knowledgeBase_service_1 = require("./knowledgeBase.service");
const typeorm_1 = require("@nestjs/typeorm");
const knowledgeBase_entity_1 = require("./knowledgeBase.entity");
let KnowledgeBaseModule = class KnowledgeBaseModule {
};
KnowledgeBaseModule = __decorate([
(0, common_1.Global)(),
(0, common_1.Module)({
imports: [typeorm_1.TypeOrmModule.forFeature([knowledgeBase_entity_1.KnowledgeBaseEntity])],
providers: [knowledgeBase_service_1.KnowledgeBaseService],
controllers: [knowledgeBase_controller_1.KnowledgeBaseController],
exports: [knowledgeBase_service_1.KnowledgeBaseService],
})
], KnowledgeBaseModule);
exports.KnowledgeBaseModule = KnowledgeBaseModule;

View File

@ -0,0 +1,16 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.KnowledgeBaseService = void 0;
const common_1 = require("@nestjs/common");
let KnowledgeBaseService = class KnowledgeBaseService {
};
KnowledgeBaseService = __decorate([
(0, common_1.Injectable)()
], KnowledgeBaseService);
exports.KnowledgeBaseService = KnowledgeBaseService;

View File

@ -1,30 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var MailerModule_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MailerModule = void 0;
const common_1 = require("@nestjs/common");
const nestjs_config_1 = require("nestjs-config");
const mailer_1 = require("@nestjs-modules/mailer");
const mailer_service_1 = require("./mailer.service");
let MailerModule = MailerModule_1 = class MailerModule {
};
MailerModule = MailerModule_1 = __decorate([
(0, common_1.Module)({
imports: [
nestjs_config_1.ConfigModule,
mailer_1.MailerModule.forRootAsync({
useFactory: (config) => config.get('mailer'),
inject: [nestjs_config_1.ConfigService],
}),
],
exports: [MailerModule_1],
providers: [mailer_service_1.MailerService],
})
], MailerModule);
exports.MailerModule = MailerModule;

View File

@ -10,24 +10,59 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MailerService = void 0;
const mailer_1 = require("@nestjs-modules/mailer");
const common_1 = require("@nestjs/common");
const nodemailer = require("nodemailer");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
let MailerService = class MailerService {
constructor(mailerService) {
this.mailerService = mailerService;
constructor(globalConfigService) {
this.globalConfigService = globalConfigService;
}
async sendMail(options) {
try {
await this.mailerService.sendMail(options);
const configs = await this.globalConfigService.getConfigs([
'MAILER_HOST',
'MAILER_PORT',
'MAILER_USER',
'MAILER_PASS',
'MAILER_SECURE',
'siteName',
'siteUrl',
]);
const html = `
<div style="font-family: Helvetica, Arial, sans-serif; max-width: 500px; margin: auto; padding: 40px; background-color: #ffffff; border-radius: 12px; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);">
<h2 style="text-align: center; color: #111; font-weight: 400;">验证您的邮箱</h2>
<hr style="border: none; border-top: 1px solid #eaeaea; margin: 30px 0;">
<div style="text-align: center; margin-bottom: 30px;">
<span style="display: inline-block; font-size: 42px; font-weight: 700; padding: 10px 20px; background-color: #f5f5f5; border-radius: 10px;">${options.context.code}</span>
</div>
<p style="font-size: 16px; color: #111; text-align: center; line-height: 1.5;">此验证码将在 10 分钟后失效非本人操作请忽略</p>
<hr style="border: none; border-top: 1px solid #eaeaea; margin: 30px 0;">
<p style="font-size: 14px; color: #999; text-align: center;">点击访问<a href="${configs.siteUrl}" style="color: #007AFF; text-decoration: none;">${configs.siteName}</a></p>
</div>`;
const transporter = nodemailer.createTransport({
host: configs.MAILER_HOST,
port: configs.MAILER_PORT,
secure: (configs.MAILER_SECURE === '1') ? true : false,
auth: {
user: configs.MAILER_USER,
pass: configs.MAILER_PASS,
},
});
await transporter.sendMail({
from: configs.MAILER_USER,
to: options.to,
subject: `验证码${options.context.code}`,
html: html,
});
}
catch (error) {
console.log('error: ', error);
console.error('error: ', error);
throw new common_1.HttpException('邮件发送失败!', common_1.HttpStatus.BAD_REQUEST);
}
}
};
MailerService = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [mailer_1.MailerService])
__metadata("design:paramtypes", [globalConfig_service_1.GlobalConfigService])
], MailerService);
exports.MailerService = MailerService;

View File

@ -13,22 +13,22 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MidjourneyService = void 0;
const user_entity_1 = require("./../user/user.entity");
const midjourney_constant_1 = require("../../common/constants/midjourney.constant");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const midjourney_entity_1 = require("./midjourney.entity");
const typeorm_2 = require("typeorm");
const axios_1 = require("axios");
const typeorm_2 = require("typeorm");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const models_service_1 = require("../models/models.service");
const midjourney_constant_1 = require("../../common/constants/midjourney.constant");
const upload_service_1 = require("../upload/upload.service");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const user_entity_1 = require("./../user/user.entity");
const midjourney_entity_1 = require("./midjourney.entity");
const utils_1 = require("../../common/utils");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const prompt_entity_1 = require("./prompt.entity");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const image_size_1 = require("image-size");
const uuid = require("uuid");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const prompt_entity_1 = require("./prompt.entity");
let MidjourneyService = class MidjourneyService {
constructor(midjourneyEntity, userEntity, mjPromptsEntity, globalConfigService, uploadService, userBalanceService, redisCacheService, modelsService) {
this.midjourneyEntity = midjourneyEntity;
@ -118,38 +118,42 @@ let MidjourneyService = class MidjourneyService {
let cosUrl = '';
let isSaveImg = true;
common_1.Logger.log(`绘制成功, 获取到的URL: ${imageUrl}`, 'MidjourneyService');
if (mjNotSaveImg == 1 && mjNotUseProxy == 0) {
let processedUrl = imageUrl;
const shouldReplaceUrl = mjNotUseProxy === '0' && mjProxyImgUrl;
let logMessage = '';
if (shouldReplaceUrl) {
const newUrlBase = new URL(mjProxyImgUrl);
const parsedUrl = new URL(imageUrl);
parsedUrl.protocol = newUrlBase.protocol;
parsedUrl.hostname = newUrlBase.hostname;
cosUrl = parsedUrl.toString();
common_1.Logger.log(`替换后的 URL: ${cosUrl}`, 'MidjourneyService');
parsedUrl.port = newUrlBase.port ? newUrlBase.port : '';
processedUrl = parsedUrl.toString();
logMessage = `使用代理替换后的 URL: ${processedUrl}`;
common_1.Logger.log(logMessage, 'MidjourneyService');
}
else if (mjNotSaveImg == 1 && mjNotUseProxy == 1) {
cosUrl = imageUrl;
isSaveImg = false;
common_1.Logger.log('使用原始图片链接', 'MidjourneyService');
}
else {
if (mjNotSaveImg !== '1') {
try {
common_1.Logger.debug(`------> 开始上传图片!!!`);
const filename = `${Date.now()}-${uuid.v4().slice(0, 4)}.png`;
common_1.Logger.debug(`------> 开始上传图片!!!`, 'MidjourneyService');
cosUrl = await this.uploadService.uploadFileFromUrl({ filename, url: imageUrl });
common_1.Logger.log(`上传成功 URL: ${cosUrl}`, 'MidjourneyService');
processedUrl = await this.uploadService.uploadFileFromUrl({ filename, url: processedUrl });
logMessage = `上传成功 URL: ${processedUrl}`;
}
catch (uploadError) {
common_1.Logger.error('存储图片失败,使用原始图片链接', 'MidjourneyService');
isSaveImg = false;
cosUrl = imageUrl;
common_1.Logger.error('存储图片失败,使用原始/代理图片链接');
logMessage = `存储图片失败,使用原始/代理图片链接 ${processedUrl}`;
}
common_1.Logger.log(logMessage, 'MidjourneyService');
}
const { width, height } = await this.getImageSizeFromUrl(imageUrl);
else {
logMessage = `不保存图片,使用 URL: ${processedUrl}`;
common_1.Logger.log(logMessage, 'MidjourneyService');
}
const { width, height } = await this.getImageSizeFromUrl(processedUrl);
const drawInfo = {
status: midjourney_constant_1.MidjourneyStatusEnum.DRAWED,
drawId: id,
action: action,
drawUrl: cosUrl,
drawUrl: processedUrl,
drawRatio: `${width}x${height}`,
progress: 100,
extend: JSON.stringify(drawRes),
@ -213,13 +217,15 @@ let MidjourneyService = class MidjourneyService {
}
async pollComparisonResultDraw(id, modelInfo, drawInfo) {
const { key, proxyUrl, timeout } = modelInfo;
const { openaiTimeout, } = await this.globalConfigService.getConfigs([
const { openaiTimeout, openaiBaseUrl, openaiBaseKey, } = await this.globalConfigService.getConfigs([
'openaiTimeout',
'openaiBaseUrl',
'openaiBaseKey',
]);
const effectiveTimeout = Math.max(timeout || openaiTimeout || 300, 300);
const TIMEOUT = effectiveTimeout * 1000;
const mjProxyUrl = proxyUrl;
const mjKey = key;
const mjProxyUrl = proxyUrl || openaiBaseUrl;
const mjKey = key || openaiBaseKey;
const startTime = Date.now();
const POLL_INTERVAL = 5000;
let pollingCount = 0;

View File

@ -1,76 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModelsTypeEntity = void 0;
const typeorm_1 = require("typeorm");
const baseEntity_1 = require("../../common/entity/baseEntity");
let ModelsTypeEntity = class ModelsTypeEntity extends baseEntity_1.BaseEntity {
};
__decorate([
(0, typeorm_1.Column)({ comment: 'key模型类型 1: openai 2: 文心一言 3:清华智谱' }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "keyType", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '模型名称[给用户看的]' }),
__metadata("design:type", String)
], ModelsTypeEntity.prototype, "modelName", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '是否开放模型: 0:禁用 1启用', default: 1 }),
__metadata("design:type", Boolean)
], ModelsTypeEntity.prototype, "status", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '绑定使用的模型是?最终调用的' }),
__metadata("design:type", String)
], ModelsTypeEntity.prototype, "model", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '模型温度0-2直接', default: 0.6 }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "temperature", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '模型的使用次数', default: 0 }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "useCount", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '模型总计使用的token数量', default: 0 }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "useToken", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '模型排序', default: 1 }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "modelOrder", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '单词调用扣除的次数', default: 1 }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "deduct", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '扣除余额类型 1 普通模型 2高级模型', default: 1 }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "deductType", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '模型设置允许用户使用的最大回复Token', default: 2048 }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "maxResponseTokens", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '限制用户上下文可选最大轮次数', nullable: true }),
__metadata("design:type", Number)
], ModelsTypeEntity.prototype, "maxRounds", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '是否为绘画模型Dall-E3', default: 0 }),
__metadata("design:type", Boolean)
], ModelsTypeEntity.prototype, "isDallE3", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '是否为特殊模型、可以提供联想翻译、思维导图等特殊操作', default: 0 }),
__metadata("design:type", Boolean)
], ModelsTypeEntity.prototype, "isUseTool", void 0);
ModelsTypeEntity = __decorate([
(0, typeorm_1.Entity)({ name: 'models_type' })
], ModelsTypeEntity);
exports.ModelsTypeEntity = ModelsTypeEntity;

View File

@ -98,6 +98,10 @@ __decorate([
(0, typeorm_1.Column)({ comment: '当前模型的代理地址', nullable: true }),
__metadata("design:type", String)
], ModelsEntity.prototype, "proxyUrl", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '模型频率限制 次/小时', default: 999 }),
__metadata("design:type", Number)
], ModelsEntity.prototype, "modelLimits", void 0);
ModelsEntity = __decorate([
(0, typeorm_1.Entity)({ name: 'models' })
], ModelsEntity);

View File

@ -12,13 +12,12 @@ const models_controller_1 = require("./models.controller");
const models_service_1 = require("./models.service");
const typeorm_1 = require("@nestjs/typeorm");
const models_entity_1 = require("./models.entity");
const modelType_entity_1 = require("./modelType.entity");
let ModelsModule = class ModelsModule {
};
ModelsModule = __decorate([
(0, common_1.Global)(),
(0, common_1.Module)({
imports: [typeorm_1.TypeOrmModule.forFeature([models_entity_1.ModelsEntity, modelType_entity_1.ModelsTypeEntity])],
imports: [typeorm_1.TypeOrmModule.forFeature([models_entity_1.ModelsEntity])],
controllers: [models_controller_1.ModelsController],
providers: [models_service_1.ModelsService],
exports: [models_service_1.ModelsService]

View File

@ -13,17 +13,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModelsService = void 0;
const status_constant_1 = require("../../common/constants/status.constant");
const utils_1 = require("../../common/utils");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const models_entity_1 = require("./models.entity");
const status_constant_1 = require("../../common/constants/status.constant");
const utils_1 = require("../../common/utils");
const modelType_entity_1 = require("./modelType.entity");
let ModelsService = class ModelsService {
constructor(modelsEntity, modelsTypeEntity) {
constructor(modelsEntity) {
this.modelsEntity = modelsEntity;
this.modelsTypeEntity = modelsTypeEntity;
this.modelTypes = [];
this.modelMaps = {};
this.keyList = {};
@ -97,12 +95,8 @@ let ModelsService = class ModelsService {
async getBaseConfig(appId) {
if (!this.modelTypes.length || !Object.keys(this.modelMaps).length)
return;
const modelTypeInfo = this.modelTypes[0];
if (!modelTypeInfo)
return;
const { keyType, modelName, model, deductType, deduct, isFileUpload } = this.modelMaps[modelTypeInfo.val][0];
const { keyType, modelName, model, deductType, deduct, isFileUpload } = this.modelMaps[1][0];
return {
modelTypeInfo,
modelInfo: { keyType, modelName, model, deductType, deduct, isFileUpload }
};
}
@ -238,8 +232,6 @@ let ModelsService = class ModelsService {
ModelsService = __decorate([
(0, common_1.Injectable)(),
__param(0, (0, typeorm_1.InjectRepository)(models_entity_1.ModelsEntity)),
__param(1, (0, typeorm_1.InjectRepository)(modelType_entity_1.ModelsTypeEntity)),
__metadata("design:paramtypes", [typeorm_2.Repository,
typeorm_2.Repository])
__metadata("design:paramtypes", [typeorm_2.Repository])
], ModelsService);
exports.ModelsService = ModelsService;

View File

@ -10,15 +10,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OfficialService = void 0;
const chat_service_1 = require("../chat/chat.service");
const globalConfig_service_1 = require("./../globalConfig/globalConfig.service");
const auth_service_1 = require("./../auth/auth.service");
const user_service_1 = require("./../user/user.service");
const autoreply_service_1 = require("./../autoreply/autoreply.service");
const common_1 = require("@nestjs/common");
const crypto = require("crypto");
const axios_1 = require("axios");
const utils_1 = require("../../common/utils");
const common_1 = require("@nestjs/common");
const axios_1 = require("axios");
const crypto = require("crypto");
const chat_service_1 = require("../chat/chat.service");
const auth_service_1 = require("./../auth/auth.service");
const autoreply_service_1 = require("./../autoreply/autoreply.service");
const globalConfig_service_1 = require("./../globalConfig/globalConfig.service");
const user_service_1 = require("./../user/user.service");
let OfficialService = class OfficialService {
constructor(autoreplyService, userService, authService, globalConfigService, chatgptService) {
this.autoreplyService = autoreplyService;
@ -149,15 +149,7 @@ let OfficialService = class OfficialService {
reject(new Error('请求超时'));
}, 4800);
});
let question = '';
try {
console.log('来自公众号的询问问题 =======> ', msg);
question = await this.autoreplyService.checkAutoReply(msg);
}
catch (error) {
console.log('来自公众号的回复问题 =======> 超时导致问题无法回答完整');
question = (await this.globalConfigService.getConfigs(['officialAutoReplyText'])) || '由于公众号的回复限制、过长的问题我们可能无法回复、您可以前往我们的官方站点享受更加完善的服务、如果您有更多问题、欢迎像我提问!';
}
let question = (await this.globalConfigService.getConfigs(['officialAutoReplyText'])) || '由于公众号的回复限制、过长的问题我们可能无法回复、您可以前往我们的官方站点享受更加完善的服务、如果您有更多问题、欢迎像我提问!';
return question;
}
};

View File

@ -13,17 +13,17 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PayService = void 0;
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const common_1 = require("@nestjs/common");
const crypto = require("crypto");
const axios_1 = require("axios");
const order_entity_1 = require("../order/order.entity");
const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const utils_1 = require("../../common/utils");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const axios_1 = require("axios");
const crypto = require("crypto");
const typeorm_2 = require("typeorm");
const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const order_entity_1 = require("../order/order.entity");
const user_service_1 = require("../user/user.service");
const userBalance_service_1 = require("../userBalance/userBalance.service");
let PayService = class PayService {
constructor(cramiPackageEntity, orderEntity, userBalanceService, globalConfigService, userService) {
this.cramiPackageEntity = cramiPackageEntity;
@ -331,7 +331,7 @@ let PayService = class PayService {
}
}
async payWeChat(userId, orderId, payType = 'native') {
var _a, _b, _c;
var _a, _b, _c, _d, _e, _f, _g;
console.log('payType: ', payType);
const order = await this.orderEntity.findOne({ where: { userId, orderId } });
if (!order)
@ -361,47 +361,61 @@ let PayService = class PayService {
out_trade_no: orderId,
notify_url: payWeChatNotifyUrl,
amount: {
total: Number(order.total * 100),
},
scene_info: {
payer_client_ip: '192.168.1.100',
total: Math.round(order.total * 100),
},
};
console.log('wechat-pay: ', params);
if (payType == 'h5') {
params.scene_info.h5_info = {
type: 'Wap',
app_name: payWeChatH5Name,
app_url: payWeChatH5Url,
};
const res = await pay.transactions_h5(params);
if (res.status === 403) {
const errmsg = (_c = (_b = (_a = res === null || res === void 0 ? void 0 : res.errRaw) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c.message;
throw new common_1.HttpException((res === null || res === void 0 ? void 0 : res.message) || '微信H5支付失败', common_1.HttpStatus.BAD_REQUEST);
}
const { h5_url } = res;
return { url: h5_url };
}
if (payType == 'jsapi') {
console.log(`[WeChat Pay JSAPI] 开始JSAPI支付流程用户ID: ${userId}, 订单ID: ${orderId}`);
const openid = await this.userService.getOpenIdByUserId(userId);
console.log('用户openId: ', openid);
params['payer'] = {
openid: openid,
console.log(`[WeChat Pay JSAPI] 用户OpenID: ${openid}`);
params['payer'] = { openid: openid };
console.log(`[WeChat Pay JSAPI] 发送支付请求参数: `, JSON.stringify(params, null, 2));
try {
const response = await pay.transactions_jsapi(params);
const result = response.data ? response.data : response;
console.log(`[WeChat Pay JSAPI] 支付请求成功,返回结果: `, JSON.stringify(result, null, 2));
return {
status: response.status || 'unknown',
appId: result.appId || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.appId),
timeStamp: result.timeStamp || ((_b = result.data) === null || _b === void 0 ? void 0 : _b.timeStamp),
nonceStr: result.nonceStr || ((_c = result.data) === null || _c === void 0 ? void 0 : _c.nonceStr),
package: result.package || ((_d = result.data) === null || _d === void 0 ? void 0 : _d.package),
signType: result.signType || ((_e = result.data) === null || _e === void 0 ? void 0 : _e.signType),
paySign: result.paySign || ((_f = result.data) === null || _f === void 0 ? void 0 : _f.paySign)
};
const result = await pay.transactions_jsapi(params);
console.log('jsapi支付结果返回值: ', result);
return result;
}
catch (error) {
console.error(`[WeChat Pay JSAPI] 支付请求过程中发生错误: ${error.message}`, error);
console.error('[WeChat Pay JSAPI] 完整的错误对象:', error);
throw new common_1.HttpException('JSAPI支付失败', common_1.HttpStatus.BAD_REQUEST);
}
}
if (payType == 'native') {
console.log(`开始进行微信Native支付流程订单ID: ${orderId}, 用户ID: ${userId}`);
try {
const res = await pay.transactions_native(params);
const { code_url: url_qrcode } = res;
console.log(`微信Native支付响应数据: `, JSON.stringify(res, null, 2));
let url_qrcode = res.code_url || ((_g = res.data) === null || _g === void 0 ? void 0 : _g.code_url);
if (!url_qrcode) {
console.log('wx-native', res);
console.error(`微信Native支付请求成功但未返回code_url响应数据: `, JSON.stringify(res, null, 2));
}
else {
console.log(`微信Native支付请求成功code_url: ${url_qrcode}`);
}
return { url_qrcode, isRedirect: false };
}
catch (error) {
console.error(`微信Native支付过程中发生错误错误信息: ${error.message}`, error);
console.error('完整的错误对象:', error);
throw new common_1.HttpException('微信Native支付失败', common_1.HttpStatus.BAD_REQUEST);
}
}
else {
console.warn(`支付请求使用了不支持的支付类型: ${payType}`);
throw new common_1.HttpException('unsupported pay type', common_1.HttpStatus.BAD_REQUEST);
}
}
async queryWeChat(orderId) {
const { payWeChatAppId, payWeChatMchId, payWeChatPublicKey, payWeChatPrivateKey, payWeChatNotifyUrl, payWeChatH5Name, payWeChatH5Url } = await this.globalConfigService.getConfigs(['payWeChatAppId', 'payWeChatMchId', 'payWeChatPublicKey', 'payWeChatPrivateKey']);
const pay = new this.WxPay({

View File

@ -13,12 +13,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueueService = void 0;
const bull_1 = require("@nestjs/bull");
const utils_1 = require("../../common/utils");
const midjourney_service_1 = require("../midjourney/midjourney.service");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const bull_1 = require("@nestjs/bull");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const midjourney_service_1 = require("../midjourney/midjourney.service");
const models_service_1 = require("../models/models.service");
const userBalance_service_1 = require("../userBalance/userBalance.service");
let QueueService = class QueueService {
constructor(mjDrawQueue, midjourneyService, userBalanceService, globalConfigService, modelsService) {
this.mjDrawQueue = mjDrawQueue;

View File

@ -13,10 +13,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UploadController = void 0;
const upload_service_1 = require("./upload.service");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const platform_express_1 = require("@nestjs/platform-express");
const swagger_1 = require("@nestjs/swagger");
const upload_service_1 = require("./upload.service");
let UploadController = class UploadController {
constructor(uploadService) {
this.uploadService = uploadService;
@ -24,6 +24,9 @@ let UploadController = class UploadController {
async uploadFile(file) {
return this.uploadService.uploadFile(file);
}
async uploadFileFromUrl({ filename, url, dir = 'ai' }) {
return this.uploadService.uploadFileFromUrl({ filename, url, dir });
}
};
__decorate([
(0, common_1.Post)('file'),
@ -34,6 +37,14 @@ __decorate([
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], UploadController.prototype, "uploadFile", null);
__decorate([
(0, common_1.Post)('fileFromUrl'),
(0, swagger_1.ApiOperation)({ summary: '从URL上传文件' }),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], UploadController.prototype, "uploadFileFromUrl", null);
UploadController = __decorate([
(0, swagger_1.ApiTags)('upload'),
(0, common_1.Controller)('upload'),

View File

@ -10,14 +10,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UploadService = void 0;
const utils_1 = require("../../common/utils");
const common_1 = require("@nestjs/common");
const TENCENTCOS = require("cos-nodejs-sdk-v5");
const ALIOSS = require("ali-oss");
const axios_1 = require("axios");
const streamToBuffer = require("stream-to-buffer");
const utils_1 = require("../../common/utils");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const TENCENTCOS = require("cos-nodejs-sdk-v5");
const FormData = require("form-data");
const fs = require("fs");
const path_1 = require("path");
const streamToBuffer = require("stream-to-buffer");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
let UploadService = class UploadService {
constructor(globalConfigService) {
this.globalConfigService = globalConfigService;
@ -65,7 +67,7 @@ let UploadService = class UploadService {
return 'chevereto';
}
}
async uploadFileFromUrl({ filename, url, dir = 'mj' }) {
async uploadFileFromUrl({ filename, url, dir = 'ai' }) {
dir = process.env.ISDEV ? 'mjdev' : dir;
const { tencentCosStatus = 0, aliOssStatus = 0, cheveretoStatus = 0, } = await this.globalConfigService.getConfigs(['tencentCosStatus', 'aliOssStatus', 'cheveretoStatus']);
if (!Number(tencentCosStatus) && !Number(aliOssStatus) && !Number(cheveretoStatus)) {
@ -118,7 +120,6 @@ let UploadService = class UploadService {
const { Bucket, Region, SecretId, SecretKey } = await this.getUploadConfig('tencent');
this.tencentCos = new TENCENTCOS({ SecretId, SecretKey, FileParallelLimit: 10 });
try {
const proxyMj = (await this.globalConfigService.getConfigs(['mjProxy'])) || 0;
const buffer = await this.getBufferFromUrl(url);
return await this.uploadFileByTencentCos({ filename, buffer, dir, fileTyle: '' });
}
@ -147,24 +148,41 @@ let UploadService = class UploadService {
throw new common_1.HttpException('上传图片失败[ali]', common_1.HttpStatus.BAD_REQUEST);
}
}
async uploadFileToLocalFromUrl({ filename, url, dir }) {
try {
const buffer = await this.getBufferFromUrl(url);
return await this.uploadFileToLocal({ filename, buffer, dir });
}
catch (error) {
console.log('TODO->error: ', error);
throw new common_1.HttpException('上传图片失败[ten][url]', common_1.HttpStatus.BAD_REQUEST);
}
}
async uploadFileToLocal({ filename, buffer, dir = 'ai' }) {
if (!filename || !buffer) {
throw new Error("必须提供文件名和文件内容");
}
const appRoot = require('app-root-path');
const uploadDir = path_1.default.join(appRoot.path, 'service', 'public', 'file');
const filePath = path_1.default.join(uploadDir, filename);
if (!fs.existsSync(uploadDir)) {
fs.mkdirSync(uploadDir, { recursive: true });
common_1.Logger.log(`创建目录: ${uploadDir}`);
}
fs.writeFileSync(filePath, buffer);
common_1.Logger.log(`文件已保存: ${filePath}`);
const baseUrl = process.env.BASE_URL || 'http://127.0.0.1:9520';
const fileUrl = `${baseUrl}/file/${filename}`;
common_1.Logger.log(`文件可访问于: ${fileUrl}`);
return fileUrl;
}
async uploadFileByAliOssFromUrl({ filename, url, dir }) {
const { region, bucket, accessKeyId, accessKeySecret } = await this.getUploadConfig('ali');
const client = new ALIOSS({ region, accessKeyId, accessKeySecret, bucket });
try {
const proxyMj = (await this.globalConfigService.getConfigs(['mjProxy'])) || 0;
if (Number(proxyMj) === 1) {
const data = { url, cosParams: { region, bucket, accessKeyId, accessKeySecret }, cosType: 'aliyun' };
const mjProxyUrl = (await this.globalConfigService.getConfigs(['mjProxyUrl'])) || 'http://172.247.48.137:8000';
const res = await axios_1.default.post(`${mjProxyUrl}/mj/replaceUpload`, data);
if (!(res === null || res === void 0 ? void 0 : res.data))
throw new common_1.HttpException('上传图片失败[ALI][url]', common_1.HttpStatus.BAD_REQUEST);
return res.data;
}
else {
const buffer = await this.getBufferFromUrl(url);
return await this.uploadFileByAliOss({ filename, buffer, dir });
}
}
catch (error) {
throw new common_1.HttpException('上传图片失败[ALI][url]', common_1.HttpStatus.BAD_REQUEST);
}
@ -174,8 +192,10 @@ let UploadService = class UploadService {
const { key, uploadPath } = await this.getUploadConfig('chevereto');
let url = uploadPath.endsWith('/') ? uploadPath.slice(0, -1) : uploadPath;
const formData = new FormData();
formData.append('source', buffer);
const fromBuffer = buffer.toString('base64');
formData.append('source', fromBuffer);
formData.append('key', key);
formData.append('title', filename);
try {
const res = await axios_1.default.post(url, formData, {
headers: { 'X-API-Key': key },
@ -195,22 +215,9 @@ let UploadService = class UploadService {
}
async uploadFileByCheveretoFromUrl({ filename, url, dir }) {
try {
const proxyMj = (await this.globalConfigService.getConfigs(['mjProxy'])) || 0;
if (Number(proxyMj) === 1) {
const { key, uploadPath } = await this.getUploadConfig('chevereto');
let formatUploadPath = uploadPath.endsWith('/') ? uploadPath.slice(0, -1) : uploadPath;
const data = { cosType: 'chevereto', url, cosParams: { key, uploadPath: formatUploadPath } };
const mjProxyUrl = (await this.globalConfigService.getConfigs(['mjProxyUrl'])) || 'http://172.247.48.137:8000';
const res = await axios_1.default.post(`${mjProxyUrl}/mj/replaceUpload`, data);
if (!res.data)
throw new common_1.HttpException('上传图片失败[Chevereto][url]', common_1.HttpStatus.BAD_REQUEST);
return res.data;
}
else {
const buffer = await this.getBufferFromUrl(url);
return await this.uploadFileByChevereto({ filename, buffer, dir });
}
}
catch (error) {
console.log('error: ', error);
throw new common_1.HttpException(error.response, common_1.HttpStatus.BAD_REQUEST);
@ -234,7 +241,6 @@ let UploadService = class UploadService {
}
}
async getBufferFromUrl(url) {
const proxyMj = (await this.globalConfigService.getConfigs(['mjProxy'])) || 0;
const response = await axios_1.default.get(url, { responseType: 'stream' });
return new Promise((resolve, reject) => {
streamToBuffer(response.data, (err, buffer) => {

View File

@ -13,19 +13,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserController = void 0;
const user_service_1 = require("./user.service");
const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const updateUser_dto_1 = require("./dto/updateUser.dto");
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
const userRecharge_dto_1 = require("./dto/userRecharge.dto");
const queryAllUser_dto_1 = require("./dto/queryAllUser.dto");
const queryOne_dto_1 = require("./dto/queryOne.dto");
const updateUserStatus_dto_1 = require("./dto/updateUserStatus.dto");
const resetUserPass_dto_1 = require("./dto/resetUserPass.dto");
const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
const queryInviteRecord_dto_1 = require("./dto/queryInviteRecord.dto");
const queryOne_dto_1 = require("./dto/queryOne.dto");
const resetUserPass_dto_1 = require("./dto/resetUserPass.dto");
const updateUser_dto_1 = require("./dto/updateUser.dto");
const updateUserStatus_dto_1 = require("./dto/updateUserStatus.dto");
const userRecharge_dto_1 = require("./dto/userRecharge.dto");
const user_service_1 = require("./user.service");
let UserController = class UserController {
constructor(userService) {
this.userService = userService;

View File

@ -7,26 +7,27 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserModule = void 0;
const verifycation_entity_1 = require("./../verification/verifycation.entity");
const verification_service_1 = require("./../verification/verification.service");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const user_controller_1 = require("./user.controller");
const user_service_1 = require("./user.service");
const user_entity_1 = require("./user.entity");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const balance_entity_1 = require("../userBalance/balance.entity");
const accountLog_entity_1 = require("../userBalance/accountLog.entity");
const config_entity_1 = require("../globalConfig/config.entity");
const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
const whiteList_entity_1 = require("../chat/whiteList.entity");
const userBalance_entity_1 = require("../userBalance/userBalance.entity");
const salesUsers_entity_1 = require("../sales/salesUsers.entity");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const fingerprint_entity_1 = require("../userBalance/fingerprint.entity");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const chatGroup_entity_1 = require("../chatGroup/chatGroup.entity");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
const config_entity_1 = require("../globalConfig/config.entity");
const mailer_service_1 = require("../mailer/mailer.service");
const midjourney_entity_1 = require("../midjourney/midjourney.entity");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const salesUsers_entity_1 = require("../sales/salesUsers.entity");
const accountLog_entity_1 = require("../userBalance/accountLog.entity");
const balance_entity_1 = require("../userBalance/balance.entity");
const fingerprint_entity_1 = require("../userBalance/fingerprint.entity");
const userBalance_entity_1 = require("../userBalance/userBalance.entity");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const verification_service_1 = require("./../verification/verification.service");
const verifycation_entity_1 = require("./../verification/verifycation.entity");
const user_controller_1 = require("./user.controller");
const user_entity_1 = require("./user.entity");
const user_service_1 = require("./user.service");
let UserModule = class UserModule {
};
UserModule = __decorate([
@ -50,7 +51,7 @@ UserModule = __decorate([
]),
],
controllers: [user_controller_1.UserController],
providers: [user_service_1.UserService, verification_service_1.VerificationService, userBalance_service_1.UserBalanceService, redisCache_service_1.RedisCacheService],
providers: [user_service_1.UserService, verification_service_1.VerificationService, userBalance_service_1.UserBalanceService, redisCache_service_1.RedisCacheService, mailer_service_1.MailerService,],
exports: [user_service_1.UserService],
})
], UserModule);

View File

@ -13,22 +13,22 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserService = void 0;
const globalConfig_service_1 = require("./../globalConfig/globalConfig.service");
const user_constant_1 = require("./../../common/constants/user.constant");
const mailer_1 = require("@nestjs-modules/mailer");
const verification_service_1 = require("./../verification/verification.service");
const balance_constant_1 = require("../../common/constants/balance.constant");
const verification_constant_1 = require("../../common/constants/verification.constant");
const utils_1 = require("../../common/utils");
const mailer_service_1 = require("../mailer/mailer.service");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const user_entity_1 = require("./user.entity");
const bcrypt = require("bcryptjs");
const _ = require("lodash");
const verification_constant_1 = require("../../common/constants/verification.constant");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const utils_1 = require("../../common/utils");
const balance_constant_1 = require("../../common/constants/balance.constant");
const config_entity_1 = require("../globalConfig/config.entity");
const typeorm_2 = require("typeorm");
const whiteList_entity_1 = require("../chat/whiteList.entity");
const config_entity_1 = require("../globalConfig/config.entity");
const userBalance_service_1 = require("../userBalance/userBalance.service");
const user_constant_1 = require("./../../common/constants/user.constant");
const globalConfig_service_1 = require("./../globalConfig/globalConfig.service");
const verification_service_1 = require("./../verification/verification.service");
const user_entity_1 = require("./user.entity");
let UserService = class UserService {
constructor(userEntity, whiteListEntity, connection, verificationService, mailerService, userBalanceService, globalConfigService, configEntity) {
this.userEntity = userEntity;
@ -92,13 +92,7 @@ let UserService = class UserService {
const { code, email, id } = v;
const { registerVerifyEmailFrom } = configMap;
console.log('configMap: ', configMap);
const res = await this.mailerService.sendMail({
to: email,
subject: `来自${registerVerifyEmailFrom}的账号激活`,
template: 'register',
context: Object.assign({ baseUrl: configMap['registerBaseUrl'], code, id }, configMap),
});
console.log('email response -> : ', res);
console.log(`尝试发送邮件到: ${email}`);
}
else {
const { username, email, id, invitedBy } = n;
@ -133,17 +127,7 @@ let UserService = class UserService {
}
}
if (username && password) {
const where = [{ username }, { email: username }];
u = await this.userEntity.findOne({ where: where });
if (!u) {
throw new common_1.HttpException('当前账户不存在!', common_1.HttpStatus.BAD_REQUEST);
}
if (!bcrypt.compareSync(password, u.password)) {
throw new common_1.HttpException('当前密码错误!', common_1.HttpStatus.BAD_REQUEST);
}
}
if (phone && password) {
const where = [{ phone }];
const where = [{ username }, { email: username }, { phone: username }];
u = await this.userEntity.findOne({ where: where });
if (!u) {
throw new common_1.HttpException('当前账户不存在!', common_1.HttpStatus.BAD_REQUEST);
@ -269,7 +253,7 @@ let UserService = class UserService {
const [rows, count] = await this.userEntity.findAndCount({
where: { invitedBy },
order: { id: 'DESC' },
select: ['username', 'email', 'createdAt', 'status', 'avatar'],
select: ['username', 'email', 'createdAt', 'status', 'avatar', 'updatedAt'],
take: size,
skip: (page - 1) * size,
});
@ -423,6 +407,25 @@ let UserService = class UserService {
const user = await this.userEntity.findOne({ where: { id: userId } });
return user === null || user === void 0 ? void 0 : user.openId;
}
async verifyUserRegister(params) {
const { username, phone, email } = params;
if (phone) {
const userByPhone = await this.userEntity.findOne({ where: { phone } });
if (userByPhone) {
throw new common_1.HttpException('当前手机号已注册、请勿重复注册!', common_1.HttpStatus.BAD_REQUEST);
}
}
if (email) {
const userByEmail = await this.userEntity.findOne({ where: { email } });
if (userByEmail) {
throw new common_1.HttpException('当前邮箱已注册、请勿重复注册!', common_1.HttpStatus.BAD_REQUEST);
}
}
const userByUsername = await this.userEntity.findOne({ where: { username } });
if (userByUsername) {
throw new common_1.HttpException('用户名已存在、请更换用户名!', common_1.HttpStatus.BAD_REQUEST);
}
}
async verifyUserRegisterByPhone(params) {
const { username, password, phone, phoneCode } = params;
const user = await this.userEntity.findOne({ where: [{ username }, { phone }] });
@ -433,6 +436,20 @@ let UserService = class UserService {
throw new common_1.HttpException('当前手机号已注册、请勿重复注册!', common_1.HttpStatus.BAD_REQUEST);
}
}
async verifyUserRegisterByEmail(params) {
const { username, email } = params;
console.log(`校验邮箱注册: 开始 - 用户名: ${username}, 邮箱: ${email}`);
const user = await this.userEntity.findOne({ where: [{ username }, { email }] });
if (user && user.username === username) {
console.error(`校验失败: 用户名 "${username}" 已存在`);
throw new common_1.HttpException('用户名已存在、请更换用户名!', common_1.HttpStatus.BAD_REQUEST);
}
if (user && user.email === email) {
console.error(`校验失败: 邮箱 "${email}" 已被注册`);
throw new common_1.HttpException('当前邮箱已注册、请勿重复注册!', common_1.HttpStatus.BAD_REQUEST);
}
console.log(`校验邮箱注册: 成功 - 用户名: ${username}, 邮箱: ${email} 未被占用`);
}
async createUser(userInfo) {
return await this.userEntity.save(userInfo);
}
@ -446,7 +463,7 @@ UserService = __decorate([
typeorm_2.Repository,
typeorm_2.Connection,
verification_service_1.VerificationService,
mailer_1.MailerService,
mailer_service_1.MailerService,
userBalance_service_1.UserBalanceService,
globalConfig_service_1.GlobalConfigService,
typeorm_2.Repository])

View File

@ -17,7 +17,6 @@ const common_1 = require("@nestjs/common");
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const swagger_1 = require("@nestjs/swagger");
const userBalance_service_1 = require("./userBalance.service");
const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
let UserBalanceController = class UserBalanceController {
constructor(userBalanceService) {
@ -32,9 +31,6 @@ let UserBalanceController = class UserBalanceController {
async getBalance(req) {
return this.userBalanceService.queryUserBalance(req.user.id);
}
async upgradeBalance() {
return this.userBalanceService.upgradeBalance();
}
async inheritVisitorData(req) {
return this.userBalanceService.inheritVisitorData(req);
}
@ -74,15 +70,6 @@ __decorate([
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], UserBalanceController.prototype, "getBalance", null);
__decorate([
(0, common_1.Post)('upgradeBalance'),
(0, swagger_1.ApiOperation)({ summary: '升级V1.5 数据迁移job' }),
(0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
(0, swagger_1.ApiBearerAuth)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], UserBalanceController.prototype, "upgradeBalance", null);
__decorate([
(0, common_1.Post)('inheritVisitorData'),
(0, swagger_1.ApiOperation)({ summary: '继承当前设备数据' }),

View File

@ -71,7 +71,7 @@ __decorate([
__metadata("design:type", String)
], UserBalanceEntity.prototype, "extent", void 0);
__decorate([
(0, typeorm_1.Column)({ comment: '会员到期时间 0不是 1', nullable: true }),
(0, typeorm_1.Column)({ comment: '会员到期时间', nullable: true }),
__metadata("design:type", Date)
], UserBalanceEntity.prototype, "expirationTime", void 0);
UserBalanceEntity = __decorate([

View File

@ -13,26 +13,26 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserBalanceService = void 0;
const globalConfig_service_1 = require("./../globalConfig/globalConfig.service");
const typeorm_1 = require("@nestjs/typeorm");
const balance_entity_1 = require("./balance.entity");
const common_1 = require("@nestjs/common");
const typeorm_2 = require("typeorm");
const balance_constant_1 = require("../../common/constants/balance.constant");
const accountLog_entity_1 = require("./accountLog.entity");
const utils_1 = require("../../common/utils");
const config_entity_1 = require("../globalConfig/config.entity");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
const config_entity_1 = require("../globalConfig/config.entity");
const globalConfig_service_1 = require("./../globalConfig/globalConfig.service");
const accountLog_entity_1 = require("./accountLog.entity");
const balance_entity_1 = require("./balance.entity");
const userBalance_entity_1 = require("./userBalance.entity");
const date_1 = require("../../common/utils/date");
const user_entity_1 = require("../user/user.entity");
const salesUsers_entity_1 = require("../sales/salesUsers.entity");
const sales_service_1 = require("../sales/sales.service");
const whiteList_entity_1 = require("../chat/whiteList.entity");
const fingerprint_entity_1 = require("./fingerprint.entity");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const chatGroup_entity_1 = require("../chatGroup/chatGroup.entity");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const midjourney_entity_1 = require("../midjourney/midjourney.entity");
const sales_service_1 = require("../sales/sales.service");
const salesUsers_entity_1 = require("../sales/salesUsers.entity");
const user_entity_1 = require("../user/user.entity");
const fingerprint_entity_1 = require("./fingerprint.entity");
let UserBalanceService = class UserBalanceService {
constructor(balanceEntity, userBalanceEntity, accountLogEntity, cramiPackageEntity, configEntity, userEntity, salesUsersEntity, whiteListEntity, fingerprintLogEntity, chatGroupEntity, chatLogEntity, midjourneyEntity, salesService, globalConfigService) {
this.balanceEntity = balanceEntity;

View File

@ -13,14 +13,14 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VerificationService = void 0;
const utils_1 = require("../../common/utils");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const status_constant_1 = require("./../../common/constants/status.constant");
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const verifycation_entity_1 = require("./verifycation.entity");
const common_1 = require("@nestjs/common");
const utils_1 = require("../../common/utils");
const redisCache_service_1 = require("../redisCache/redisCache.service");
const status_constant_1 = require("./../../common/constants/status.constant");
const verifycation_entity_1 = require("./verifycation.entity");
const Core = require("@alicloud/pop-core");
let VerificationService = class VerificationService {
constructor(verifycationEntity, globalConfigService, redisCacheService) {
@ -76,6 +76,7 @@ let VerificationService = class VerificationService {
async sendPhoneCode(messageInfo) {
var _a;
const { accessKeyId, accessKeySecret, SignName, TemplateCode } = await this.globalConfigService.getPhoneVerifyConfig();
console.log("Received messageInfo:", messageInfo);
const { phone, code } = messageInfo;
if (!phone || !code) {
throw new common_1.HttpException('确实必要参数错误!', common_1.HttpStatus.BAD_REQUEST);

View File

@ -17,7 +17,6 @@ services:
MYSQL_USER: "chatgpt"
MYSQL_PASSWORD: "123456"
redis:
image: redis
# command: --requirepass "12345678" # redis库密码,不需要密码注释本行
@ -29,11 +28,9 @@ services:
volumes:
- ./data/redis/:/data/
nineai-open:
# image: buqian/99ai
99ai:
build: ./
container_name: nineai-open
container_name: 99ai
restart: always
ports:
- "9520:9520"
@ -44,6 +41,3 @@ services:
depends_on:
- mysql
- redis

View File

@ -1,6 +1,6 @@
{
"name": "99AI",
"version": "3.0.0",
"version": "3.3.0",
"description": "",
"author": "",
"private": true,
@ -29,7 +29,6 @@
"@alicloud/pop-core": "^1.7.13",
"@dqbd/tiktoken": "^1.0.7",
"@keyv/redis": "^2.6.1",
"@nestjs-modules/mailer": "^1.8.1",
"@nestjs/bull": "^0.6.3",
"@nestjs/common": "^9.0.0",
"@nestjs/core": "^9.0.0",
@ -43,6 +42,7 @@
"@types/cache-manager-redis-store": "^2.0.1",
"abort-controller": "^3.0.0",
"ali-oss": "^6.17.1",
"app-root-path": "^3.1.0",
"axios": "^1.4.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.2",
@ -62,6 +62,7 @@
"express-xml-bodyparser": "^0.3.0",
"form-data": "^4.0.0",
"guid-typescript": "^1.0.9",
"handlebars": "^4.7.8",
"hbs": "^4.2.0",
"image-size": "^1.1.1",
"ioredis": "^5.3.2",
@ -71,12 +72,13 @@
"jsonwebtoken": "^9.0.0",
"keyv": "^4.5.2",
"lodash": "^4.17.21",
"microsoft-cognitiveservices-speech-sdk": "^1.36.0",
"mysql2": "^3.2.0",
"nestjs-config": "^1.4.10",
"nestjs-rate-limiter": "^3.1.0",
"nestjs-redis": "^1.3.3",
"node-fetch": "^3.3.1",
"nodemailer": "^6.9.1",
"nodemailer": "^6.9.12",
"passport": "^0.6.0",
"passport-jwt": "^4.0.1",
"redis": "^4.6.5",

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{d as u,r as i,s as p,x as f,o as v,c as m,e as a,a as o,f as h,j as b,_ as x,h as I,p as w,i as y,l as k,t as B,b as N,n as g,q as s}from"./index-b779f4e0.js";const c=t=>(w("data-v-599b59df"),t=t(),y(),t),C={class:"notfound"},S={class:"content"},V=c(()=>o("h1",null,"404",-1)),R=c(()=>o("div",{class:"desc"}," 抱歉,你访问的页面不存在 ",-1)),_=u({__name:"[...all]",setup(t){const l=b(),e=i({inter:NaN,countdown:5});p(()=>{e.value.inter&&clearInterval(e.value.inter)}),f(()=>{e.value.inter=setInterval(()=>{e.value.countdown--,e.value.countdown===0&&(e.value.inter&&clearInterval(e.value.inter),n())},1e3)});function n(){l.push("/")}return(j,q)=>{const r=x,d=I("el-button");return v(),m("div",C,[a(r,{name:"404",class:"icon"}),o("div",S,[V,R,a(d,{type:"primary",onClick:n},{default:h(()=>[k(B(N(e).countdown)+" 秒后,返回首页 ",1)]),_:1})])])}}});typeof s=="function"&&s(_);const E=g(_,[["__scopeId","data-v-599b59df"]]);export{E as default};
import{d as u,r as i,s as p,x as f,o as v,c as m,e as a,a as o,f as h,j as b,_ as x,h as I,p as w,i as y,l as k,t as B,b as N,n as g,q as s}from"./index-e656eb90.js";const c=t=>(w("data-v-599b59df"),t=t(),y(),t),C={class:"notfound"},S={class:"content"},V=c(()=>o("h1",null,"404",-1)),R=c(()=>o("div",{class:"desc"}," 抱歉,你访问的页面不存在 ",-1)),_=u({__name:"[...all]",setup(t){const l=b(),e=i({inter:NaN,countdown:5});p(()=>{e.value.inter&&clearInterval(e.value.inter)}),f(()=>{e.value.inter=setInterval(()=>{e.value.countdown--,e.value.countdown===0&&(e.value.inter&&clearInterval(e.value.inter),n())},1e3)});function n(){l.push("/")}return(j,q)=>{const r=x,d=I("el-button");return v(),m("div",C,[a(r,{name:"404",class:"icon"}),o("div",S,[V,R,a(d,{type:"primary",onClick:n},{default:h(()=>[k(B(N(e).countdown)+" 秒后,返回首页 ",1)]),_:1})])])}}});typeof s=="function"&&s(_);const E=g(_,[["__scopeId","data-v-599b59df"]]);export{E as default};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as F}from"./index-38e73db4.js";import{Y as x,d as G,r as _,Q as R,x as H,h as r,R as O,o as u,c as h,e as a,f as t,S as M,U as P,b as m,l as d,w as $,I as C,t as w,P as Q,q}from"./index-b779f4e0.js";import{r as J,s as K,U as W,p as X}from"./index-7b2ba868.js";import{u as Z}from"./utcformatTime-e76e5157.js";const ee={upgradeBalance:g=>x.post("balance/upgradeBalance",g),queryUserAccountLog:g=>x.get("balance/accountLog",{params:g})},ae=G({__name:"accountLog",setup(g){const T=_(),A=_(0),f=_(!1),n=R({userId:"",rechargeType:"",packageId:"",page:1,size:15});R({model3Count:[{required:!0,message:"请填写赠送基础模型额度",trigger:"blur"}],model4Count:[{required:!0,message:"请填写赠送高级模型额度",trigger:"blur"}],drawMjCount:[{required:!0,message:"请填写赠送绘画积分额度",trigger:"blur"}]});const U=_([]),S=_([]);async function i(){try{f.value=!0;const s=await ee.queryUserAccountLog(n),{rows:l,count:b}=s.data;f.value=!1,A.value=b,S.value=l}catch{f.value=!1}}async function D(s){const l=await Q.queryAllUser({size:30,keyword:s});U.value=l.data.rows}function V(s){s==null||s.resetFields(),i()}return H(()=>i()),(s,l)=>{const b=r("el-option"),k=r("el-select"),y=r("el-form-item"),z=r("el-button"),Y=r("el-form"),I=F,L=r("el-avatar"),o=r("el-table-column"),v=r("el-tag"),B=r("el-table"),E=r("el-pagination"),j=r("el-row"),N=O("loading");return u(),h("div",null,[a(I,null,{default:t(()=>[a(Y,{ref_key:"formRef",ref:T,inline:!0,model:n},{default:t(()=>[a(y,{label:"用户名称",prop:"userId"},{default:t(()=>[a(k,{modelValue:n.userId,"onUpdate:modelValue":l[0]||(l[0]=e=>n.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"昵称|手机号|邮箱[模糊搜索]","remote-show-suffix":"","remote-method":D},{default:t(()=>[(u(!0),h(M,null,P(U.value,e=>(u(),C(b,{key:e.id,label:e.username,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(y,{label:"充值类型",prop:"rechargeType"},{default:t(()=>[a(k,{modelValue:n.rechargeType,"onUpdate:modelValue":l[1]||(l[1]=e=>n.rechargeType=e),placeholder:"请选择充值类型",clearable:""},{default:t(()=>[(u(!0),h(M,null,P(m(J),e=>(u(),C(b,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(y,null,{default:t(()=>[a(z,{type:"primary",onClick:i},{default:t(()=>[d(" 查询 ")]),_:1}),a(z,{onClick:l[2]||(l[2]=e=>V(T.value))},{default:t(()=>[d(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),a(I,{style:{width:"100%"}},{default:t(()=>[$((u(),C(B,{border:"",data:S.value,style:{width:"100%"},size:"large"},{default:t(()=>[a(o,{prop:"avatar",label:"用户头像",width:"120",fixed:""},{default:t(e=>[a(L,{src:e.row.avatar},null,8,["src"])]),_:1}),a(o,{prop:"username",label:"用户名称",width:"150",fixed:""}),a(o,{prop:"id",label:"用户ID",width:"80"}),a(o,{prop:"uid",label:"订单ID",width:"130"}),a(o,{prop:"email",label:"用户邮箱",width:"250",align:"left"}),a(o,{prop:"balanceInfo.useModel4Count",label:"充值类型",width:"160",align:"center"},{default:t(e=>[a(v,{type:"success"},{default:t(()=>{var c,p;return[d(w((c=e.row)!=null&&c.rechargeType?m(K)[(p=e.row)==null?void 0:p.rechargeType]:"---"),1)]}),_:2},1024)]),_:1}),a(o,{prop:"model3Count",label:"基础模型额度",width:"120",align:"center"}),a(o,{prop:"model4Count",label:"高级模型额度",width:"120",align:"center"}),a(o,{prop:"drawMjCount",label:"绘画余额额度",width:"120",align:"center"}),a(o,{label:"额度有效期",width:"170",align:"center"},{default:t(e=>[a(v,{type:"success"},{default:t(()=>{var c,p;return[d(w(((c=e.row)==null?void 0:c.days)<=0?"永久时效":`${(p=e.row)==null?void 0:p.days}`),1)]}),_:2},1024)]),_:1}),a(o,{prop:"status",label:"用户状态",width:"120",align:"center"},{default:t(({row:e})=>[a(v,{type:m(W)[e.status]},{default:t(()=>[d(w(m(X)[e.status]),1)]),_:2},1032,["type"])]),_:1}),a(o,{prop:"createdAt",label:"充值时间",width:"200",align:"center"},{default:t(e=>[d(w(m(Z)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[N,f.value]]),a(j,{class:"flex justify-end mt-5"},{default:t(()=>[a(E,{"current-page":n.page,"onUpdate:currentPage":l[3]||(l[3]=e=>n.page=e),"page-size":n.size,"onUpdate:pageSize":l[4]||(l[4]=e=>n.size=e),class:"mr-5","page-sizes":[15,30,50,100],layout:"total, sizes, prev, pager, next, jumper",total:A.value,onSizeChange:i,onCurrentChange:i},null,8,["current-page","page-size","total"])]),_:1})]),_:1})])}}});typeof q=="function"&&q(ae);export{ae as default};
import{_ as F}from"./index-fd8a5577.js";import{Y as x,d as G,r as _,Q as R,x as H,h as r,R as O,o as u,c as h,e as a,f as t,S as M,U as P,b as m,l as d,w as $,I as C,t as w,P as Q,q}from"./index-e656eb90.js";import{r as J,s as K,U as W,p as X}from"./index-d5406c70.js";import{u as Z}from"./utcformatTime-e76e5157.js";const ee={upgradeBalance:g=>x.post("balance/upgradeBalance",g),queryUserAccountLog:g=>x.get("balance/accountLog",{params:g})},ae=G({__name:"accountLog",setup(g){const T=_(),A=_(0),f=_(!1),n=R({userId:"",rechargeType:"",packageId:"",page:1,size:15});R({model3Count:[{required:!0,message:"请填写赠送基础模型额度",trigger:"blur"}],model4Count:[{required:!0,message:"请填写赠送高级模型额度",trigger:"blur"}],drawMjCount:[{required:!0,message:"请填写赠送绘画积分额度",trigger:"blur"}]});const U=_([]),S=_([]);async function i(){try{f.value=!0;const s=await ee.queryUserAccountLog(n),{rows:l,count:b}=s.data;f.value=!1,A.value=b,S.value=l}catch{f.value=!1}}async function D(s){const l=await Q.queryAllUser({size:30,keyword:s});U.value=l.data.rows}function V(s){s==null||s.resetFields(),i()}return H(()=>i()),(s,l)=>{const b=r("el-option"),k=r("el-select"),y=r("el-form-item"),z=r("el-button"),Y=r("el-form"),I=F,L=r("el-avatar"),o=r("el-table-column"),v=r("el-tag"),B=r("el-table"),E=r("el-pagination"),j=r("el-row"),N=O("loading");return u(),h("div",null,[a(I,null,{default:t(()=>[a(Y,{ref_key:"formRef",ref:T,inline:!0,model:n},{default:t(()=>[a(y,{label:"用户名称",prop:"userId"},{default:t(()=>[a(k,{modelValue:n.userId,"onUpdate:modelValue":l[0]||(l[0]=e=>n.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"昵称|手机号|邮箱[模糊搜索]","remote-show-suffix":"","remote-method":D},{default:t(()=>[(u(!0),h(M,null,P(U.value,e=>(u(),C(b,{key:e.id,label:e.username,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(y,{label:"充值类型",prop:"rechargeType"},{default:t(()=>[a(k,{modelValue:n.rechargeType,"onUpdate:modelValue":l[1]||(l[1]=e=>n.rechargeType=e),placeholder:"请选择充值类型",clearable:""},{default:t(()=>[(u(!0),h(M,null,P(m(J),e=>(u(),C(b,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(y,null,{default:t(()=>[a(z,{type:"primary",onClick:i},{default:t(()=>[d(" 查询 ")]),_:1}),a(z,{onClick:l[2]||(l[2]=e=>V(T.value))},{default:t(()=>[d(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),a(I,{style:{width:"100%"}},{default:t(()=>[$((u(),C(B,{border:"",data:S.value,style:{width:"100%"},size:"large"},{default:t(()=>[a(o,{prop:"avatar",label:"用户头像",width:"120",fixed:""},{default:t(e=>[a(L,{src:e.row.avatar},null,8,["src"])]),_:1}),a(o,{prop:"username",label:"用户名称",width:"150",fixed:""}),a(o,{prop:"id",label:"用户ID",width:"80"}),a(o,{prop:"uid",label:"订单ID",width:"130"}),a(o,{prop:"email",label:"用户邮箱",width:"250",align:"left"}),a(o,{prop:"balanceInfo.useModel4Count",label:"充值类型",width:"160",align:"center"},{default:t(e=>[a(v,{type:"success"},{default:t(()=>{var c,p;return[d(w((c=e.row)!=null&&c.rechargeType?m(K)[(p=e.row)==null?void 0:p.rechargeType]:"---"),1)]}),_:2},1024)]),_:1}),a(o,{prop:"model3Count",label:"基础模型额度",width:"120",align:"center"}),a(o,{prop:"model4Count",label:"高级模型额度",width:"120",align:"center"}),a(o,{prop:"drawMjCount",label:"绘画余额额度",width:"120",align:"center"}),a(o,{label:"额度有效期",width:"170",align:"center"},{default:t(e=>[a(v,{type:"success"},{default:t(()=>{var c,p;return[d(w(((c=e.row)==null?void 0:c.days)<=0?"永久时效":`${(p=e.row)==null?void 0:p.days}`),1)]}),_:2},1024)]),_:1}),a(o,{prop:"status",label:"用户状态",width:"120",align:"center"},{default:t(({row:e})=>[a(v,{type:m(W)[e.status]},{default:t(()=>[d(w(m(X)[e.status]),1)]),_:2},1032,["type"])]),_:1}),a(o,{prop:"createdAt",label:"充值时间",width:"200",align:"center"},{default:t(e=>[d(w(m(Z)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[N,f.value]]),a(j,{class:"flex justify-end mt-5"},{default:t(()=>[a(E,{"current-page":n.page,"onUpdate:currentPage":l[3]||(l[3]=e=>n.page=e),"page-size":n.size,"onUpdate:pageSize":l[4]||(l[4]=e=>n.size=e),class:"mr-5","page-sizes":[15,30,50,100],layout:"total, sizes, prev, pager, next, jumper",total:A.value,onSizeChange:i,onCurrentChange:i},null,8,["current-page","page-size","total"])]),_:1})]),_:1})])}}});typeof q=="function"&&q(ae);export{ae as default};

View File

@ -1,9 +0,0 @@
/**
* Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* Gitee https://gitee.com/hooray/fantastic-admin
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as v}from"./index-38e73db4.js";import{a as O}from"./config-61dee393.js";import{d as w,Q as B,r as C,B as I,x as R,h as o,o as U,c as q,e,f as l,a as b,l as N,b as m,E as g,q as y}from"./index-b779f4e0.js";const j={class:"flex justify-between"},E=b("b",null,"阿里云OSS参数设置",-1),M=w({__name:"ali",setup(Q){const t=B({aliOssStatus:"",aliOssAccessKeyId:"",aliOssAccessKeySecret:"",aliOssRegion:"",aliOssBucket:""}),_=C();async function f(){const n=await O.queryConfig({keys:["aliOssAccessKeySecret","aliOssRegion","aliOssBucket","aliOssAccessKeyId","aliOssStatus"]});Object.assign(t,n.data)}function x(){var n;(n=_.value)==null||n.validate(async s=>{if(s){try{await O.setConfig({settings:V(t)}),g.success("变更配置信息成功")}catch{}f()}else g.error("请填写完整信息")})}function V(n){return Object.keys(n).map(s=>({configKey:s,configVal:n[s]}))}const i=I(()=>[{required:Number(t.aliOssStatus)===1,message:"开启配置后请填写此项",trigger:"change"}]);return R(()=>{f()}),(n,s)=>{const p=o("el-alert"),S=v,K=o("el-button"),k=o("el-switch"),c=o("el-form-item"),u=o("el-col"),r=o("el-row"),d=o("el-input"),A=o("el-form"),h=o("el-card");return U(),q("div",null,[e(S,null,{default:l(()=>[e(p,{closable:!1,"show-icon":"",title:"阿里云COS参数说明",description:"阿里云的对象存储oss服务、前往阿里云申请oss服务 https://oss.console.aliyun.com/ 、如果同时开启多个存储服务、腾讯云高于阿里云优先级!",type:"success"})]),_:1}),e(h,{style:{margin:"20px"}},{header:l(()=>[b("div",j,[E,e(K,{class:"button",text:"",onClick:x},{default:l(()=>[N(" 保存设置 ")]),_:1})])]),default:l(()=>[e(A,{ref_key:"formRef",ref:_,model:t,"label-width":"120px"},{default:l(()=>[e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"服务启用状态",prop:"aliOssStatus"},{default:l(()=>[e(k,{modelValue:t.aliOssStatus,"onUpdate:modelValue":s[0]||(s[0]=a=>t.aliOssStatus=a),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"accessKeyId",prop:"aliOssAccessKeyId",rules:m(i)},{default:l(()=>[e(d,{modelValue:t.aliOssAccessKeyId,"onUpdate:modelValue":s[1]||(s[1]=a=>t.aliOssAccessKeyId=a),placeholder:"请填写SecretId",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"keySecret",prop:"aliOssAccessKeySecret",rules:m(i)},{default:l(()=>[e(d,{modelValue:t.aliOssAccessKeySecret,"onUpdate:modelValue":s[2]||(s[2]=a=>t.aliOssAccessKeySecret=a),placeholder:"请填写SecretKey",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"存储桶名称",prop:"aliOssBucket",rules:m(i)},{default:l(()=>[e(d,{modelValue:t.aliOssBucket,"onUpdate:modelValue":s[3]||(s[3]=a=>t.aliOssBucket=a),placeholder:"请填写存储桶名称",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"所属地域",prop:"aliOssRegion",rules:m(i)},{default:l(()=>[e(d,{modelValue:t.aliOssRegion,"onUpdate:modelValue":s[4]||(s[4]=a=>t.aliOssRegion=a),placeholder:"请填写所属地域(oss-cn-shanghai)",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})])}}});typeof y=="function"&&y(M);export{M as default};

View File

@ -0,0 +1,9 @@
/**
* Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* Gitee https://gitee.com/hooray/fantastic-admin
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as A}from"./index-fd8a5577.js";import{a as O}from"./config-e611a8d0.js";import{d as v,Q as B,r as C,B as I,x as R,h as o,o as U,c as q,e,f as l,a as b,l as N,b as m,E as g,q as y}from"./index-e656eb90.js";const j={class:"flex justify-between"},E=b("b",null,"阿里云OSS参数设置",-1),M=v({__name:"ali",setup(Q){const a=B({aliOssStatus:"",aliOssAccessKeyId:"",aliOssAccessKeySecret:"",aliOssRegion:"",aliOssBucket:""}),p=C();async function _(){const n=await O.queryConfig({keys:["aliOssAccessKeySecret","aliOssRegion","aliOssBucket","aliOssAccessKeyId","aliOssStatus"]});Object.assign(a,n.data)}function x(){var n;(n=p.value)==null||n.validate(async s=>{if(s){try{await O.setConfig({settings:V(a)}),g.success("变更配置信息成功")}catch{}_()}else g.error("请填写完整信息")})}function V(n){return Object.keys(n).map(s=>({configKey:s,configVal:n[s]}))}const i=I(()=>[{required:Number(a.aliOssStatus)===1,message:"开启配置后请填写此项",trigger:"change"}]);return R(()=>{_()}),(n,s)=>{const f=o("el-alert"),S=A,w=o("el-button"),K=o("el-switch"),c=o("el-form-item"),u=o("el-col"),r=o("el-row"),d=o("el-input"),h=o("el-form"),k=o("el-card");return U(),q("div",null,[e(S,null,{default:l(()=>[e(f,{closable:!1,"show-icon":"",title:"阿里云COS参数说明",description:"阿里云的对象存储oss服务、前往阿里云申请oss服务 https://oss.console.aliyun.com/ 、如果同时开启多个存储服务、腾讯云高于阿里云优先级!",type:"success"})]),_:1}),e(k,{style:{margin:"20px"}},{header:l(()=>[b("div",j,[E,e(w,{class:"button",text:"",onClick:x},{default:l(()=>[N(" 保存设置 ")]),_:1})])]),default:l(()=>[e(h,{ref_key:"formRef",ref:p,model:a,"label-width":"120px"},{default:l(()=>[e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"服务启用状态",prop:"aliOssStatus"},{default:l(()=>[e(K,{modelValue:a.aliOssStatus,"onUpdate:modelValue":s[0]||(s[0]=t=>a.aliOssStatus=t),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"accessKeyId",prop:"aliOssAccessKeyId",rules:m(i)},{default:l(()=>[e(d,{modelValue:a.aliOssAccessKeyId,"onUpdate:modelValue":s[1]||(s[1]=t=>a.aliOssAccessKeyId=t),placeholder:"请填写SecretId",clearable:"",type:"password","show-password":""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"keySecret",prop:"aliOssAccessKeySecret",rules:m(i)},{default:l(()=>[e(d,{modelValue:a.aliOssAccessKeySecret,"onUpdate:modelValue":s[2]||(s[2]=t=>a.aliOssAccessKeySecret=t),placeholder:"请填写SecretKey",clearable:"",type:"password","show-password":""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"存储桶名称",prop:"aliOssBucket",rules:m(i)},{default:l(()=>[e(d,{modelValue:a.aliOssBucket,"onUpdate:modelValue":s[3]||(s[3]=t=>a.aliOssBucket=t),placeholder:"请填写存储桶名称",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"所属地域",prop:"aliOssRegion",rules:m(i)},{default:l(()=>[e(d,{modelValue:a.aliOssRegion,"onUpdate:modelValue":s[4]||(s[4]=t=>a.aliOssRegion=t),placeholder:"请填写所属地域(oss-cn-shanghai)",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})])}}});typeof y=="function"&&y(M);export{M as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{Y as o}from"./index-b779f4e0.js";const r={queryBadWords:(d={})=>o.get("badwords/query",{params:d}),queryViolation:(d={})=>o.get("badwords/violation",{params:d}),delBadWords:d=>o.post("badwords/del",d),addBadWords:d=>o.post("badwords/add",d),updateBadWords:d=>o.post("badwords/update",d)};export{r as A};
import{Y as o}from"./index-e656eb90.js";const r={queryBadWords:(d={})=>o.get("badwords/query",{params:d}),queryViolation:(d={})=>o.get("badwords/violation",{params:d}),delBadWords:d=>o.post("badwords/del",d),addBadWords:d=>o.post("badwords/add",d),updateBadWords:d=>o.post("badwords/update",d)};export{r as A};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as C}from"./index-38e73db4.js";import{a as m}from"./config-61dee393.js";import{d as k,Q as q,r as f,x as U,h as o,o as j,c as B,e,f as t,a as y,l as E,E as b,q as x}from"./index-b779f4e0.js";const N={class:"flex justify-between"},I=y("b",null,"百度文本审核参数设置",-1),M=k({__name:"baiduSensitive",setup(O){const a=q({baiduTextStatus:"",baiduTextApiKey:"",baiduTextSecretKey:""}),g=f({baiduTextStatus:[{required:!0,trigger:"blur",message:"请选择是否启用百度文本审核"}],baiduTextSecretKey:[{required:!0,trigger:"blur",message:"请填写百度文本审核SecretKey"}],baiduTextApiKey:[{required:!0,trigger:"blur",message:"请填写百度文本审核APIKey"}]}),c=f();async function d(){const n=await m.queryConfig({keys:["baiduTextStatus","baiduTextSecretKey","baiduTextApiKey"]});Object.assign(a,n.data)}function K(){var n;(n=c.value)==null||n.validate(async l=>{if(l){try{await m.setConfig({settings:T(a)}),b.success("变更配置信息成功")}catch{}d()}else b.error("请填写完整信息")})}function T(n){return Object.keys(n).map(l=>({configKey:l,configVal:n[l]}))}return U(()=>{d()}),(n,l)=>{const _=o("el-alert"),S=C,v=o("el-button"),V=o("el-switch"),w=o("el-tooltip"),i=o("el-form-item"),r=o("el-col"),s=o("el-row"),p=o("el-input"),h=o("el-form"),A=o("el-card");return j(),B("div",null,[e(S,null,{default:t(()=>[e(_,{closable:!1,"show-icon":"",title:"百度文本审核参数说明",description:"接入原因、当前百度云免费5万条申请文档地址https://console.bce.baidu.com/ai/#/ai/antiporn/overview/index 、如果百度云敏感词与自定义敏感词都配置的情况、会先检测百度云后检测自定义的敏感词!",type:"success"})]),_:1}),e(A,{style:{margin:"20px"}},{header:t(()=>[y("div",N,[I,e(v,{class:"button",text:"",onClick:K},{default:t(()=>[E(" 保存设置 ")]),_:1})])]),default:t(()=>[e(h,{ref_key:"formRef",ref:c,rules:g.value,model:a,"label-width":"150px"},{default:t(()=>[e(s,null,{default:t(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(i,{label:"开启此敏感词设置",prop:"baiduTextStatus"},{default:t(()=>[e(w,{content:"开启将打开敏感词检测、如果同时开启其他敏感词将会通过菜单顺序仅同时开启一个!",placement:"top","show-after":500},{default:t(()=>[e(V,{modelValue:a.baiduTextStatus,"onUpdate:modelValue":l[0]||(l[0]=u=>a.baiduTextStatus=u),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(s,null,{default:t(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(i,{label:"文本审核ApiKey",prop:"baiduTextApiKey"},{default:t(()=>[e(p,{modelValue:a.baiduTextApiKey,"onUpdate:modelValue":l[1]||(l[1]=u=>a.baiduTextApiKey=u),placeholder:"请填写百度文本审核ApiKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(s,null,{default:t(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(i,{label:"文本审核SecretKey",prop:"baiduTextSecretKey"},{default:t(()=>[e(p,{modelValue:a.baiduTextSecretKey,"onUpdate:modelValue":l[2]||(l[2]=u=>a.baiduTextSecretKey=u),placeholder:"请填写百度文本审核SecretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof x=="function"&&x(M);export{M as default};
import{_ as C}from"./index-fd8a5577.js";import{a as m}from"./config-e611a8d0.js";import{d as k,Q as q,r as f,x as U,h as o,o as j,c as B,e,f as t,a as y,l as E,E as b,q as x}from"./index-e656eb90.js";const N={class:"flex justify-between"},I=y("b",null,"百度文本审核参数设置",-1),M=k({__name:"baiduSensitive",setup(O){const a=q({baiduTextStatus:"",baiduTextApiKey:"",baiduTextSecretKey:""}),g=f({baiduTextStatus:[{required:!0,trigger:"blur",message:"请选择是否启用百度文本审核"}],baiduTextSecretKey:[{required:!0,trigger:"blur",message:"请填写百度文本审核SecretKey"}],baiduTextApiKey:[{required:!0,trigger:"blur",message:"请填写百度文本审核APIKey"}]}),c=f();async function d(){const n=await m.queryConfig({keys:["baiduTextStatus","baiduTextSecretKey","baiduTextApiKey"]});Object.assign(a,n.data)}function K(){var n;(n=c.value)==null||n.validate(async l=>{if(l){try{await m.setConfig({settings:T(a)}),b.success("变更配置信息成功")}catch{}d()}else b.error("请填写完整信息")})}function T(n){return Object.keys(n).map(l=>({configKey:l,configVal:n[l]}))}return U(()=>{d()}),(n,l)=>{const _=o("el-alert"),S=C,v=o("el-button"),V=o("el-switch"),w=o("el-tooltip"),i=o("el-form-item"),r=o("el-col"),s=o("el-row"),p=o("el-input"),h=o("el-form"),A=o("el-card");return j(),B("div",null,[e(S,null,{default:t(()=>[e(_,{closable:!1,"show-icon":"",title:"百度文本审核参数说明",description:"接入原因、当前百度云免费5万条申请文档地址https://console.bce.baidu.com/ai/#/ai/antiporn/overview/index 、如果百度云敏感词与自定义敏感词都配置的情况、会先检测百度云后检测自定义的敏感词!",type:"success"})]),_:1}),e(A,{style:{margin:"20px"}},{header:t(()=>[y("div",N,[I,e(v,{class:"button",text:"",onClick:K},{default:t(()=>[E(" 保存设置 ")]),_:1})])]),default:t(()=>[e(h,{ref_key:"formRef",ref:c,rules:g.value,model:a,"label-width":"150px"},{default:t(()=>[e(s,null,{default:t(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(i,{label:"开启此敏感词设置",prop:"baiduTextStatus"},{default:t(()=>[e(w,{content:"开启将打开敏感词检测、如果同时开启其他敏感词将会通过菜单顺序仅同时开启一个!",placement:"top","show-after":500},{default:t(()=>[e(V,{modelValue:a.baiduTextStatus,"onUpdate:modelValue":l[0]||(l[0]=u=>a.baiduTextStatus=u),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(s,null,{default:t(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(i,{label:"文本审核ApiKey",prop:"baiduTextApiKey"},{default:t(()=>[e(p,{modelValue:a.baiduTextApiKey,"onUpdate:modelValue":l[1]||(l[1]=u=>a.baiduTextApiKey=u),placeholder:"请填写百度文本审核ApiKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(s,null,{default:t(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(i,{label:"文本审核SecretKey",prop:"baiduTextSecretKey"},{default:t(()=>[e(p,{modelValue:a.baiduTextSecretKey,"onUpdate:modelValue":l[2]||(l[2]=u=>a.baiduTextSecretKey=u),placeholder:"请填写百度文本审核SecretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof x=="function"&&x(M);export{M as default};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as M}from"./index-38e73db4.js";import{a as f}from"./config-61dee393.js";import{d as T,Q as k,r as g,x as q,h as o,o as A,c as D,e,f as l,a as x,l as U,E as b,q as y}from"./index-b779f4e0.js";const h={class:"flex justify-between"},j=x("b",null,"分销系统基础设置",-1),E=T({__name:"base",setup(N){const a=k({salesBaseRatio:10,salesSeniorRatio:30,salesAllowDrawMoney:10,salesBaseTitle:"新秀分销商"}),w=g({salesBaseRatio:[{required:!0,trigger:"blur",message:"请填写默认佣金比例"}],salesSeniorRatio:[{required:!0,trigger:"blur",message:"请填写高级代理默认比例"}],salesBaseTitle:[{required:!0,trigger:"blur",message:"请填写默认用户推介等级名称"}]}),m=g();async function d(){const s=await f.queryConfig({keys:["salesBaseRatio","salesSeniorRatio","salesAllowDrawMoney","salesBaseTitle"]});Object.assign(a,s.data)}function V(){var s;(s=m.value)==null||s.validate(async t=>{if(t){try{await f.setConfig({settings:B(a)}),b.success("变更配置信息成功")}catch{}d()}else b.error("请填写完整信息")})}function B(s){return Object.keys(s).map(t=>({configKey:t,configVal:s[t]}))}return q(()=>{d()}),(s,t)=>{const c=o("el-alert"),R=M,C=o("el-button"),_=o("el-input-number"),r=o("el-form-item"),i=o("el-col"),u=o("el-row"),p=o("el-input"),S=o("el-form"),v=o("el-card");return A(),D("div",null,[e(R,null,{default:l(()=>[e(c,{closable:!1,"show-icon":"",title:"分销系统基础配置",description:"填写默认佣金比例和高级分销佣金比例会对应显示到客户端的分销页面、同时新用户将使用默认分销比例、允许提现额度限制用户最低提现金额、分销名称同样对应分销页面、高级代理可自定义名称!",type:"success"})]),_:1}),e(v,{style:{margin:"20px"}},{header:l(()=>[x("div",h,[j,e(C,{class:"button",text:"",onClick:V},{default:l(()=>[U(" 保存设置 ")]),_:1})])]),default:l(()=>[e(S,{ref_key:"formRef",ref:m,model:a,"label-width":"140px",rules:w.value},{default:l(()=>[e(u,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"默认分销佣金比例",prop:"salesBaseRatio"},{default:l(()=>[e(_,{modelValue:a.salesBaseRatio,"onUpdate:modelValue":t[0]||(t[0]=n=>a.salesBaseRatio=n),max:100,min:0,step:5,"step-strictly":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"高级分销佣金比例",prop:"salesSeniorRatio"},{default:l(()=>[e(_,{modelValue:a.salesSeniorRatio,"onUpdate:modelValue":t[1]||(t[1]=n=>a.salesSeniorRatio=n),max:100,min:0,step:5,"step-strictly":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"允许最低提现金额",prop:"salesAllowDrawMoney"},{default:l(()=>[e(p,{modelValue:a.salesAllowDrawMoney,"onUpdate:modelValue":t[2]||(t[2]=n=>a.salesAllowDrawMoney=n),type:"number","step-strictly":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"默认等级分销名称",prop:"salesBaseTitle"},{default:l(()=>[e(p,{modelValue:a.salesBaseTitle,"onUpdate:modelValue":t[3]||(t[3]=n=>a.salesBaseTitle=n),placeholder:"请填写SecretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1})])}}});typeof y=="function"&&y(E);export{E as default};
import{_ as M}from"./index-fd8a5577.js";import{a as f}from"./config-e611a8d0.js";import{d as T,Q as k,r as g,x as q,h as o,o as A,c as D,e,f as l,a as x,l as U,E as b,q as y}from"./index-e656eb90.js";const h={class:"flex justify-between"},j=x("b",null,"分销系统基础设置",-1),E=T({__name:"base",setup(N){const a=k({salesBaseRatio:10,salesSeniorRatio:30,salesAllowDrawMoney:10,salesBaseTitle:"新秀分销商"}),w=g({salesBaseRatio:[{required:!0,trigger:"blur",message:"请填写默认佣金比例"}],salesSeniorRatio:[{required:!0,trigger:"blur",message:"请填写高级代理默认比例"}],salesBaseTitle:[{required:!0,trigger:"blur",message:"请填写默认用户推介等级名称"}]}),m=g();async function d(){const s=await f.queryConfig({keys:["salesBaseRatio","salesSeniorRatio","salesAllowDrawMoney","salesBaseTitle"]});Object.assign(a,s.data)}function V(){var s;(s=m.value)==null||s.validate(async t=>{if(t){try{await f.setConfig({settings:B(a)}),b.success("变更配置信息成功")}catch{}d()}else b.error("请填写完整信息")})}function B(s){return Object.keys(s).map(t=>({configKey:t,configVal:s[t]}))}return q(()=>{d()}),(s,t)=>{const c=o("el-alert"),R=M,C=o("el-button"),_=o("el-input-number"),r=o("el-form-item"),i=o("el-col"),u=o("el-row"),p=o("el-input"),S=o("el-form"),v=o("el-card");return A(),D("div",null,[e(R,null,{default:l(()=>[e(c,{closable:!1,"show-icon":"",title:"分销系统基础配置",description:"填写默认佣金比例和高级分销佣金比例会对应显示到客户端的分销页面、同时新用户将使用默认分销比例、允许提现额度限制用户最低提现金额、分销名称同样对应分销页面、高级代理可自定义名称!",type:"success"})]),_:1}),e(v,{style:{margin:"20px"}},{header:l(()=>[x("div",h,[j,e(C,{class:"button",text:"",onClick:V},{default:l(()=>[U(" 保存设置 ")]),_:1})])]),default:l(()=>[e(S,{ref_key:"formRef",ref:m,model:a,"label-width":"140px",rules:w.value},{default:l(()=>[e(u,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"默认分销佣金比例",prop:"salesBaseRatio"},{default:l(()=>[e(_,{modelValue:a.salesBaseRatio,"onUpdate:modelValue":t[0]||(t[0]=n=>a.salesBaseRatio=n),max:100,min:0,step:5,"step-strictly":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"高级分销佣金比例",prop:"salesSeniorRatio"},{default:l(()=>[e(_,{modelValue:a.salesSeniorRatio,"onUpdate:modelValue":t[1]||(t[1]=n=>a.salesSeniorRatio=n),max:100,min:0,step:5,"step-strictly":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"允许最低提现金额",prop:"salesAllowDrawMoney"},{default:l(()=>[e(p,{modelValue:a.salesAllowDrawMoney,"onUpdate:modelValue":t[2]||(t[2]=n=>a.salesAllowDrawMoney=n),type:"number","step-strictly":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"默认等级分销名称",prop:"salesBaseTitle"},{default:l(()=>[e(p,{modelValue:a.salesBaseTitle,"onUpdate:modelValue":t[3]||(t[3]=n=>a.salesBaseTitle=n),placeholder:"请填写SecretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1})])}}});typeof y=="function"&&y(E);export{E as default};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as I}from"./index-38e73db4.js";import{a as m}from"./config-61dee393.js";import{d as S,Q as T,r as p,x as U,h as n,o as j,c as q,e,f as o,a as x,l as B,E as b,q as g}from"./index-b779f4e0.js";const E={class:"flex justify-between"},N=x("b",null,"系统基础设置",-1),M=S({__name:"base",setup(O){const t=T({baiduCode:"",baiduSiteId:"",baiduToken:""}),k=p({}),c=p();async function _(){const a=await m.queryConfig({keys:["baiduCode","baiduSiteId","baiduToken"]});Object.assign(t,a.data)}function y(){var a;(a=c.value)==null||a.validate(async l=>{if(l){try{await m.setConfig({settings:C(t)}),b.success("变更配置信息成功")}catch{}_()}else b.error("请填写完整信息")})}function C(a){return Object.keys(a).map(l=>({configKey:l,configVal:a[l]}))}return U(()=>{_()}),(a,l)=>{const f=n("el-alert"),V=I,w=n("el-button"),s=n("el-input"),u=n("el-form-item"),i=n("el-col"),r=n("el-row"),h=n("el-form"),v=n("el-card");return j(),q("div",null,[e(V,null,{default:o(()=>[e(f,{closable:!1,"show-icon":"",title:"网页统计说明",description:"百度统计的配置默认使用演示demo数据主要用于展示目的。实际的统计数据将在网站首页显示。为获取更精确的数据分析建议查阅部署文档或访问百度统计官网申请专属于您网站的key和token。百度统计提供的是一项免费服务。如果您选择不使用这项服务只需将相关设置项留空即可。",type:"success"})]),_:1}),e(v,{style:{margin:"20px"}},{header:o(()=>[x("div",E,[N,e(w,{class:"button",text:"",onClick:y},{default:o(()=>[B(" 保存设置 ")]),_:1})])]),default:o(()=>[e(h,{ref_key:"formRef",ref:c,rules:k.value,model:t,"label-width":"120px"},{default:o(()=>[e(r,null,{default:o(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(u,{label:"百度统计siteId",prop:"baiduSiteId"},{default:o(()=>[e(s,{modelValue:t.baiduSiteId,"onUpdate:modelValue":l[0]||(l[0]=d=>t.baiduSiteId=d),placeholder:"请填写百度site_id、不会请查看部署文档",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:o(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(u,{label:"百度统计token",prop:"baiduToken"},{default:o(()=>[e(s,{modelValue:t.baiduToken,"onUpdate:modelValue":l[1]||(l[1]=d=>t.baiduToken=d),placeholder:"请填写百度access_token、不会请查看部署文档",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:o(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(u,{label:"百度统计代码",prop:"baiduCode"},{default:o(()=>[e(s,{modelValue:t.baiduCode,"onUpdate:modelValue":l[2]||(l[2]=d=>t.baiduCode=d),placeholder:"填写百度统计代码可统计每日访问量详情,如果没有使用用请查看详细文档!",type:"textarea",rows:12,clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof g=="function"&&g(M);export{M as default};
import{_ as I}from"./index-fd8a5577.js";import{a as m}from"./config-e611a8d0.js";import{d as S,Q as T,r as p,x as U,h as n,o as j,c as q,e,f as o,a as x,l as B,E as b,q as g}from"./index-e656eb90.js";const E={class:"flex justify-between"},N=x("b",null,"系统基础设置",-1),M=S({__name:"base",setup(O){const t=T({baiduCode:"",baiduSiteId:"",baiduToken:""}),k=p({}),c=p();async function _(){const a=await m.queryConfig({keys:["baiduCode","baiduSiteId","baiduToken"]});Object.assign(t,a.data)}function y(){var a;(a=c.value)==null||a.validate(async l=>{if(l){try{await m.setConfig({settings:C(t)}),b.success("变更配置信息成功")}catch{}_()}else b.error("请填写完整信息")})}function C(a){return Object.keys(a).map(l=>({configKey:l,configVal:a[l]}))}return U(()=>{_()}),(a,l)=>{const f=n("el-alert"),V=I,w=n("el-button"),s=n("el-input"),u=n("el-form-item"),i=n("el-col"),r=n("el-row"),h=n("el-form"),v=n("el-card");return j(),q("div",null,[e(V,null,{default:o(()=>[e(f,{closable:!1,"show-icon":"",title:"网页统计说明",description:"百度统计的配置默认使用演示demo数据主要用于展示目的。实际的统计数据将在网站首页显示。为获取更精确的数据分析建议查阅部署文档或访问百度统计官网申请专属于您网站的key和token。百度统计提供的是一项免费服务。如果您选择不使用这项服务只需将相关设置项留空即可。",type:"success"})]),_:1}),e(v,{style:{margin:"20px"}},{header:o(()=>[x("div",E,[N,e(w,{class:"button",text:"",onClick:y},{default:o(()=>[B(" 保存设置 ")]),_:1})])]),default:o(()=>[e(h,{ref_key:"formRef",ref:c,rules:k.value,model:t,"label-width":"120px"},{default:o(()=>[e(r,null,{default:o(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(u,{label:"百度统计siteId",prop:"baiduSiteId"},{default:o(()=>[e(s,{modelValue:t.baiduSiteId,"onUpdate:modelValue":l[0]||(l[0]=d=>t.baiduSiteId=d),placeholder:"请填写百度site_id、不会请查看部署文档",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:o(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(u,{label:"百度统计token",prop:"baiduToken"},{default:o(()=>[e(s,{modelValue:t.baiduToken,"onUpdate:modelValue":l[1]||(l[1]=d=>t.baiduToken=d),placeholder:"请填写百度access_token、不会请查看部署文档",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:o(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(u,{label:"百度统计代码",prop:"baiduCode"},{default:o(()=>[e(s,{modelValue:t.baiduCode,"onUpdate:modelValue":l[2]||(l[2]=d=>t.baiduCode=d),placeholder:"填写百度统计代码可统计每日访问量详情,如果没有使用用请查看详细文档!",type:"textarea",rows:12,clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof g=="function"&&g(M);export{M as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as K}from"./index-38e73db4.js";import{a as m}from"./config-61dee393.js";import{d as C,Q as k,r as f,x as q,h as i,o as N,c as U,e,f as t,a as S,l as j,E as v,q as B}from"./index-b779f4e0.js";const E={class:"flex justify-between"},M=S("b",null,"百度文本审核参数设置",-1),O=C({__name:"builtIn",setup(R){const l=k({nineaiBuiltInSensitiveStatus:"",nineaiBuiltInSensitiveApiBase:"",nineaiBuiltInSensitiveAuthKey:""}),g=f({nineaiBuiltInSensitiveStatus:[{required:!0,trigger:"blur",message:"请选择是否启用官方敏感词审核"}],nineaiBuiltInSensitiveApiBase:[{required:!0,trigger:"blur",message:"请填写官方敏感词审核Api地址"}],nineaiBuiltInSensitiveAuthKey:[{required:!0,trigger:"blur",message:"请填写官方敏感词审核授权Key"}]}),c=f();async function _(){const a=await m.queryConfig({keys:["nineaiBuiltInSensitiveStatus","nineaiBuiltInSensitiveAuthKey","nineaiBuiltInSensitiveApiBase"]});Object.assign(l,a.data)}function y(){var a;(a=c.value)==null||a.validate(async n=>{if(n){try{await m.setConfig({settings:I(l)}),v.success("变更配置信息成功")}catch{}_()}else v.error("请填写完整信息")})}function I(a){return Object.keys(a).map(n=>({configKey:n,configVal:a[n]}))}return q(()=>{_()}),(a,n)=>{const p=i("el-alert"),b=K,A=i("el-button"),h=i("el-switch"),x=i("el-tooltip"),s=i("el-form-item"),u=i("el-col"),r=i("el-row"),d=i("el-input"),V=i("el-form"),w=i("el-card");return N(),U("div",null,[e(b,null,{default:t(()=>[e(p,{closable:!1,"show-icon":"",title:"NineAi敏感词说明",description:"官方提供的敏感词检测Api、价格相对实惠、如需使用请联系管理员购买、后续开通专有的通道",type:"success"})]),_:1}),e(w,{style:{margin:"20px"}},{header:t(()=>[S("div",E,[M,e(A,{class:"button",text:"",onClick:y},{default:t(()=>[j(" 保存设置 ")]),_:1})])]),default:t(()=>[e(V,{ref_key:"formRef",ref:c,rules:g.value,model:l,"label-width":"150px"},{default:t(()=>[e(r,null,{default:t(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"开启此敏感词设置",prop:"nineaiBuiltInSensitiveStatus"},{default:t(()=>[e(x,{content:"开启将打开敏感词检测、如果同时开启其他敏感词将会通过菜单顺序仅同时开启一个!",placement:"top","show-after":500},{default:t(()=>[e(h,{modelValue:l.nineaiBuiltInSensitiveStatus,"onUpdate:modelValue":n[0]||(n[0]=o=>l.nineaiBuiltInSensitiveStatus=o),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(r,null,{default:t(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"文本审核ApiKey",prop:"nineaiBuiltInSensitiveApiBase"},{default:t(()=>[e(d,{modelValue:l.nineaiBuiltInSensitiveApiBase,"onUpdate:modelValue":n[1]||(n[1]=o=>l.nineaiBuiltInSensitiveApiBase=o),placeholder:"请填写官方敏感词审核Api地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:t(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"文本审核SecretKey",prop:"nineaiBuiltInSensitiveAuthKey"},{default:t(()=>[e(d,{modelValue:l.nineaiBuiltInSensitiveAuthKey,"onUpdate:modelValue":n[2]||(n[2]=o=>l.nineaiBuiltInSensitiveAuthKey=o),placeholder:"请填写官方敏感词审核授权Key",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof B=="function"&&B(O);export{O as default};
import{_ as K}from"./index-fd8a5577.js";import{a as m}from"./config-e611a8d0.js";import{d as C,Q as k,r as f,x as q,h as i,o as N,c as U,e,f as t,a as S,l as j,E as v,q as B}from"./index-e656eb90.js";const E={class:"flex justify-between"},M=S("b",null,"百度文本审核参数设置",-1),O=C({__name:"builtIn",setup(R){const l=k({nineaiBuiltInSensitiveStatus:"",nineaiBuiltInSensitiveApiBase:"",nineaiBuiltInSensitiveAuthKey:""}),g=f({nineaiBuiltInSensitiveStatus:[{required:!0,trigger:"blur",message:"请选择是否启用官方敏感词审核"}],nineaiBuiltInSensitiveApiBase:[{required:!0,trigger:"blur",message:"请填写官方敏感词审核Api地址"}],nineaiBuiltInSensitiveAuthKey:[{required:!0,trigger:"blur",message:"请填写官方敏感词审核授权Key"}]}),c=f();async function _(){const a=await m.queryConfig({keys:["nineaiBuiltInSensitiveStatus","nineaiBuiltInSensitiveAuthKey","nineaiBuiltInSensitiveApiBase"]});Object.assign(l,a.data)}function y(){var a;(a=c.value)==null||a.validate(async n=>{if(n){try{await m.setConfig({settings:I(l)}),v.success("变更配置信息成功")}catch{}_()}else v.error("请填写完整信息")})}function I(a){return Object.keys(a).map(n=>({configKey:n,configVal:a[n]}))}return q(()=>{_()}),(a,n)=>{const p=i("el-alert"),b=K,A=i("el-button"),h=i("el-switch"),x=i("el-tooltip"),s=i("el-form-item"),u=i("el-col"),r=i("el-row"),d=i("el-input"),V=i("el-form"),w=i("el-card");return N(),U("div",null,[e(b,null,{default:t(()=>[e(p,{closable:!1,"show-icon":"",title:"NineAi敏感词说明",description:"官方提供的敏感词检测Api、价格相对实惠、如需使用请联系管理员购买、后续开通专有的通道",type:"success"})]),_:1}),e(w,{style:{margin:"20px"}},{header:t(()=>[S("div",E,[M,e(A,{class:"button",text:"",onClick:y},{default:t(()=>[j(" 保存设置 ")]),_:1})])]),default:t(()=>[e(V,{ref_key:"formRef",ref:c,rules:g.value,model:l,"label-width":"150px"},{default:t(()=>[e(r,null,{default:t(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"开启此敏感词设置",prop:"nineaiBuiltInSensitiveStatus"},{default:t(()=>[e(x,{content:"开启将打开敏感词检测、如果同时开启其他敏感词将会通过菜单顺序仅同时开启一个!",placement:"top","show-after":500},{default:t(()=>[e(h,{modelValue:l.nineaiBuiltInSensitiveStatus,"onUpdate:modelValue":n[0]||(n[0]=o=>l.nineaiBuiltInSensitiveStatus=o),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(r,null,{default:t(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"文本审核ApiKey",prop:"nineaiBuiltInSensitiveApiBase"},{default:t(()=>[e(d,{modelValue:l.nineaiBuiltInSensitiveApiBase,"onUpdate:modelValue":n[1]||(n[1]=o=>l.nineaiBuiltInSensitiveApiBase=o),placeholder:"请填写官方敏感词审核Api地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:t(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"文本审核SecretKey",prop:"nineaiBuiltInSensitiveAuthKey"},{default:t(()=>[e(d,{modelValue:l.nineaiBuiltInSensitiveAuthKey,"onUpdate:modelValue":n[2]||(n[2]=o=>l.nineaiBuiltInSensitiveAuthKey=o),placeholder:"请填写官方敏感词审核授权Key",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof B=="function"&&B(O);export{O as default};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{Y as t}from"./index-b779f4e0.js";const a={queryChatAll:r=>t.get("chatLog/chatAll",{params:r}),queryDrawAll:r=>t.get("chatLog/drawAll",{params:r}),recDrawImg:r=>t.post("chatLog/recDrawImg",r),queryMjDrawAll:r=>t.get("midjourney/getList",{params:r}),recMjDrawImg:r=>t.post("midjourney/rec",r),delChatLog:r=>t.post("midjourney/del",r)};export{a as A};
import{Y as t}from"./index-e656eb90.js";const a={queryChatAll:r=>t.get("chatLog/chatAll",{params:r}),queryDrawAll:r=>t.get("chatLog/drawAll",{params:r}),recDrawImg:r=>t.post("chatLog/recDrawImg",r),queryMjDrawAll:r=>t.get("midjourney/getList",{params:r}),recMjDrawImg:r=>t.post("midjourney/rec",r),delChatLog:r=>t.post("midjourney/del",r)};export{a as A};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as K}from"./index-38e73db4.js";import{d as N,r as u,Q as j,x as F,h as l,R as H,o as m,c as C,e as t,f as o,S as P,U as O,b as i,k as Q,m as $,l as d,w as G,I as T,t as _,a as x,P as J,q as A}from"./index-b779f4e0.js";import{m as g}from"./marked.esm-76161808.js";import{A as W}from"./chat-d220f18e.js";import{u as X}from"./utcformatTime-e76e5157.js";const Z={class:"answer"},E=["innerHTML"],ee=N({__name:"chat",setup(te){const V=new g.Renderer;g.setOptions({renderer:V,gfm:!0,pedantic:!1,sanitize:!1});const c=u(!1),h=u([]),v=u(),b=u(0),a=j({userId:"",prompt:"",page:1,size:10}),y=u([]);async function p(){c.value=!0;try{const r=await W.queryChatAll(a);c.value=!1;const{rows:n,count:f}=r.data;b.value=f,y.value=n}catch{c.value=!1}}async function U(r){const n=await J.queryAllUser({size:30,username:r});h.value=n.data.rows}function I(r){r==null||r.resetFields(),p()}return F(()=>{p()}),(r,n)=>{const f=l("el-option"),D=l("el-select"),w=l("el-form-item"),M=l("el-input"),k=l("el-button"),S=l("el-form"),z=K,s=l("el-table-column"),L=l("el-popover"),R=l("el-table"),q=l("el-pagination"),B=l("el-row"),Y=H("loading");return m(),C("div",null,[t(z,null,{default:o(()=>[t(S,{ref_key:"formRef",ref:v,inline:!0,model:a},{default:o(()=>[t(w,{label:"用户名称",prop:"userId"},{default:o(()=>[t(D,{modelValue:a.userId,"onUpdate:modelValue":n[0]||(n[0]=e=>a.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"用户姓名[模糊搜索]","remote-show-suffix":"","remote-method":U},{default:o(()=>[(m(!0),C(P,null,O(i(h),e=>(m(),T(f,{key:e.id,label:e.username,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(w,{label:"用户询问的问题",prop:"prompt"},{default:o(()=>[t(M,{modelValue:a.prompt,"onUpdate:modelValue":n[1]||(n[1]=e=>a.prompt=e),placeholder:"提问问题[模糊搜索]",onKeydown:Q($(p,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1}),t(w,null,{default:o(()=>[t(k,{type:"primary",onClick:p},{default:o(()=>[d(" 查询 ")]),_:1}),t(k,{onClick:n[2]||(n[2]=e=>I(i(v)))},{default:o(()=>[d(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),t(z,{style:{width:"100%"}},{default:o(()=>[G((m(),T(R,{border:"",data:i(y),style:{width:"100%"},size:"large","tooltip-options":{}},{default:o(()=>[t(s,{fixed:"",prop:"username",label:"用户名称",width:"150"}),t(s,{prop:"createdAt",label:"角色",width:"80"},{default:o(e=>[d(_(e.row.role==="user"?"用户":"电脑"),1)]),_:1}),t(s,{prop:"email",label:"用户邮箱",width:"200"}),t(s,{prop:"answer",label:"用户询问/AI回复"},{default:o(e=>[t(L,{placement:"top",width:400,trigger:"click"},{reference:o(()=>[x("div",Z,_(e.row.role==="user"?e.row.prompt:e.row.answer),1)]),default:o(()=>[x("div",{class:"answer_container",innerHTML:i(g)(e.row.role==="user"?e.row.prompt:e.row.answer||"")},null,8,E)]),_:2},1024)]),_:1}),t(s,{prop:"completionTokens",label:"提问/回答Token",width:"140",align:"center"},{default:o(e=>[d(_(e.row.role==="user"?e.row.promptTokens:e.row.completionTokens),1)]),_:1}),t(s,{prop:"totalTokens",label:"总计Toekn",width:"110",align:"center"}),t(s,{prop:"model",label:"模型",width:"200"}),t(s,{prop:"createdAt",label:"提问时间",width:"200"},{default:o(e=>[d(_(i(X)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[Y,i(c)]]),t(B,{class:"flex justify-end mt-5"},{default:o(()=>[t(q,{"current-page":a.page,"onUpdate:currentPage":n[3]||(n[3]=e=>a.page=e),"page-size":a.size,"onUpdate:pageSize":n[4]||(n[4]=e=>a.size=e),class:"mr-5","page-sizes":[10,20,30,50],layout:"total, sizes, prev, pager, next, jumper",total:i(b),onSizeChange:p,onCurrentChange:p},null,8,["current-page","page-size","total"])]),_:1})]),_:1})])}}});typeof A=="function"&&A(ee);export{ee as default};
import{_ as K}from"./index-fd8a5577.js";import{d as N,r as u,Q as j,x as F,h as l,R as H,o as m,c as C,e as t,f as o,S as P,U as O,b as i,k as Q,m as $,l as d,w as G,I as T,t as _,a as x,P as J,q as A}from"./index-e656eb90.js";import{A as W}from"./chat-289dfdad.js";import{u as X}from"./utcformatTime-e76e5157.js";import{m as g}from"./marked.esm-76161808.js";const Z={class:"answer"},E=["innerHTML"],ee=N({__name:"chat",setup(te){const V=new g.Renderer;g.setOptions({renderer:V,gfm:!0,pedantic:!1,sanitize:!1});const c=u(!1),h=u([]),v=u(),b=u(0),a=j({userId:"",prompt:"",page:1,size:10}),y=u([]);async function p(){c.value=!0;try{const r=await W.queryChatAll(a);c.value=!1;const{rows:n,count:f}=r.data;b.value=f,y.value=n}catch{c.value=!1}}async function U(r){const n=await J.queryAllUser({size:30,username:r});h.value=n.data.rows}function I(r){r==null||r.resetFields(),p()}return F(()=>{p()}),(r,n)=>{const f=l("el-option"),D=l("el-select"),w=l("el-form-item"),M=l("el-input"),k=l("el-button"),S=l("el-form"),z=K,s=l("el-table-column"),L=l("el-popover"),R=l("el-table"),q=l("el-pagination"),B=l("el-row"),Y=H("loading");return m(),C("div",null,[t(z,null,{default:o(()=>[t(S,{ref_key:"formRef",ref:v,inline:!0,model:a},{default:o(()=>[t(w,{label:"用户名称",prop:"userId"},{default:o(()=>[t(D,{modelValue:a.userId,"onUpdate:modelValue":n[0]||(n[0]=e=>a.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"用户姓名[模糊搜索]","remote-show-suffix":"","remote-method":U},{default:o(()=>[(m(!0),C(P,null,O(i(h),e=>(m(),T(f,{key:e.id,label:e.username,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(w,{label:"用户询问的问题",prop:"prompt"},{default:o(()=>[t(M,{modelValue:a.prompt,"onUpdate:modelValue":n[1]||(n[1]=e=>a.prompt=e),placeholder:"提问问题[模糊搜索]",onKeydown:Q($(p,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1}),t(w,null,{default:o(()=>[t(k,{type:"primary",onClick:p},{default:o(()=>[d(" 查询 ")]),_:1}),t(k,{onClick:n[2]||(n[2]=e=>I(i(v)))},{default:o(()=>[d(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),t(z,{style:{width:"100%"}},{default:o(()=>[G((m(),T(R,{border:"",data:i(y),style:{width:"100%"},size:"large","tooltip-options":{}},{default:o(()=>[t(s,{fixed:"",prop:"username",label:"用户名称",width:"150"}),t(s,{prop:"createdAt",label:"角色",width:"80"},{default:o(e=>[d(_(e.row.role==="user"?"用户":"电脑"),1)]),_:1}),t(s,{prop:"email",label:"用户邮箱",width:"200"}),t(s,{prop:"answer",label:"用户询问/AI回复"},{default:o(e=>[t(L,{placement:"top",width:400,trigger:"click"},{reference:o(()=>[x("div",Z,_(e.row.role==="user"?e.row.prompt:e.row.answer),1)]),default:o(()=>[x("div",{class:"answer_container",innerHTML:i(g)(e.row.role==="user"?e.row.prompt:e.row.answer||"")},null,8,E)]),_:2},1024)]),_:1}),t(s,{prop:"completionTokens",label:"提问/回答Token",width:"140",align:"center"},{default:o(e=>[d(_(e.row.role==="user"?e.row.promptTokens:e.row.completionTokens),1)]),_:1}),t(s,{prop:"totalTokens",label:"总计Token",width:"110",align:"center"}),t(s,{prop:"model",label:"模型",width:"200"}),t(s,{prop:"createdAt",label:"提问时间",width:"200"},{default:o(e=>[d(_(i(X)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[Y,i(c)]]),t(B,{class:"flex justify-end mt-5"},{default:o(()=>[t(q,{"current-page":a.page,"onUpdate:currentPage":n[3]||(n[3]=e=>a.page=e),"page-size":a.size,"onUpdate:pageSize":n[4]||(n[4]=e=>a.size=e),class:"mr-5","page-sizes":[10,20,30,50],layout:"total, sizes, prev, pager, next, jumper",total:i(b),onSizeChange:p,onCurrentChange:p},null,8,["current-page","page-size","total"])]),_:1})]),_:1})])}}});typeof A=="function"&&A(ee);export{ee as default};

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{Y as e}from"./index-b779f4e0.js";const p={queryKeyList:t=>e.get("chatgpt/keyList",{params:t}),queryKeyModelList:t=>e.get("chatgpt/keyModelList",{params:t}),queryKeyDetail:t=>e.get("chatgpt/keyDetail",{params:t}),addGptKey:t=>e.post("chatgpt/addKey",t),updateGptKey:t=>e.post("chatgpt/updateKey",t),addWhiteUser:t=>e.post("chatgpt/addWhiteUser",t),updateWhiteUser:t=>e.post("chatgpt/updateWhiteUser",t),queryWhiteUserList:t=>e.get("chatgpt/userWhiteList",{params:t}),deleteGptKey:t=>e.post("chatgpt/deleteKey",t),queryChatBoxTypes:()=>e.get("chatgpt/queryChatBoxTypes"),setChatBoxType:t=>e.post("chatgpt/setChatBoxType",t),delChatBoxType:t=>e.post("chatgpt/delChatBoxType",t),queryChatBoxs:()=>e.get("chatgpt/queryChatBoxs"),setChatBox:t=>e.post("chatgpt/setChatBox",t),delChatBox:t=>e.post("chatgpt/delChatBox",t),queryChatPreTypes:()=>e.get("chatgpt/queryChatPreTypes"),setChatPreType:t=>e.post("chatgpt/setChatPreType",t),delChatPreType:t=>e.post("chatgpt/delChatPreType",t),queryChatPres:()=>e.get("chatgpt/queryChatPres"),setChatPre:t=>e.post("chatgpt/setChatPre",t),delChatPre:t=>e.post("chatgpt/delChatPre",t)};export{p as A};
import{Y as e}from"./index-e656eb90.js";const p={queryKeyList:t=>e.get("chatgpt/keyList",{params:t}),queryKeyModelList:t=>e.get("chatgpt/keyModelList",{params:t}),queryKeyDetail:t=>e.get("chatgpt/keyDetail",{params:t}),addGptKey:t=>e.post("chatgpt/addKey",t),updateGptKey:t=>e.post("chatgpt/updateKey",t),addWhiteUser:t=>e.post("chatgpt/addWhiteUser",t),updateWhiteUser:t=>e.post("chatgpt/updateWhiteUser",t),queryWhiteUserList:t=>e.get("chatgpt/userWhiteList",{params:t}),deleteGptKey:t=>e.post("chatgpt/deleteKey",t),queryChatBoxTypes:()=>e.get("chatgpt/queryChatBoxTypes"),setChatBoxType:t=>e.post("chatgpt/setChatBoxType",t),delChatBoxType:t=>e.post("chatgpt/delChatBoxType",t),queryChatBoxs:()=>e.get("chatgpt/queryChatBoxs"),setChatBox:t=>e.post("chatgpt/setChatBox",t),delChatBox:t=>e.post("chatgpt/delChatBox",t),queryChatPreTypes:()=>e.get("chatgpt/queryChatPreTypes"),setChatPreType:t=>e.post("chatgpt/setChatPreType",t),delChatPreType:t=>e.post("chatgpt/delChatPreType",t),queryChatPres:()=>e.get("chatgpt/queryChatPres"),setChatPre:t=>e.post("chatgpt/setChatPre",t),delChatPre:t=>e.post("chatgpt/delChatPre",t)};export{p as A};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as S}from"./index-38e73db4.js";import{a as f}from"./config-61dee393.js";import{d as k,Q as P,r as q,B,x as N,h as a,o as j,c as A,e,f as t,a as y,l as E,b as h,E as v,q as g}from"./index-b779f4e0.js";const R={class:"flex justify-between"},M=y("b",null,"chevereto图床参数设置",-1),O=k({__name:"chevereto",setup(I){const l=P({cheveretoStatus:"",cheveretoUploadPath:"",cheveretoKey:""}),d=q();async function i(){const n=await f.queryConfig({keys:["cheveretoKey","cheveretoUploadPath","cheveretoStatus"]});Object.assign(l,n.data)}function b(){var n;(n=d.value)==null||n.validate(async o=>{if(o){try{await f.setConfig({settings:x(l)}),v.success("变更配置信息成功")}catch{}i()}else v.error("请填写完整信息")})}function x(n){return Object.keys(n).map(o=>({configKey:o,configVal:n[o]}))}const p=B(()=>[{required:Number(l.cheveretoStatus)===1,message:"开启配置后请填写此项",trigger:"change"}]);return N(()=>{i()}),(n,o)=>{const _=a("el-alert"),V=S,w=a("el-button"),U=a("el-switch"),s=a("el-form-item"),c=a("el-col"),u=a("el-row"),m=a("el-input"),C=a("el-form"),K=a("el-card");return j(),A("div",null,[e(V,null,{default:t(()=>[e(_,{closable:!1,"show-icon":"",title:"chevereto图床配置说明",description:"chevereto图床官方文档 https://v4-docs.chevereto.com/developer/api/api-v1.html 同时开启多个存储会以菜单排序优先级开启使用",type:"success"})]),_:1}),e(K,{style:{margin:"20px"}},{header:t(()=>[y("div",R,[M,e(w,{class:"button",text:"",onClick:b},{default:t(()=>[E(" 保存设置 ")]),_:1})])]),default:t(()=>[e(C,{ref_key:"formRef",ref:d,model:l,"label-width":"100px"},{default:t(()=>[e(u,null,{default:t(()=>[e(c,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"服务启用状态",prop:"cheveretoStatus"},{default:t(()=>[e(U,{modelValue:l.cheveretoStatus,"onUpdate:modelValue":o[0]||(o[0]=r=>l.cheveretoStatus=r),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:t(()=>[e(c,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"上传地址",prop:"cheveretoUploadPath",rules:h(p)},{default:t(()=>[e(m,{modelValue:l.cheveretoUploadPath,"onUpdate:modelValue":o[1]||(o[1]=r=>l.cheveretoUploadPath=r),placeholder:"请填写您的图床上传地址",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(u,null,{default:t(()=>[e(c,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"ApiKey",prop:"cheveretoKey",rules:h(p)},{default:t(()=>[e(m,{modelValue:l.cheveretoKey,"onUpdate:modelValue":o[2]||(o[2]=r=>l.cheveretoKey=r),placeholder:"请填写ApiKey",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})])}}});typeof g=="function"&&g(O);export{O as default};
import{_ as S}from"./index-fd8a5577.js";import{a as f}from"./config-e611a8d0.js";import{d as k,Q as P,r as q,B,x as N,h as a,o as j,c as A,e,f as t,a as y,l as E,b as h,E as v,q as g}from"./index-e656eb90.js";const R={class:"flex justify-between"},M=y("b",null,"chevereto图床参数设置",-1),O=k({__name:"chevereto",setup(I){const l=P({cheveretoStatus:"",cheveretoUploadPath:"",cheveretoKey:""}),d=q();async function p(){const n=await f.queryConfig({keys:["cheveretoKey","cheveretoUploadPath","cheveretoStatus"]});Object.assign(l,n.data)}function b(){var n;(n=d.value)==null||n.validate(async o=>{if(o){try{await f.setConfig({settings:x(l)}),v.success("变更配置信息成功")}catch{}p()}else v.error("请填写完整信息")})}function x(n){return Object.keys(n).map(o=>({configKey:o,configVal:n[o]}))}const i=B(()=>[{required:Number(l.cheveretoStatus)===1,message:"开启配置后请填写此项",trigger:"change"}]);return N(()=>{p()}),(n,o)=>{const _=a("el-alert"),w=S,V=a("el-button"),U=a("el-switch"),s=a("el-form-item"),c=a("el-col"),u=a("el-row"),m=a("el-input"),C=a("el-form"),K=a("el-card");return j(),A("div",null,[e(w,null,{default:t(()=>[e(_,{closable:!1,"show-icon":"",title:"chevereto图床配置说明",description:"chevereto图床官方文档 https://v4-docs.chevereto.com/developer/api/api-v1.html 同时开启多个存储会以菜单排序优先级开启使用",type:"success"})]),_:1}),e(K,{style:{margin:"20px"}},{header:t(()=>[y("div",R,[M,e(V,{class:"button",text:"",onClick:b},{default:t(()=>[E(" 保存设置 ")]),_:1})])]),default:t(()=>[e(C,{ref_key:"formRef",ref:d,model:l,"label-width":"100px"},{default:t(()=>[e(u,null,{default:t(()=>[e(c,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"服务启用状态",prop:"cheveretoStatus"},{default:t(()=>[e(U,{modelValue:l.cheveretoStatus,"onUpdate:modelValue":o[0]||(o[0]=r=>l.cheveretoStatus=r),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(u,null,{default:t(()=>[e(c,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"上传地址",prop:"cheveretoUploadPath",rules:h(i)},{default:t(()=>[e(m,{modelValue:l.cheveretoUploadPath,"onUpdate:modelValue":o[1]||(o[1]=r=>l.cheveretoUploadPath=r),placeholder:"请填写您的图床上传地址",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(u,null,{default:t(()=>[e(c,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(s,{label:"ApiKey",prop:"cheveretoKey",rules:h(i)},{default:t(()=>[e(m,{modelValue:l.cheveretoKey,"onUpdate:modelValue":o[2]||(o[2]=r=>l.cheveretoKey=r),placeholder:"请填写ApiKey",clearable:"",type:"password","show-password":""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})])}}});typeof g=="function"&&g(O);export{O as default};

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{Y as o}from"./index-b779f4e0.js";const g={queryAllConfig:()=>o.get("config/queryAll"),queryGptKeys:()=>o.get("config/queryGptKeys"),setGptKeys:t=>o.post("config/setGptKeys",t),queryConfig:t=>o.post("config/query",t),copyright:()=>o.get("config/copyright"),setConfig:t=>o.post("config/set",t)};export{g as a};
import{Y as o}from"./index-e656eb90.js";const g={queryAllConfig:()=>o.get("config/queryAll"),queryGptKeys:()=>o.get("config/queryGptKeys"),setGptKeys:t=>o.post("config/setGptKeys",t),queryConfig:t=>o.post("config/query",t),copyright:()=>o.get("config/copyright"),setConfig:t=>o.post("config/set",t)};export{g as a};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as B}from"./index-38e73db4.js";import{a as f}from"./config-61dee393.js";import{d as w,Q as R,r as p,x as h,h as a,o as q,c as v,e,f as o,a as S,l as O,E as g,q as b}from"./index-b779f4e0.js";const U={class:"flex justify-between"},j=S("b",null,"COS参数设置",-1),E=w({__name:"cos",setup(N){const t=R({cosSecretId:"",cosSecretKey:"",cosBucket:"",cosRegion:""}),y=p({cosSecretKey:[{required:!0,trigger:"blur",message:"请填写SecretKey"}],cosBucket:[{required:!0,trigger:"blur",message:"请填写存储桶名称"}],cosRegion:[{required:!0,trigger:"blur",message:"请填写存储桶所属地域"}],cosSecretId:[{required:!0,trigger:"blur",message:"请填写SecretId"}]}),i=p();async function m(){const r=await f.queryConfig({keys:["cosSecretKey","cosBucket","cosRegion","cosSecretId"]});Object.assign(t,r.data)}function x(){var r;(r=i.value)==null||r.validate(async l=>{if(l){try{await f.setConfig({settings:V(t)}),g.success("变更配置信息成功")}catch{}m()}else g.error("请填写完整信息")})}function V(r){return Object.keys(r).map(l=>({configKey:l,configVal:r[l]}))}return h(()=>{m()}),(r,l)=>{const _=a("el-alert"),k=B,C=a("el-button"),c=a("el-input"),s=a("el-form-item"),u=a("el-col"),d=a("el-row"),I=a("el-form"),K=a("el-card");return q(),v("div",null,[e(k,null,{default:o(()=>[e(_,{closable:!1,"show-icon":"",title:"COS参数说明",description:"当前默认使用腾讯云COS对象存储、如果您有特殊的对接通道、将为您开放API对接",type:"success"})]),_:1}),e(K,{style:{margin:"20px"}},{header:o(()=>[S("div",U,[j,e(C,{class:"button",text:"",onClick:x},{default:o(()=>[O(" 保存设置 ")]),_:1})])]),default:o(()=>[e(I,{ref_key:"formRef",ref:i,rules:y.value,model:t,"label-width":"120px"},{default:o(()=>[e(d,null,{default:o(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(s,{label:"SecretId",prop:"cosSecretId"},{default:o(()=>[e(c,{modelValue:t.cosSecretId,"onUpdate:modelValue":l[0]||(l[0]=n=>t.cosSecretId=n),placeholder:"请填写SecretId",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:o(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(s,{label:"SecretKey",prop:"cosSecretKey"},{default:o(()=>[e(c,{modelValue:t.cosSecretKey,"onUpdate:modelValue":l[1]||(l[1]=n=>t.cosSecretKey=n),placeholder:"请填写SecretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:o(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(s,{label:"存储桶名称",prop:"cosBucket"},{default:o(()=>[e(c,{modelValue:t.cosBucket,"onUpdate:modelValue":l[2]||(l[2]=n=>t.cosBucket=n),placeholder:"请填写存储桶名称",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:o(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(s,{label:"所属地域",prop:"cosRegion"},{default:o(()=>[e(c,{modelValue:t.cosRegion,"onUpdate:modelValue":l[3]||(l[3]=n=>t.cosRegion=n),placeholder:"请填写所属地域(ap-guangzhou)",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof b=="function"&&b(E);export{E as default};
import{_ as B}from"./index-fd8a5577.js";import{a as f}from"./config-e611a8d0.js";import{d as w,Q as R,r as p,x as h,h as a,o as q,c as v,e,f as o,a as S,l as O,E as g,q as b}from"./index-e656eb90.js";const U={class:"flex justify-between"},j=S("b",null,"COS参数设置",-1),E=w({__name:"cos",setup(N){const t=R({cosSecretId:"",cosSecretKey:"",cosBucket:"",cosRegion:""}),y=p({cosSecretKey:[{required:!0,trigger:"blur",message:"请填写SecretKey"}],cosBucket:[{required:!0,trigger:"blur",message:"请填写存储桶名称"}],cosRegion:[{required:!0,trigger:"blur",message:"请填写存储桶所属地域"}],cosSecretId:[{required:!0,trigger:"blur",message:"请填写SecretId"}]}),i=p();async function m(){const r=await f.queryConfig({keys:["cosSecretKey","cosBucket","cosRegion","cosSecretId"]});Object.assign(t,r.data)}function x(){var r;(r=i.value)==null||r.validate(async l=>{if(l){try{await f.setConfig({settings:V(t)}),g.success("变更配置信息成功")}catch{}m()}else g.error("请填写完整信息")})}function V(r){return Object.keys(r).map(l=>({configKey:l,configVal:r[l]}))}return h(()=>{m()}),(r,l)=>{const _=a("el-alert"),k=B,C=a("el-button"),c=a("el-input"),s=a("el-form-item"),u=a("el-col"),d=a("el-row"),I=a("el-form"),K=a("el-card");return q(),v("div",null,[e(k,null,{default:o(()=>[e(_,{closable:!1,"show-icon":"",title:"COS参数说明",description:"当前默认使用腾讯云COS对象存储、如果您有特殊的对接通道、将为您开放API对接",type:"success"})]),_:1}),e(K,{style:{margin:"20px"}},{header:o(()=>[S("div",U,[j,e(C,{class:"button",text:"",onClick:x},{default:o(()=>[O(" 保存设置 ")]),_:1})])]),default:o(()=>[e(I,{ref_key:"formRef",ref:i,rules:y.value,model:t,"label-width":"120px"},{default:o(()=>[e(d,null,{default:o(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(s,{label:"SecretId",prop:"cosSecretId"},{default:o(()=>[e(c,{modelValue:t.cosSecretId,"onUpdate:modelValue":l[0]||(l[0]=n=>t.cosSecretId=n),placeholder:"请填写SecretId",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:o(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(s,{label:"SecretKey",prop:"cosSecretKey"},{default:o(()=>[e(c,{modelValue:t.cosSecretKey,"onUpdate:modelValue":l[1]||(l[1]=n=>t.cosSecretKey=n),placeholder:"请填写SecretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:o(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(s,{label:"存储桶名称",prop:"cosBucket"},{default:o(()=>[e(c,{modelValue:t.cosBucket,"onUpdate:modelValue":l[2]||(l[2]=n=>t.cosBucket=n),placeholder:"请填写存储桶名称",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:o(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:o(()=>[e(s,{label:"所属地域",prop:"cosRegion"},{default:o(()=>[e(c,{modelValue:t.cosRegion,"onUpdate:modelValue":l[3]||(l[3]=n=>t.cosRegion=n),placeholder:"请填写所属地域(ap-guangzhou)",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof b=="function"&&b(E);export{E as default};

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as O}from"./index-38e73db4.js";import{d as $,y as P,r,Q,B as X,x as j,h as i,R as G,o as s,c as g,e as l,f as t,b as n,ad as S,k as I,m as H,S as x,U as R,l as m,w as J,I as f,V as Y,X as Z,E as W,t as ee,q as N}from"./index-b779f4e0.js";import{A as k}from"./badWords-ce32d666.js";import{E as te}from"./index-7b2ba868.js";const le=$({__name:"custom",setup(oe){const T=P(),V=r(),U=r(0),p=r(!1),u=Q({word:"",status:"",page:1,size:500}),A=X(()=>T.settings.app.colorScheme),h=r([]);async function d(){try{p.value=!0;const a=await k.queryBadWords(u),{rows:o,count:v}=a.data;p.value=!1,U.value=v,h.value=o}catch{p.value=!1}}function D(a){a==null||a.resetFields(),d()}j(()=>{d()});const c=r(""),_=r(!1),B=r();async function K(a){await k.delBadWords({id:a}),W.success("删除敏感词成功"),await d()}function L(){_.value=!0,Z(()=>{B.value.input.focus()})}async function C(){c.value&&(await k.addBadWords({word:c.value}),W.success("添加敏感词成功"),u.status="",await d()),_.value=!1,c.value=""}return(a,o)=>{const v=i("el-alert"),w=O,y=i("el-form-item"),q=i("el-option"),z=i("el-select"),b=i("el-button"),E=i("el-form"),M=i("el-tag"),F=G("loading");return s(),g("div",null,[l(w,null,{default:t(()=>[l(v,{closable:!1,"show-icon":"",title:"敏感词说明",description:"当前为自定义敏感词、触发敏感词将自动拦截、如配置过三方平台、自定义检测将在三方平台通过后最后进行检测!",type:"success"})]),_:1}),l(w,null,{default:t(()=>[l(E,{ref_key:"formRef",ref:V,inline:!0,model:u},{default:t(()=>[l(y,{label:"敏感词",prop:"word"},{default:t(()=>[l(n(S),{modelValue:u.word,"onUpdate:modelValue":o[0]||(o[0]=e=>u.word=e),placeholder:"敏感词[模糊搜索]",onKeydown:I(H(d,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1}),l(y,{label:"敏感词状态",prop:"status"},{default:t(()=>[l(z,{modelValue:u.status,"onUpdate:modelValue":o[1]||(o[1]=e=>u.status=e),placeholder:"请选择敏感词状态",clearable:""},{default:t(()=>[(s(!0),g(x,null,R(n(te),e=>(s(),f(q,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(y,null,{default:t(()=>[l(b,{type:"primary",onClick:d},{default:t(()=>[m(" 查询 ")]),_:1}),l(b,{onClick:o[2]||(o[2]=e=>D(n(V)))},{default:t(()=>[m(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),J((s(),f(w,{style:{width:"100%"}},{default:t(()=>[(s(!0),g(x,null,R(n(h),e=>(s(),f(M,{key:e.id,type:"warning",class:"mr-3 mb-3",closable:"",hit:"",effect:n(A),"disable-transitions":!0,onClose:ae=>K(e.id)},{default:t(()=>[m(ee(e.word),1)]),_:2},1032,["effect","onClose"]))),128)),n(_)?(s(),f(n(S),{key:0,ref_key:"InputRef",ref:B,modelValue:n(c),"onUpdate:modelValue":o[3]||(o[3]=e=>Y(c)?c.value=e:null),class:"ml-1",style:{width:"80px"},size:"small",onKeyup:I(C,["enter"]),onBlur:C},null,8,["modelValue"])):(s(),f(b,{key:1,class:"ml-1",size:"small",onClick:L},{default:t(()=>[m(" + New Word ")]),_:1}))]),_:1})),[[F,n(p)]])])}}});typeof N=="function"&&N(le);export{le as default};
import{_ as O}from"./index-fd8a5577.js";import{d as $,y as P,r,Q,B as X,x as j,h as i,R as G,o as s,c as g,e as l,f as t,b as n,ad as S,k as I,m as H,S as x,U as R,l as m,w as J,I as f,V as Y,X as Z,E as W,t as ee,q as N}from"./index-e656eb90.js";import{A as k}from"./badWords-f2dbd210.js";import{E as te}from"./index-d5406c70.js";const le=$({__name:"custom",setup(oe){const T=P(),V=r(),U=r(0),p=r(!1),u=Q({word:"",status:"",page:1,size:500}),A=X(()=>T.settings.app.colorScheme),h=r([]);async function d(){try{p.value=!0;const a=await k.queryBadWords(u),{rows:o,count:v}=a.data;p.value=!1,U.value=v,h.value=o}catch{p.value=!1}}function D(a){a==null||a.resetFields(),d()}j(()=>{d()});const c=r(""),_=r(!1),B=r();async function K(a){await k.delBadWords({id:a}),W.success("删除敏感词成功"),await d()}function L(){_.value=!0,Z(()=>{B.value.input.focus()})}async function C(){c.value&&(await k.addBadWords({word:c.value}),W.success("添加敏感词成功"),u.status="",await d()),_.value=!1,c.value=""}return(a,o)=>{const v=i("el-alert"),w=O,y=i("el-form-item"),q=i("el-option"),z=i("el-select"),b=i("el-button"),E=i("el-form"),M=i("el-tag"),F=G("loading");return s(),g("div",null,[l(w,null,{default:t(()=>[l(v,{closable:!1,"show-icon":"",title:"敏感词说明",description:"当前为自定义敏感词、触发敏感词将自动拦截、如配置过三方平台、自定义检测将在三方平台通过后最后进行检测!",type:"success"})]),_:1}),l(w,null,{default:t(()=>[l(E,{ref_key:"formRef",ref:V,inline:!0,model:u},{default:t(()=>[l(y,{label:"敏感词",prop:"word"},{default:t(()=>[l(n(S),{modelValue:u.word,"onUpdate:modelValue":o[0]||(o[0]=e=>u.word=e),placeholder:"敏感词[模糊搜索]",onKeydown:I(H(d,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1}),l(y,{label:"敏感词状态",prop:"status"},{default:t(()=>[l(z,{modelValue:u.status,"onUpdate:modelValue":o[1]||(o[1]=e=>u.status=e),placeholder:"请选择敏感词状态",clearable:""},{default:t(()=>[(s(!0),g(x,null,R(n(te),e=>(s(),f(q,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(y,null,{default:t(()=>[l(b,{type:"primary",onClick:d},{default:t(()=>[m(" 查询 ")]),_:1}),l(b,{onClick:o[2]||(o[2]=e=>D(n(V)))},{default:t(()=>[m(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),J((s(),f(w,{style:{width:"100%"}},{default:t(()=>[(s(!0),g(x,null,R(n(h),e=>(s(),f(M,{key:e.id,type:"warning",class:"mr-3 mb-3",closable:"",hit:"",effect:n(A),"disable-transitions":!0,onClose:ae=>K(e.id)},{default:t(()=>[m(ee(e.word),1)]),_:2},1032,["effect","onClose"]))),128)),n(_)?(s(),f(n(S),{key:0,ref_key:"InputRef",ref:B,modelValue:n(c),"onUpdate:modelValue":o[3]||(o[3]=e=>Y(c)?c.value=e:null),class:"ml-1",style:{width:"80px"},size:"small",onKeyup:I(C,["enter"]),onBlur:C},null,8,["modelValue"])):(s(),f(b,{key:1,class:"ml-1",size:"small",onClick:L},{default:t(()=>[m(" + New Word ")]),_:1}))]),_:1})),[[F,n(p)]])])}}});typeof N=="function"&&N(le);export{le as default};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{Y as i}from"./index-b779f4e0.js";const s={getBaseInfo:t=>i.get("/statistic/base",{params:t}),getChatStatistic:t=>i.get("/statistic/chatStatistic",{params:t}),getBaiduVisit:t=>i.get("/statistic/baiduVisit",{params:t})};export{s as default};
import{Y as i}from"./index-e656eb90.js";const s={getBaseInfo:t=>i.get("/statistic/base",{params:t}),getChatStatistic:t=>i.get("/statistic/chatStatistic",{params:t}),getBaiduVisit:t=>i.get("/statistic/baiduVisit",{params:t})};export{s as default};

View File

@ -0,0 +1,9 @@
/**
* Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* Gitee https://gitee.com/hooray/fantastic-admin
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as $}from"./index-fd8a5577.js";import{A as I}from"./chat-289dfdad.js";import{d as J,r as d,Q,x as W,h as o,R as G,o as s,c,e as l,f as t,S as f,U as m,b as U,l as v,w as H,I as i,a as h,P as K,t as S,J as A,E as X,q as M}from"./index-e656eb90.js";import{R as Y,D as Z}from"./index-d5406c70.js";const ee={class:"flex draw_container"},le={class:"draw_head"},ae={class:"draw_footer flex mt-3 justify-between items-center"},te=J({__name:"draw",setup(oe){const _=d(!1),x=d(),C=d(0),V=d([]),n=Q({userId:"",rec:"",model:"dall-e-3",page:1,size:14}),z=d([]);async function u(){_.value=!0;try{const r=await I.queryDrawAll(n),{rows:a,count:g}=r.data;_.value=!1,C.value=g,z.value=a}catch{_.value=!1}}async function R(r){const a=await I.recDrawImg({id:r});X.success(a.data),u()}async function N(r){const a=await K.queryAllUser({size:30,username:r});V.value=a.data.rows}function L(r){r==null||r.resetFields(),u()}return W(()=>{u()}),(r,a)=>{const g=o("el-alert"),y=$,w=o("el-option"),b=o("el-select"),p=o("el-form-item"),k=o("el-button"),P=o("el-form"),T=o("el-image"),q=o("el-tag"),B=o("Plus"),D=o("el-icon"),O=o("Minus"),j=o("el-pagination"),E=o("el-row"),F=G("loading");return s(),c("div",null,[l(y,null,{default:t(()=>[l(g,{closable:!1,"show-icon":"",title:"绘画管理说明",description:"此处的为对话页绘画展示,推荐功能用户端暂无效果",type:"success"})]),_:1}),l(y,null,{default:t(()=>[l(P,{ref_key:"formRef",ref:x,inline:!0,model:n},{default:t(()=>[l(p,{label:"用户名称",prop:"userId"},{default:t(()=>[l(b,{modelValue:n.userId,"onUpdate:modelValue":a[0]||(a[0]=e=>n.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"用户姓名[模糊搜索]","remote-show-suffix":"","remote-method":N},{default:t(()=>[(s(!0),c(f,null,m(V.value,e=>(s(),i(w,{key:e.id,label:e.username,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(p,{label:"图片状态",prop:"rec"},{default:t(()=>[l(b,{modelValue:n.rec,"onUpdate:modelValue":a[1]||(a[1]=e=>n.rec=e),placeholder:"请选择图片状态",clearable:""},{default:t(()=>[(s(!0),c(f,null,m(U(Y),e=>(s(),i(w,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(p,{label:"绘画模型",prop:"model"},{default:t(()=>[l(b,{modelValue:n.model,"onUpdate:modelValue":a[2]||(a[2]=e=>n.model=e),placeholder:"请选择绘画模型",clearable:""},{default:t(()=>[(s(!0),c(f,null,m(U(Z),e=>(s(),i(w,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(p,null,{default:t(()=>[l(k,{type:"primary",onClick:u},{default:t(()=>[v(" 查询 ")]),_:1}),l(k,{onClick:a[3]||(a[3]=e=>L(x.value))},{default:t(()=>[v(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),H((s(),i(y,{style:{width:"100%"}},{default:t(()=>[h("div",ee,[(s(!0),c(f,null,m(z.value,e=>(s(),c("div",{key:e.id,style:{width:"280px height: 280px"},class:"draw_img_container flex border"},[h("div",le,[l(T,{fit:"contain","preview-src-list":[e.fileInfo],src:e.fileInfo,lazy:"",class:"draw_img","hide-on-click-modal":""},null,8,["preview-src-list","src"])]),h("div",ae,[l(q,{class:"ml-2",type:e.rec?"success":"info"},{default:t(()=>[v(S(e.rec?"已推荐":"未推荐"),1)]),_:2},1032,["type"]),l(k,{type:"warning",plain:"",size:"small",onClick:ne=>R(e.id)},{default:t(()=>[v(S(e.rec?"取消推荐":"加入推荐")+" ",1),e.rec?A("",!0):(s(),i(D,{key:0},{default:t(()=>[l(B)]),_:1})),e.rec?(s(),i(D,{key:1},{default:t(()=>[l(O)]),_:1})):A("",!0)]),_:2},1032,["onClick"])])]))),128))]),l(E,{class:"flex justify-end mt-5"},{default:t(()=>[l(j,{"current-page":n.page,"onUpdate:currentPage":a[4]||(a[4]=e=>n.page=e),"page-size":n.size,"onUpdate:pageSize":a[5]||(a[5]=e=>n.size=e),class:"mr-5","page-sizes":[10,20,30,50],layout:"total, sizes, prev, pager, next, jumper",total:C.value,onSizeChange:u,onCurrentChange:u},null,8,["current-page","page-size","total"])]),_:1})]),_:1})),[[F,_.value]])])}}});typeof M=="function"&&M(te);export{te as default};

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* Gitee https://gitee.com/hooray/fantastic-admin
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as $}from"./index-38e73db4.js";import{A as I}from"./chat-d220f18e.js";import{d as J,r as d,Q,x as W,h as o,R as G,o as s,c,e as l,f as t,S as f,U as m,b as A,l as v,w as H,I as i,a as h,P as K,t as U,J as L,E as X,q as S}from"./index-b779f4e0.js";import{R as Y,D as Z}from"./index-7b2ba868.js";const ee={class:"flex draw_container"},le={class:"draw_head"},ae={class:"draw_footer flex mt-3 justify-between items-center"},te=J({__name:"draw",setup(oe){const _=d(!1),x=d(),D=d(0),C=d([]),n=Q({userId:"",rec:"",model:"DALL-E2",page:1,size:14}),V=d([]);async function u(){_.value=!0;try{const r=await I.queryDrawAll(n),{rows:a,count:g}=r.data;_.value=!1,D.value=g,V.value=a}catch{_.value=!1}}async function M(r){const a=await I.recDrawImg({id:r});X.success(a.data),u()}async function R(r){const a=await K.queryAllUser({size:30,username:r});C.value=a.data.rows}function N(r){r==null||r.resetFields(),u()}return W(()=>{u()}),(r,a)=>{const g=o("el-alert"),y=$,w=o("el-option"),b=o("el-select"),p=o("el-form-item"),k=o("el-button"),P=o("el-form"),T=o("el-image"),j=o("el-tag"),q=o("Plus"),z=o("el-icon"),B=o("Minus"),E=o("el-pagination"),O=o("el-row"),F=G("loading");return s(),c("div",null,[l(y,null,{default:t(()=>[l(g,{closable:!1,"show-icon":"",title:"DALL-E绘画说明",description:"此处的midjourney模型选择是老版本的历史数据、新版迁移至新菜单分开",type:"success"})]),_:1}),l(y,null,{default:t(()=>[l(P,{ref_key:"formRef",ref:x,inline:!0,model:n},{default:t(()=>[l(p,{label:"用户名称",prop:"userId"},{default:t(()=>[l(b,{modelValue:n.userId,"onUpdate:modelValue":a[0]||(a[0]=e=>n.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"用户姓名[模糊搜索]","remote-show-suffix":"","remote-method":R},{default:t(()=>[(s(!0),c(f,null,m(C.value,e=>(s(),i(w,{key:e.id,label:e.username,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(p,{label:"图片状态",prop:"rec"},{default:t(()=>[l(b,{modelValue:n.rec,"onUpdate:modelValue":a[1]||(a[1]=e=>n.rec=e),placeholder:"请选择图片状态",clearable:""},{default:t(()=>[(s(!0),c(f,null,m(A(Y),e=>(s(),i(w,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(p,{label:"绘画模型",prop:"model"},{default:t(()=>[l(b,{modelValue:n.model,"onUpdate:modelValue":a[2]||(a[2]=e=>n.model=e),placeholder:"请选择绘画模型",clearable:""},{default:t(()=>[(s(!0),c(f,null,m(A(Z),e=>(s(),i(w,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(p,null,{default:t(()=>[l(k,{type:"primary",onClick:u},{default:t(()=>[v(" 查询 ")]),_:1}),l(k,{onClick:a[3]||(a[3]=e=>N(x.value))},{default:t(()=>[v(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),H((s(),i(y,{style:{width:"100%"}},{default:t(()=>[h("div",ee,[(s(!0),c(f,null,m(V.value,e=>(s(),c("div",{key:e.id,style:{width:"280px height: 280px"},class:"draw_img_container flex border"},[h("div",le,[l(T,{fit:"contain","preview-src-list":[e.fileInfo],src:e.fileInfo,lazy:"",class:"draw_img","hide-on-click-modal":""},null,8,["preview-src-list","src"])]),h("div",ae,[l(j,{class:"ml-2",type:e.rec?"success":"info"},{default:t(()=>[v(U(e.rec?"已推荐":"未推荐"),1)]),_:2},1032,["type"]),l(k,{type:"warning",plain:"",size:"small",onClick:ne=>M(e.id)},{default:t(()=>[v(U(e.rec?"取消推荐":"加入推荐")+" ",1),e.rec?L("",!0):(s(),i(z,{key:0},{default:t(()=>[l(q)]),_:1})),e.rec?(s(),i(z,{key:1},{default:t(()=>[l(B)]),_:1})):L("",!0)]),_:2},1032,["onClick"])])]))),128))]),l(O,{class:"flex justify-end mt-5"},{default:t(()=>[l(E,{"current-page":n.page,"onUpdate:currentPage":a[4]||(a[4]=e=>n.page=e),"page-size":n.size,"onUpdate:pageSize":a[5]||(a[5]=e=>n.size=e),class:"mr-5","page-sizes":[10,20,30,50],layout:"total, sizes, prev, pager, next, jumper",total:D.value,onSizeChange:u,onCurrentChange:u},null,8,["current-page","page-size","total"])]),_:1})]),_:1})),[[F,_.value]])])}}});typeof S=="function"&&S(te);export{te as default};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{d as _,r as m,x as N,F as R,o as w,c as f,N as b,G as T,b as s,n as k,O as M,a as y,t as x,J as z,l as E,g as A,j as F,u as I,h as u,e,f as n,P as L,E as j,q as V}from"./index-b779f4e0.js";import{_ as D}from"./index-38e73db4.js";const G=_({name:"FixedActionBar"}),J=_({...G,setup(i){const a=m(!1);N(()=>{l(),window.addEventListener("scroll",l)}),R(()=>{window.removeEventListener("scroll",l)});function l(){const r=document.documentElement.scrollTop||document.body.scrollTop,d=document.documentElement.clientHeight||document.body.clientHeight,o=document.documentElement.scrollHeight||document.body.scrollHeight;a.value=Math.ceil(r+d)>=o}return(r,d)=>(w(),f("div",{class:T(["actionbar",{shadow:!s(a)}]),"data-fixed-calc-width":""},[b(r.$slots,"default",{},void 0,!0)],2))}});const O=k(J,[["__scopeId","data-v-63511cc5"]]),K={class:"header"},Q={class:"main"},W={class:"title"},X={class:"content"},Y={key:0,class:"sub"},Z=_({name:"PageHeader"}),ee=_({...Z,props:{title:{type:String,required:!0},content:{type:String,default:""}},setup(i){const a=M();return(l,r)=>(w(),f("div",K,[y("div",Q,[y("div",W,x(i.title),1),y("div",X,[b(l.$slots,"content",{},()=>[E(x(i.content),1)],!0)])]),s(a).default?(w(),f("div",Y,[b(l.$slots,"default",{},void 0,!0)])):z("",!0)]))}});const oe=k(ee,[["__scopeId","data-v-24ce26ee"]]),te=_({name:"PersonalEditPassword"}),se=_({...te,setup(i){const a=A(),l=F(),r=I(),d=m(),o=m({password:"",newpassword:"",checkpassword:""}),S=m({password:[{required:!0,message:"请输入原密码",trigger:"blur"}],newpassword:[{required:!0,message:"请输入新密码",trigger:"blur"},{min:6,max:18,trigger:"blur",message:"密码长度为6到18位"}],checkpassword:[{required:!0,message:"请输入新密码",trigger:"blur"},{validator:(g,t,c)=>{t!==o.value.newpassword?c(new Error("两次密码不一致!")):c()}}]});function $(){d.value&&d.value.validate(g=>{if(g){const{password:t,newpassword:c}=o.value;L.updatePassword({oldPassword:t,password:c}).then(()=>{j({type:"success",message:"修改密码成功,请重新登录"}),r.logout().then(()=>{l.push({name:"login",query:{redirect:a.fullPath}})})})}})}return(g,t)=>{const c=oe,h=u("el-input"),v=u("el-form-item"),H=u("el-form"),P=u("el-col"),q=u("el-row"),C=D,U=u("el-button"),B=O;return w(),f("div",null,[e(c,{title:"修改密码",content:"定期修改密码可以提高帐号安全性噢~"}),e(C,null,{default:n(()=>[e(q,null,{default:n(()=>[e(P,{md:24,lg:12},{default:n(()=>[e(H,{ref_key:"formRef",ref:d,model:s(o),rules:s(S),"label-width":"120px"},{default:n(()=>[e(v,{label:"原密码",prop:"password"},{default:n(()=>[e(h,{modelValue:s(o).password,"onUpdate:modelValue":t[0]||(t[0]=p=>s(o).password=p),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(v,{label:"新密码",prop:"newpassword"},{default:n(()=>[e(h,{modelValue:s(o).newpassword,"onUpdate:modelValue":t[1]||(t[1]=p=>s(o).newpassword=p),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(v,{label:"确认新密码",prop:"checkpassword"},{default:n(()=>[e(h,{modelValue:s(o).checkpassword,"onUpdate:modelValue":t[2]||(t[2]=p=>s(o).checkpassword=p),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1})]),_:1})]),_:1}),e(B,null,{default:n(()=>[e(U,{type:"primary",size:"large",onClick:$},{default:n(()=>[E(" 提交 ")]),_:1})]),_:1})])}}});typeof V=="function"&&V(se);export{se as default};
import{d as _,r as m,x as N,F as R,o as w,c as f,N as b,G as T,b as s,n as k,O as M,a as y,t as x,J as z,l as E,g as A,j as F,u as I,h as u,e,f as n,P as L,E as j,q as V}from"./index-e656eb90.js";import{_ as D}from"./index-fd8a5577.js";const G=_({name:"FixedActionBar"}),J=_({...G,setup(i){const a=m(!1);N(()=>{l(),window.addEventListener("scroll",l)}),R(()=>{window.removeEventListener("scroll",l)});function l(){const r=document.documentElement.scrollTop||document.body.scrollTop,d=document.documentElement.clientHeight||document.body.clientHeight,o=document.documentElement.scrollHeight||document.body.scrollHeight;a.value=Math.ceil(r+d)>=o}return(r,d)=>(w(),f("div",{class:T(["actionbar",{shadow:!s(a)}]),"data-fixed-calc-width":""},[b(r.$slots,"default",{},void 0,!0)],2))}});const O=k(J,[["__scopeId","data-v-63511cc5"]]),K={class:"header"},Q={class:"main"},W={class:"title"},X={class:"content"},Y={key:0,class:"sub"},Z=_({name:"PageHeader"}),ee=_({...Z,props:{title:{type:String,required:!0},content:{type:String,default:""}},setup(i){const a=M();return(l,r)=>(w(),f("div",K,[y("div",Q,[y("div",W,x(i.title),1),y("div",X,[b(l.$slots,"content",{},()=>[E(x(i.content),1)],!0)])]),s(a).default?(w(),f("div",Y,[b(l.$slots,"default",{},void 0,!0)])):z("",!0)]))}});const oe=k(ee,[["__scopeId","data-v-24ce26ee"]]),te=_({name:"PersonalEditPassword"}),se=_({...te,setup(i){const a=A(),l=F(),r=I(),d=m(),o=m({password:"",newpassword:"",checkpassword:""}),S=m({password:[{required:!0,message:"请输入原密码",trigger:"blur"}],newpassword:[{required:!0,message:"请输入新密码",trigger:"blur"},{min:6,max:18,trigger:"blur",message:"密码长度为6到18位"}],checkpassword:[{required:!0,message:"请输入新密码",trigger:"blur"},{validator:(g,t,c)=>{t!==o.value.newpassword?c(new Error("两次密码不一致!")):c()}}]});function $(){d.value&&d.value.validate(g=>{if(g){const{password:t,newpassword:c}=o.value;L.updatePassword({oldPassword:t,password:c}).then(()=>{j({type:"success",message:"修改密码成功,请重新登录"}),r.logout().then(()=>{l.push({name:"login",query:{redirect:a.fullPath}})})})}})}return(g,t)=>{const c=oe,h=u("el-input"),v=u("el-form-item"),H=u("el-form"),P=u("el-col"),q=u("el-row"),C=D,U=u("el-button"),B=O;return w(),f("div",null,[e(c,{title:"修改密码",content:"定期修改密码可以提高帐号安全性噢~"}),e(C,null,{default:n(()=>[e(q,null,{default:n(()=>[e(P,{md:24,lg:12},{default:n(()=>[e(H,{ref_key:"formRef",ref:d,model:s(o),rules:s(S),"label-width":"120px"},{default:n(()=>[e(v,{label:"原密码",prop:"password"},{default:n(()=>[e(h,{modelValue:s(o).password,"onUpdate:modelValue":t[0]||(t[0]=p=>s(o).password=p),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(v,{label:"新密码",prop:"newpassword"},{default:n(()=>[e(h,{modelValue:s(o).newpassword,"onUpdate:modelValue":t[1]||(t[1]=p=>s(o).newpassword=p),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(v,{label:"确认新密码",prop:"checkpassword"},{default:n(()=>[e(h,{modelValue:s(o).checkpassword,"onUpdate:modelValue":t[2]||(t[2]=p=>s(o).checkpassword=p),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1})]),_:1})]),_:1}),e(B,null,{default:n(()=>[e(U,{type:"primary",size:"large",onClick:$},{default:n(()=>[E(" 提交 ")]),_:1})]),_:1})])}}});typeof V=="function"&&V(se);export{se as default};

View File

@ -0,0 +1,9 @@
/**
* Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* Gitee https://gitee.com/hooray/fantastic-admin
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as v}from"./index-fd8a5577.js";import{a as R}from"./config-e611a8d0.js";import{d as C,Q as O,r as g,x as w,h as n,o as y,c as k,e,f as l,a as i,l as E,E as M,q as L}from"./index-e656eb90.js";const q={class:"flex justify-between"},h=i("b",null,"邮件发送设置",-1),H=i("b",{class:"mb-5"},"SMTP服务器配置",-1),B=C({__name:"email",setup(j){const a=O({emailRegisterStatus:"",emailLoginStatus:"",MAILER_HOST:"",MAILER_PORT:"",MAILER_USER:"",MAILER_PASS:"",MAILER_SECURE:""}),A=g({registerBaseUrl:[{required:!0,trigger:"blur",message:"请填写注册后端服务基础地址!"}],MAILER_HOST:[{required:!0,trigger:"blur",message:"请填写SMTP服务器地址"}],MAILER_PORT:[{required:!0,trigger:"blur",message:"请填写SMTP服务器端口"}],MAILER_USER:[{required:!0,trigger:"blur",message:"请填写SMTP用户名称"}],MAILER_PASS:[{required:!0,trigger:"blur",message:"请填写SMTP用户密码"}],MAILER_SECURE:[{required:!0,trigger:"blur",message:"是否使用SSL"}]}),m=g();async function c(){const u=await R.queryConfig({keys:["emailRegisterStatus","emailLoginStatus","MAILER_HOST","MAILER_PORT","MAILER_USER","MAILER_PASS","MAILER_SECURE"]});Object.assign(a,u.data)}function b(){var u;(u=m.value)==null||u.validate(async t=>{if(t){try{await R.setConfig({settings:I(a)}),M.success("变更配置信息成功")}catch{}c()}else M.error("请填写完整信息")})}function I(u){return Object.keys(u).map(t=>({configKey:t,configVal:u[t]}))}return w(()=>{c()}),(u,t)=>{const f=n("el-alert"),x=v,V=n("el-button"),p=n("el-switch"),S=n("el-tooltip"),r=n("el-form-item"),_=n("el-col"),s=n("el-row"),d=n("el-input"),T=n("el-checkbox"),P=n("el-form"),U=n("el-card");return y(),k("div",null,[e(x,null,{default:l(()=>[e(f,{closable:!1,"show-icon":"",title:"邮件设置说明",description:"邮件设置主要用于发送注册时的激活邮件。要启用此功能,您首先需要在服务的.env文件中配置邮件服务的相关信息。",type:"success"})]),_:1}),e(U,{style:{margin:"20px"}},{header:l(()=>[i("div",q,[h,e(V,{class:"button",text:"",onClick:b},{default:l(()=>[E(" 保存设置 ")]),_:1})])]),default:l(()=>[e(P,{ref_key:"formRef",ref:m,rules:A.value,model:a,"label-width":"190px"},{default:l(()=>[e(s,null,{default:l(()=>[e(_,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"是否开启邮箱登录",prop:"emailLoginStatus"},{default:l(()=>[e(S,{class:"box-item",effect:"dark",content:"如您启用当前邮箱登录、则用户端可以通过邮箱登录!",placement:"right"},{default:l(()=>[e(p,{modelValue:a.emailLoginStatus,"onUpdate:modelValue":t[0]||(t[0]=o=>a.emailLoginStatus=o),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(s,null,{default:l(()=>[e(_,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"是否开启邮箱注册",prop:"emailRegisterStatus"},{default:l(()=>[e(S,{class:"box-item",effect:"dark",content:"如您启用当前邮箱注册、则用户端可以通过邮箱注册!",placement:"right"},{default:l(()=>[e(p,{modelValue:a.emailRegisterStatus,"onUpdate:modelValue":t[1]||(t[1]=o=>a.emailRegisterStatus=o),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(s,null,{default:l(()=>[H]),_:1}),e(s,null,{default:l(()=>[e(_,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"SMTP服务器地址",prop:"MAILER_HOST"},{default:l(()=>[e(d,{modelValue:a.MAILER_HOST,"onUpdate:modelValue":t[2]||(t[2]=o=>a.MAILER_HOST=o),placeholder:"示例: smtp.example.com",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(s,null,{default:l(()=>[e(_,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"SMTP服务器端口",prop:"MAILER_PORT"},{default:l(()=>[e(d,{modelValue:a.MAILER_PORT,"onUpdate:modelValue":t[3]||(t[3]=o=>a.MAILER_PORT=o),placeholder:"示例: 465",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(s,null,{default:l(()=>[e(_,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"SMTP用户名称",prop:"MAILER_USER"},{default:l(()=>[e(d,{modelValue:a.MAILER_USER,"onUpdate:modelValue":t[4]||(t[4]=o=>a.MAILER_USER=o),placeholder:"SMTP认证用户名",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(s,null,{default:l(()=>[e(_,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"SMTP用户密码",prop:"MAILER_PASS"},{default:l(()=>[e(d,{modelValue:a.MAILER_PASS,"onUpdate:modelValue":t[5]||(t[5]=o=>a.MAILER_PASS=o),placeholder:"SMTP认证密码",type:"password","show-password":"",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(s,null,{default:l(()=>[e(_,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"邮箱SSL配置",prop:"MAILER_SECURE"},{default:l(()=>[e(T,{modelValue:a.MAILER_SECURE,"onUpdate:modelValue":t[6]||(t[6]=o=>a.MAILER_SECURE=o),"true-label":"1","false-label":"0"},{default:l(()=>[E(" 启用SSL ")]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof L=="function"&&L(B);export{B as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as V}from"./index-38e73db4.js";import{a as _}from"./config-61dee393.js";import{d as k,Q as q,r as i,x as j,h as o,o as B,c as E,e,f as s,a as f,l as N,E as m,q as u}from"./index-b779f4e0.js";const A={class:"flex justify-between"},O=f("b",null,"模型系统消息预设",-1),R=k({__name:"globalPre",setup(U){const l=q({systemPreMessage:""}),p=i({systemPreMessage:[{required:!0,trigger:"blur",message:"请填写全局预设信息、用于模型预设词"}]}),a=i();async function r(){const t=await _.queryConfig({keys:["systemPreMessage"]});Object.assign(l,t.data)}function d(){var t;(t=a.value)==null||t.validate(async n=>{if(n){try{await _.setConfig({settings:g(l)}),m.success("变更配置信息成功")}catch{}r()}else m.error("请填写完整信息")})}function g(t){return Object.keys(t).map(n=>({configKey:n,configVal:t[n]}))}return j(()=>{r()}),(t,n)=>{const c=o("el-alert"),y=V,b=o("el-button"),x=o("el-input"),h=o("el-form-item"),w=o("el-col"),P=o("el-row"),C=o("el-form"),M=o("el-card");return B(),E("div",null,[e(y,null,{default:s(()=>[e(c,{closable:!1,"show-icon":"",title:"模型全局头部预设说明",description:"当前消息将会被追加到对话模型的全局预设当中、对应用APP无效、对其他所有绘画生效",type:"success"})]),_:1}),e(M,{style:{margin:"20px"}},{header:s(()=>[f("div",A,[O,e(b,{class:"button",text:"",onClick:d},{default:s(()=>[N(" 保存设置 ")]),_:1})])]),default:s(()=>[e(C,{ref_key:"formRef",ref:a,rules:p.value,model:l,"label-width":"140px"},{default:s(()=>[e(P,null,{default:s(()=>[e(w,{xs:24,md:20,lg:15,xl:12},{default:s(()=>[e(h,{label:"模型全局头部预设",prop:"systemPreMessage"},{default:s(()=>[e(x,{modelValue:l.systemPreMessage,"onUpdate:modelValue":n[0]||(n[0]=v=>l.systemPreMessage=v),type:"textarea",rows:5,placeholder:"请填写模型全局头部预设信息!",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof u=="function"&&u(R);export{R as default};
import{_ as V}from"./index-fd8a5577.js";import{a as _}from"./config-e611a8d0.js";import{d as k,Q as q,r as i,x as j,h as o,o as B,c as E,e,f as s,a as f,l as N,E as m,q as u}from"./index-e656eb90.js";const A={class:"flex justify-between"},O=f("b",null,"模型系统消息预设",-1),R=k({__name:"globalPre",setup(U){const l=q({systemPreMessage:""}),p=i({systemPreMessage:[{required:!0,trigger:"blur",message:"请填写全局预设信息、用于模型预设词"}]}),a=i();async function r(){const t=await _.queryConfig({keys:["systemPreMessage"]});Object.assign(l,t.data)}function d(){var t;(t=a.value)==null||t.validate(async n=>{if(n){try{await _.setConfig({settings:g(l)}),m.success("变更配置信息成功")}catch{}r()}else m.error("请填写完整信息")})}function g(t){return Object.keys(t).map(n=>({configKey:n,configVal:t[n]}))}return j(()=>{r()}),(t,n)=>{const c=o("el-alert"),y=V,b=o("el-button"),x=o("el-input"),h=o("el-form-item"),w=o("el-col"),P=o("el-row"),C=o("el-form"),M=o("el-card");return B(),E("div",null,[e(y,null,{default:s(()=>[e(c,{closable:!1,"show-icon":"",title:"模型全局头部预设说明",description:"当前消息将会被追加到对话模型的全局预设当中、对应用APP无效、对其他所有绘画生效",type:"success"})]),_:1}),e(M,{style:{margin:"20px"}},{header:s(()=>[f("div",A,[O,e(b,{class:"button",text:"",onClick:d},{default:s(()=>[N(" 保存设置 ")]),_:1})])]),default:s(()=>[e(C,{ref_key:"formRef",ref:a,rules:p.value,model:l,"label-width":"140px"},{default:s(()=>[e(P,null,{default:s(()=>[e(w,{xs:24,md:20,lg:15,xl:12},{default:s(()=>[e(h,{label:"模型全局头部预设",prop:"systemPreMessage"},{default:s(()=>[e(x,{modelValue:l.systemPreMessage,"onUpdate:modelValue":n[0]||(n[0]=v=>l.systemPreMessage=v),type:"textarea",rows:5,placeholder:"请填写模型全局头部预设信息!",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof u=="function"&&u(R);export{R as default};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{_ as h}from"./index-38e73db4.js";import{a as f}from"./config-61dee393.js";import{d as I,Q as q,r as y,x as C,h as u,o as N,c as k,e,f as l,a as H,l as G,E as _,q as g}from"./index-b779f4e0.js";const R={class:"flex justify-between"},j=H("b",null,"虎皮椒支付参数设置",-1),B=I({__name:"hupijiao",setup(E){const t=q({payHupiStatus:"",payHupiAppId:"",payHupiSecret:"",payHupiGatewayUrl:"",payHupiNotifyUrl:"",payHupiReturnUrl:""}),b=y({payHupiStatus:[{required:!0,trigger:"change",message:"请选择当前支付开启状态"}],payHupiSecret:[{required:!0,trigger:"blur",message:"请填写支付秘钥"}],payHupiGatewayUrl:[{required:!0,trigger:"blur",message:"请填写网关"}],payHupiAppId:[{required:!0,trigger:"blur",message:"请填写Appid"}],payHupiNotifyUrl:[{required:!0,trigger:"blur",message:"请填写支付通知地址"}]}),d=y();async function c(){const o=await f.queryConfig({keys:["payHupiSecret","payHupiNotifyUrl","payHupiGatewayUrl","payHupiReturnUrl","payHupiAppId","payHupiStatus"]});Object.assign(t,o.data)}function x(){var o;(o=d.value)==null||o.validate(async a=>{if(a){try{await f.setConfig({settings:U(t)}),_.success("变更配置信息成功")}catch{}c()}else _.error("请填写完整信息")})}function U(o){return Object.keys(o).map(a=>({configKey:a,configVal:o[a]}))}return C(()=>{c()}),(o,a)=>{const m=u("el-alert"),V=h,w=u("el-button"),S=u("el-switch"),r=u("el-form-item"),n=u("el-col"),i=u("el-row"),s=u("el-input"),v=u("el-form"),A=u("el-card");return N(),k("div",null,[e(V,null,{default:l(()=>[e(m,{closable:!1,"show-icon":"",title:"虎皮椒支付参数说明",description:"虎皮椒支付为三方支付、接入请购买微信渠道、详细参数参照 https://www.xunhupay.com/ 目前优先开通微信支付渠道、同时开启开启多种支付、我们将优先按照菜单顺序调用、所有的支付通知地址统一为 https://域名/api/pay/notify 将域名修改为您的域名即可!",type:"success"})]),_:1}),e(A,{style:{margin:"20px"}},{header:l(()=>[H("div",R,[j,e(w,{class:"button",text:"",onClick:x},{default:l(()=>[G(" 保存设置 ")]),_:1})])]),default:l(()=>[e(v,{ref_key:"formRef",ref:d,rules:b.value,model:t,"label-width":"120px"},{default:l(()=>[e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"启用当前支付",prop:"payHupiAppId"},{default:l(()=>[e(S,{modelValue:t.payHupiStatus,"onUpdate:modelValue":a[0]||(a[0]=p=>t.payHupiStatus=p),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"支付AppId",prop:"payHupiAppId"},{default:l(()=>[e(s,{modelValue:t.payHupiAppId,"onUpdate:modelValue":a[1]||(a[1]=p=>t.payHupiAppId=p),placeholder:"请填写AppId",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"支付网关地址",prop:"payHupiGatewayUrl"},{default:l(()=>[e(s,{modelValue:t.payHupiGatewayUrl,"onUpdate:modelValue":a[2]||(a[2]=p=>t.payHupiGatewayUrl=p),placeholder:"请填写支付网关地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"Secret秘钥",prop:"payHupiSecret"},{default:l(()=>[e(s,{modelValue:t.payHupiSecret,"onUpdate:modelValue":a[3]||(a[3]=p=>t.payHupiSecret=p),placeholder:"请填写支付秘钥",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"支付通知地址",prop:"payHupiSecret"},{default:l(()=>[e(s,{modelValue:t.payHupiNotifyUrl,"onUpdate:modelValue":a[4]||(a[4]=p=>t.payHupiNotifyUrl=p),placeholder:"请填写支付通知地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"支付回调地址",prop:"payHupiSecret"},{default:l(()=>[e(s,{modelValue:t.payHupiReturnUrl,"onUpdate:modelValue":a[5]||(a[5]=p=>t.payHupiReturnUrl=p),placeholder:"请填写支付成功后的回跳地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof g=="function"&&g(B);export{B as default};
import{_ as h}from"./index-fd8a5577.js";import{a as f}from"./config-e611a8d0.js";import{d as I,Q as q,r as y,x as C,h as u,o as N,c as k,e,f as l,a as H,l as G,E as _,q as g}from"./index-e656eb90.js";const R={class:"flex justify-between"},j=H("b",null,"虎皮椒支付参数设置",-1),B=I({__name:"hupijiao",setup(E){const t=q({payHupiStatus:"",payHupiAppId:"",payHupiSecret:"",payHupiGatewayUrl:"",payHupiNotifyUrl:"",payHupiReturnUrl:""}),b=y({payHupiStatus:[{required:!0,trigger:"change",message:"请选择当前支付开启状态"}],payHupiSecret:[{required:!0,trigger:"blur",message:"请填写支付秘钥"}],payHupiGatewayUrl:[{required:!0,trigger:"blur",message:"请填写网关"}],payHupiAppId:[{required:!0,trigger:"blur",message:"请填写Appid"}],payHupiNotifyUrl:[{required:!0,trigger:"blur",message:"请填写支付通知地址"}]}),d=y();async function c(){const o=await f.queryConfig({keys:["payHupiSecret","payHupiNotifyUrl","payHupiGatewayUrl","payHupiReturnUrl","payHupiAppId","payHupiStatus"]});Object.assign(t,o.data)}function x(){var o;(o=d.value)==null||o.validate(async a=>{if(a){try{await f.setConfig({settings:U(t)}),_.success("变更配置信息成功")}catch{}c()}else _.error("请填写完整信息")})}function U(o){return Object.keys(o).map(a=>({configKey:a,configVal:o[a]}))}return C(()=>{c()}),(o,a)=>{const m=u("el-alert"),V=h,w=u("el-button"),S=u("el-switch"),r=u("el-form-item"),n=u("el-col"),i=u("el-row"),s=u("el-input"),v=u("el-form"),A=u("el-card");return N(),k("div",null,[e(V,null,{default:l(()=>[e(m,{closable:!1,"show-icon":"",title:"虎皮椒支付参数说明",description:"虎皮椒支付为三方支付、接入请购买微信渠道、详细参数参照 https://www.xunhupay.com/ 目前优先开通微信支付渠道、同时开启开启多种支付、我们将优先按照菜单顺序调用、所有的支付通知地址统一为 https://域名/api/pay/notify 将域名修改为您的域名即可!",type:"success"})]),_:1}),e(A,{style:{margin:"20px"}},{header:l(()=>[H("div",R,[j,e(w,{class:"button",text:"",onClick:x},{default:l(()=>[G(" 保存设置 ")]),_:1})])]),default:l(()=>[e(v,{ref_key:"formRef",ref:d,rules:b.value,model:t,"label-width":"120px"},{default:l(()=>[e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"启用当前支付",prop:"payHupiAppId"},{default:l(()=>[e(S,{modelValue:t.payHupiStatus,"onUpdate:modelValue":a[0]||(a[0]=p=>t.payHupiStatus=p),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"支付AppId",prop:"payHupiAppId"},{default:l(()=>[e(s,{modelValue:t.payHupiAppId,"onUpdate:modelValue":a[1]||(a[1]=p=>t.payHupiAppId=p),placeholder:"请填写AppId",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"支付网关地址",prop:"payHupiGatewayUrl"},{default:l(()=>[e(s,{modelValue:t.payHupiGatewayUrl,"onUpdate:modelValue":a[2]||(a[2]=p=>t.payHupiGatewayUrl=p),placeholder:"请填写支付网关地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"Secret秘钥",prop:"payHupiSecret"},{default:l(()=>[e(s,{modelValue:t.payHupiSecret,"onUpdate:modelValue":a[3]||(a[3]=p=>t.payHupiSecret=p),placeholder:"请填写支付秘钥",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"支付通知地址",prop:"payHupiSecret"},{default:l(()=>[e(s,{modelValue:t.payHupiNotifyUrl,"onUpdate:modelValue":a[4]||(a[4]=p=>t.payHupiNotifyUrl=p),placeholder:"请填写支付通知地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(i,null,{default:l(()=>[e(n,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(r,{label:"支付回调地址",prop:"payHupiSecret"},{default:l(()=>[e(s,{modelValue:t.payHupiReturnUrl,"onUpdate:modelValue":a[5]||(a[5]=p=>t.payHupiReturnUrl=p),placeholder:"请填写支付成功后的回跳地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof g=="function"&&g(B);export{B as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{L as O,i as r,j as b,f as s,k as t,s as a,t as e,a as P,b as n}from"./notice-485566ca.js";import"./index-38e73db4.js";import"./index-b779f4e0.js";import"./config-61dee393.js";const S={__proto__:null,anyref:34,dataref:34,eqref:34,externref:34,i31ref:34,funcref:34,i8:34,i16:34,i32:34,i64:34,f32:34,f64:34},i=n.deserialize({version:14,states:"!^Q]QPOOOqQPO'#CbOOQO'#Cd'#CdOOQO'#Cl'#ClOOQO'#Ch'#ChQ]QPOOOOQO,58|,58|OxQPO,58|OOQO-E6f-E6fOOQO1G.h1G.h",stateData:"!P~O_OSPOSQOS~OTPOVROXROYROZROaQO~OSUO~P]OSXO~P]O",goto:"xaPPPPPPbPbPPPhPPPrXROPTVQTOQVPTWTVXSOPTV",nodeNames:"⚠ LineComment BlockComment Module ) ( App Identifier Type Keyword Number String",maxTerm:17,nodeProps:[["isolate",-3,1,2,11,""],["openedBy",4,"("],["closedBy",5,")"],["group",-6,6,7,8,9,10,11,"Expression"]],skippedNodes:[0,1,2],repeatNodeCount:1,tokenData:"0o~R^XY}YZ}]^}pq}rs!Stu#pxy'Uyz(e{|(j}!O(j!Q!R(s!R![*p!]!^.^#T#o.{~!SO_~~!VVOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j<%lO!S~!qOZ~~!tRO;'S!S;'S;=`!};=`O!S~#QWOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j;=`<%l!S<%lO!S~#mP;=`<%l!S~#siqr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~%giV~qr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~'ZPT~!]!^'^~'aTO!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~'sVOy'^yz(Yz!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~(_OQ~~(bP;=`<%l'^~(jOS~~(mQ!Q!R(s!R![*p~(xUY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){#l#m+[~)aRY~!Q![)j!g!h){#X#Y){~)oSY~!Q![)j!g!h){#R#S*j#X#Y){~*OR{|*X}!O*X!Q![*_~*[P!Q![*_~*dQY~!Q![*_#R#S*X~*mP!Q![)j~*uTY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){~+XP!Q![*p~+_R!Q![+h!c!i+h#T#Z+h~+mVY~!O!P,S!Q![+h!c!i+h!r!s-P#R#S+[#T#Z+h#d#e-P~,XTY~!Q![,h!c!i,h!r!s-P#T#Z,h#d#e-P~,mUY~!Q![,h!c!i,h!r!s-P#R#S.Q#T#Z,h#d#e-P~-ST{|-c}!O-c!Q![-o!c!i-o#T#Z-o~-fR!Q![-o!c!i-o#T#Z-o~-tSY~!Q![-o!c!i-o#R#S-c#T#Z-o~.TR!Q![,h!c!i,h#T#Z,h~.aP!]!^.d~.iSP~OY.dZ;'S.d;'S;=`.u<%lO.d~.xP;=`<%l.d~/QiX~qr.{st.{tu.{uv.{vw.{wx.{z{.{{|.{}!O.{!O!P.{!P!Q.{!Q![.{![!].{!^!_.{!_!`.{!`!a.{!a!b.{!b!c.{!c!}.{#Q#R.{#R#S.{#S#T.{#T#o.{#p#q.{#r#s.{",tokenizers:[0],topRules:{Module:[0,3]},specialized:[{term:9,get:o=>S[o]||-1}],tokenPrec:0}),Q=O.define({name:"wast",parser:i.configure({props:[r.add({App:b({closing:")",align:!1})}),s.add({App:t,BlockComment(o){return{from:o.from+2,to:o.to-2}}}),a({Keyword:e.keyword,Type:e.typeName,Number:e.number,String:e.string,Identifier:e.variableName,LineComment:e.lineComment,BlockComment:e.blockComment,"( )":e.paren})]}),languageData:{commentTokens:{line:";;",block:{open:"(;",close:";)"}},closeBrackets:{brackets:["(",'"']}}});function c(){return new P(Q)}export{c as wast,Q as wastLanguage};
import{L as O,i as r,j as b,f as s,k as t,s as a,t as e,a as P,b as n}from"./notice-6fc93963.js";import"./index-fd8a5577.js";import"./index-e656eb90.js";import"./config-e611a8d0.js";const S={__proto__:null,anyref:34,dataref:34,eqref:34,externref:34,i31ref:34,funcref:34,i8:34,i16:34,i32:34,i64:34,f32:34,f64:34},i=n.deserialize({version:14,states:"!^Q]QPOOOqQPO'#CbOOQO'#Cd'#CdOOQO'#Cl'#ClOOQO'#Ch'#ChQ]QPOOOOQO,58|,58|OxQPO,58|OOQO-E6f-E6fOOQO1G.h1G.h",stateData:"!P~O_OSPOSQOS~OTPOVROXROYROZROaQO~OSUO~P]OSXO~P]O",goto:"xaPPPPPPbPbPPPhPPPrXROPTVQTOQVPTWTVXSOPTV",nodeNames:"⚠ LineComment BlockComment Module ) ( App Identifier Type Keyword Number String",maxTerm:17,nodeProps:[["isolate",-3,1,2,11,""],["openedBy",4,"("],["closedBy",5,")"],["group",-6,6,7,8,9,10,11,"Expression"]],skippedNodes:[0,1,2],repeatNodeCount:1,tokenData:"0o~R^XY}YZ}]^}pq}rs!Stu#pxy'Uyz(e{|(j}!O(j!Q!R(s!R![*p!]!^.^#T#o.{~!SO_~~!VVOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j<%lO!S~!qOZ~~!tRO;'S!S;'S;=`!};=`O!S~#QWOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j;=`<%l!S<%lO!S~#mP;=`<%l!S~#siqr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~%giV~qr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~'ZPT~!]!^'^~'aTO!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~'sVOy'^yz(Yz!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~(_OQ~~(bP;=`<%l'^~(jOS~~(mQ!Q!R(s!R![*p~(xUY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){#l#m+[~)aRY~!Q![)j!g!h){#X#Y){~)oSY~!Q![)j!g!h){#R#S*j#X#Y){~*OR{|*X}!O*X!Q![*_~*[P!Q![*_~*dQY~!Q![*_#R#S*X~*mP!Q![)j~*uTY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){~+XP!Q![*p~+_R!Q![+h!c!i+h#T#Z+h~+mVY~!O!P,S!Q![+h!c!i+h!r!s-P#R#S+[#T#Z+h#d#e-P~,XTY~!Q![,h!c!i,h!r!s-P#T#Z,h#d#e-P~,mUY~!Q![,h!c!i,h!r!s-P#R#S.Q#T#Z,h#d#e-P~-ST{|-c}!O-c!Q![-o!c!i-o#T#Z-o~-fR!Q![-o!c!i-o#T#Z-o~-tSY~!Q![-o!c!i-o#R#S-c#T#Z-o~.TR!Q![,h!c!i,h#T#Z,h~.aP!]!^.d~.iSP~OY.dZ;'S.d;'S;=`.u<%lO.d~.xP;=`<%l.d~/QiX~qr.{st.{tu.{uv.{vw.{wx.{z{.{{|.{}!O.{!O!P.{!P!Q.{!Q![.{![!].{!^!_.{!_!`.{!`!a.{!a!b.{!b!c.{!c!}.{#Q#R.{#R#S.{#S#T.{#T#o.{#p#q.{#r#s.{",tokenizers:[0],topRules:{Module:[0,3]},specialized:[{term:9,get:o=>S[o]||-1}],tokenPrec:0}),Q=O.define({name:"wast",parser:i.configure({props:[r.add({App:b({closing:")",align:!1})}),s.add({App:t,BlockComment(o){return{from:o.from+2,to:o.to-2}}}),a({Keyword:e.keyword,Type:e.typeName,Number:e.number,String:e.string,Identifier:e.variableName,LineComment:e.lineComment,BlockComment:e.blockComment,"( )":e.paren})]}),languageData:{commentTokens:{line:";;",block:{open:"(;",close:";)"}},closeBrackets:{brackets:["(",'"']}}});function c(){return new P(Q)}export{c as wast,Q as wastLanguage};

File diff suppressed because one or more lines are too long

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{d as v,y as C,A as M,r as B,h as T,o as e,I as f,f as p,b as s,c as o,a as n,e as i,m as x,S as h,U as w,J as a,T as N,G as V,t as H,_ as I,n as L}from"./index-b779f4e0.js";import R from"./index-9bdcef29.js";import{T as $}from"./index-f4f8accb.js";import{u as b}from"./useMenu-5c3a6924.js";import"./index-ea68206b.js";const z={key:0},A={class:"header-container"},D={class:"main"},E=["onClick"],F={key:1},G=v({name:"Header"}),J=v({...G,setup(U){const l=C(),_=M(),{switchTo:k}=b(),d=B();function y(r){d.value.scrollBy({left:(r.deltaY||r.detail)>0?50:-50})}return(r,W)=>{const g=I,S=T("el-icon");return e(),f(N,{name:"header"},{default:p(()=>[s(l).mode==="pc"&&s(l).settings.menu.menuMode==="head"?(e(),o("header",z,[n("div",A,[n("div",D,[i(R),n("div",{ref_key:"navRef",ref:d,class:"nav",onWheel:x(y,["prevent"])},[(e(!0),o(h,null,w(s(_).allMenus,(t,c)=>{var m,u;return e(),o(h,{key:c},[t.children&&t.children.length!==0?(e(),o("div",{key:0,class:V(["item-container",{active:c===s(_).actived}])},[n("div",{class:"item",onClick:Y=>s(k)(c)},[(m=t.meta)!=null&&m.icon?(e(),f(S,{key:0},{default:p(()=>[i(g,{name:t.meta.icon},null,8,["name"])]),_:2},1024)):a("",!0),(u=t.meta)!=null&&u.title?(e(),o("span",F,H(t.meta.title),1)):a("",!0)],8,E)],2)):a("",!0)],64)}),128))],544)]),i($)])])):a("",!0)]),_:1})}}});const Q=L(J,[["__scopeId","data-v-381f1d85"]]);export{Q as default};
import{d as v,y as C,A as M,r as B,h as T,o as e,I as f,f as p,b as s,c as o,a as n,e as i,m as x,S as h,U as w,J as a,T as N,G as V,t as H,_ as I,n as L}from"./index-e656eb90.js";import R from"./index-9f94fa8a.js";import{T as $}from"./index-ae957cc8.js";import{u as b}from"./useMenu-e606149a.js";import"./index-c0974f86.js";const z={key:0},A={class:"header-container"},D={class:"main"},E=["onClick"],F={key:1},G=v({name:"Header"}),J=v({...G,setup(U){const l=C(),_=M(),{switchTo:k}=b(),d=B();function y(r){d.value.scrollBy({left:(r.deltaY||r.detail)>0?50:-50})}return(r,W)=>{const g=I,S=T("el-icon");return e(),f(N,{name:"header"},{default:p(()=>[s(l).mode==="pc"&&s(l).settings.menu.menuMode==="head"?(e(),o("header",z,[n("div",A,[n("div",D,[i(R),n("div",{ref_key:"navRef",ref:d,class:"nav",onWheel:x(y,["prevent"])},[(e(!0),o(h,null,w(s(_).allMenus,(t,c)=>{var m,u;return e(),o(h,{key:c},[t.children&&t.children.length!==0?(e(),o("div",{key:0,class:V(["item-container",{active:c===s(_).actived}])},[n("div",{class:"item",onClick:Y=>s(k)(c)},[(m=t.meta)!=null&&m.icon?(e(),f(S,{key:0},{default:p(()=>[i(g,{name:t.meta.icon},null,8,["name"])]),_:2},1024)):a("",!0),(u=t.meta)!=null&&u.title?(e(),o("span",F,H(t.meta.title),1)):a("",!0)],8,E)],2)):a("",!0)],64)}),128))],544)]),i($)])])):a("",!0)]),_:1})}}});const Q=L(J,[["__scopeId","data-v-381f1d85"]]);export{Q as default};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{s,t as r,b as n,L as o,i as P,c as a,f as i,k as Q,a as c}from"./notice-485566ca.js";import"./index-38e73db4.js";import"./index-b779f4e0.js";import"./config-61dee393.js";const p=s({String:r.string,Number:r.number,"True False":r.bool,PropertyName:r.propertyName,Null:r.null,",":r.separator,"[ ]":r.squareBracket,"{ }":r.brace}),g=n.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[p],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),T=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(O){if(!(O instanceof SyntaxError))throw O;const e=u(O,t.state.doc);return[{from:e,message:O.message,severity:"error",to:e}]}return[]};function u(t,O){let e;return(e=t.message.match(/at position (\d+)/))?Math.min(+e[1],O.length):(e=t.message.match(/at line (\d+) column (\d+)/))?Math.min(O.line(+e[1]).from+ +e[2]-1,O.length):0}const l=o.define({name:"json",parser:g.configure({props:[P.add({Object:a({except:/^\s*\}/}),Array:a({except:/^\s*\]/})}),i.add({"Object Array":Q})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function f(){return new c(l)}export{f as json,l as jsonLanguage,T as jsonParseLinter};
import{s,t as r,b as n,L as o,i as P,c as a,f as i,k as Q,a as c}from"./notice-6fc93963.js";import"./index-fd8a5577.js";import"./index-e656eb90.js";import"./config-e611a8d0.js";const p=s({String:r.string,Number:r.number,"True False":r.bool,PropertyName:r.propertyName,Null:r.null,",":r.separator,"[ ]":r.squareBracket,"{ }":r.brace}),g=n.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[p],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),T=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(O){if(!(O instanceof SyntaxError))throw O;const e=u(O,t.state.doc);return[{from:e,message:O.message,severity:"error",to:e}]}return[]};function u(t,O){let e;return(e=t.message.match(/at position (\d+)/))?Math.min(+e[1],O.length):(e=t.message.match(/at line (\d+) column (\d+)/))?Math.min(O.line(+e[1]).from+ +e[2]-1,O.length):0}const l=o.define({name:"json",parser:g.configure({props:[P.add({Object:a({except:/^\s*\}/}),Array:a({except:/^\s*\]/})}),i.add({"Object Array":Q})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function f(){return new c(l)}export{f as json,l as jsonLanguage,T as jsonParseLinter};

View File

@ -6,4 +6,4 @@
* Github https://github.com/hooray/fantastic-admin
*/
import{d as c,r as d,y as g,x as h,o as a,c as n,b as s,t as u,J as l,g as y,p as f,i as m,a as r,n as S}from"./index-b779f4e0.js";import{a as x}from"./config-61dee393.js";const i=e=>(f("data-v-183a3e32"),e=e(),m(),e),C={class:"copyright"},v=i(()=>r("span",null,"Copyright",-1)),k=i(()=>r("span",{class:"icon"},"©",-1)),I=["href"],b=c({name:"Copyright"}),B=c({...b,setup(e){const t=d({copyrightTitle:"NineAi Admin",copyrightUrl:"/"});async function _(){const o=await x.copyright();o.success&&(t.value=o.data)}y();const p=g();return h(()=>{_()}),(o,N)=>(a(),n("footer",C,[v,k,s(p).settings.copyright.beian?(a(),n("a",{key:0,href:s(t).copyrightUrl,target:"_blank",rel:"noopener"},u(s(t).copyrightTitle),9,I)):l("",!0)]))}});const T=S(B,[["__scopeId","data-v-183a3e32"]]);export{T as _};
import{d as c,r as d,y as g,x as h,o as a,c as n,b as s,t as u,J as l,g as y,p as f,i as m,a as r,n as S}from"./index-e656eb90.js";import{a as x}from"./config-e611a8d0.js";const i=e=>(f("data-v-183a3e32"),e=e(),m(),e),C={class:"copyright"},v=i(()=>r("span",null,"Copyright",-1)),k=i(()=>r("span",{class:"icon"},"©",-1)),I=["href"],b=c({name:"Copyright"}),B=c({...b,setup(e){const t=d({copyrightTitle:"NineAi Admin",copyrightUrl:"/"});async function _(){const o=await x.copyright();o.success&&(t.value=o.data)}y();const p=g();return h(()=>{_()}),(o,N)=>(a(),n("footer",C,[v,k,s(p).settings.copyright.beian?(a(),n("a",{key:0,href:s(t).copyrightUrl,target:"_blank",rel:"noopener"},u(s(t).copyrightTitle),9,I)):l("",!0)]))}});const T=S(B,[["__scopeId","data-v-183a3e32"]]);export{T as _};

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* Gitee https://gitee.com/hooray/fantastic-admin
* Github https://github.com/hooray/fantastic-admin
*/
const l=[{value:0,label:"待激活"},{value:1,label:"正常"},{value:2,label:"已封禁"},{value:3,label:"黑名单"}],a={0:"待激活",1:"正常",2:"已封禁",3:"黑名单"},e={0:"info",1:"success",2:"danger",3:"danger"},t={1:"注册赠送",2:"受邀请赠送",3:"邀请人赠送",4:"购买套餐赠送",5:"管理员赠送",6:"扫码支付",7:"绘画失败退款",8:"签到奖励"},u=[{value:1,label:"注册赠送"},{value:2,label:"受邀请赠送"},{value:3,label:"邀请人赠送"},{value:4,label:"购买套餐赠送"},{value:5,label:"管理员赠送"},{value:6,label:"扫码支付"},{value:7,label:"绘画失败退款"},{value:8,label:"签到奖励"}],s={0:"关闭",1:"开启"},b={0:"danger",1:"success"},o=[{value:0,label:"禁用"},{value:1,label:"启动"}],v=[{value:0,label:"未使用"},{value:1,label:"已使用"}],T=[{value:0,label:"未推荐"},{value:1,label:"已推荐"}],n=[{value:0,label:"禁用"},{value:1,label:"启用"},{value:3,label:"待审核"},{value:4,label:"拒绝共享"},{value:5,label:"通过共享"}],S=[{value:"0",label:"未启用"},{value:"1",label:"已启用"}],_=[{value:0,label:"待审核"},{value:1,label:"已通过"},{value:-1,label:"已拒绝"}],c=[{value:0,label:"未推荐"},{value:1,label:"已推荐"}],p=[{value:1,label:"支付宝"},{value:2,label:"微信"}],A=[{value:1,label:"正在排队"},{value:2,label:"正在绘制"},{value:3,label:"绘制完成"},{value:4,label:"绘制失败"},{value:5,label:"绘制超时"}],E={0:"danger",1:"success"},g={"-1":"欠费锁定",0:"未启用",1:"已启用",3:"待审核",4:"拒绝共享",5:"通过共享"},P=["gpt-3.5-turbo","gpt-3.5-turbo-1106","gpt-3.5-turbo-16k","gpt-3.5-turbo-0125","gpt-4","gpt-4-0613","gpt-4-32k","gpt-4-32k-0613","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-all","gpt-4-0125-preview","dall-e-3","midjourney","claude-2.0","claude-2.1","claude-3-sonnet-20240229","claude-3-opus-20240229","gemini-pro","ERNIE-Bot","ERNIE-Bot-4","ERNIE-Bot-turbo","qwen-turbo","qwen-plus","qwen-max","hunyuan","chatglm_turbo","chatglm_pro","chatglm_std","chatglm_lite","360GPT_S2_V9","SparkDesk","tts-1","translation-gpt-3.5-turbo-0125","mindmap-gpt-3.5-turbo-0125","gpts"],r=[{value:"mj",label:"MidjourneyAi"},{value:"DALL-E2",label:"DALL-E"}],O=[{value:0,label:"未支付"},{value:1,label:"已支付"},{value:2,label:"支付失败"},{value:3,label:"支付超时"}],I={0:"未支付",1:"已支付",2:"支付失败",3:"支付超时"},i=[{value:"epay",label:"易支付"},{value:"hupi",label:"虎皮椒"},{value:"wechat",label:"微信支付"},{value:"mpay",label:"码支付"},{value:"ltzf",label:"蓝兔支付"}],R={epay:"易支付",hupi:"虎皮椒",wechat:"微信支付",mpay:"码支付",ltzf:"蓝兔支付"},N=[{value:1,label:"等待中"},{value:2,label:"绘制中"},{value:3,label:"绘制完成"},{value:4,label:"绘制失败"},{value:5,label:"绘制超时"}],M=[{value:"system",label:"系统"},{value:"user",label:"用户"}],m={1:"排队中",2:"绘制中",3:"绘制完成",4:"绘制失败",5:"绘制超时"},L=[{value:"百度云检测",label:"百度云检测"},{value:"自定义检测",label:"自定义检测"}],U=[{value:1,label:"基础对话"},{value:2,label:"绘画模型"},{value:3,label:"特殊模型"}],d={1:"基础对话",2:"绘画模型",3:"特殊模型"},D={1:["gpt-3.5-turbo","gpt-3.5-turbo-1106","gpt-3.5-turbo-16k","gpt-3.5-turbo-0125","gpt-4","gpt-4-0613","gpt-4-32k","gpt-4-32k-0613","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-all","gpt-4-0125-preview","claude-2.0","claude-2.1","claude-3-sonnet-20240229","claude-3-opus-20240229","gemini-pro","gemini-pro-vision","ERNIE-Bot","ERNIE-Bot-4","ERNIE-Bot-turbo","qwen-turbo","qwen-plus","qwen-max","hunyuan","chatglm_turbo","chatglm_pro","chatglm_std","chatglm_lite","360GPT_S2_V9","SparkDesk"],2:["dall-e-3","midjourney"],3:["tts-1","translation-gpt-3.5-turbo-0125","mindmap-gpt-3.5-turbo-0125","gpts"]},h=[{value:1,label:"普通积分"},{value:2,label:"高级积分"},{value:3,label:"绘画积分"}];export{M as A,v as C,r as D,n as E,b as I,P as M,_ as O,i as P,g as Q,T as R,L as T,e as U,A as W,N as a,S as b,E as c,c as d,m as e,D as f,U as g,d as h,h as i,O as j,R as k,I as l,o as m,s as n,p as o,a as p,l as q,u as r,t as s};

Some files were not shown because too many files have changed in this diff Show More