This commit is contained in:
vastxie 2024-07-31 14:12:56 +08:00
parent dd0e1dafd5
commit c831009379
366 changed files with 1881 additions and 1540 deletions

View File

@ -22,3 +22,6 @@ ISDEV=FALSE
weChatOpenUrl=https://open.weixin.qq.com weChatOpenUrl=https://open.weixin.qq.com
weChatApiUrl=https://api.weixin.qq.com weChatApiUrl=https://api.weixin.qq.com
weChatMpUrl=https://mp.weixin.qq.com weChatMpUrl=https://mp.weixin.qq.com
# 自定义后台路径
ADMIN_SERVE_ROOT=/admin

View File

@ -23,3 +23,6 @@ ISDEV=FALSE
weChatOpenUrl=https://open.weixin.qq.com weChatOpenUrl=https://open.weixin.qq.com
weChatApiUrl=https://api.weixin.qq.com weChatApiUrl=https://api.weixin.qq.com
weChatMpUrl=https://mp.weixin.qq.com weChatMpUrl=https://mp.weixin.qq.com
# 自定义后台路径
ADMIN_SERVE_ROOT=/admin

6
.gitignore vendored
View File

@ -1,5 +1,5 @@
node_modules node_modules
logs
pnpm-lock.yaml pnpm-lock.yaml
sql .env
data /public/file
.idea

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"cSpell.words": [
"Luma"
]
}

View File

@ -106,6 +106,41 @@
## 更新日志 ## 更新日志
### 稳定版 v3.7.0
- 新增代码预览~~及编辑~~弹窗HTML 格式)。
- 新增问题编辑及重新生成功能。
- 新增全模型文件分析功能 (模型设置-文件上传类型),选择后对于非图片的文本格式,将读取文件内容,作为 system 传给 AI图片按 4o 格式传图。(建议搭配 token 关联计费及 `gpt-4o-mini` 使用)
- 新增 Luma 视频图生视频,视频尺寸选择。
- 取消注册验证码,改为获取 邮箱/手机 验证码时滑动验证。
- 优化新建对话、对话中断、切换对话的逻辑。取消旧的初始新建对话页可直接提问或使用预设。AI回复中禁止切换对话和开启新对话。
- 对话页应用广场改为弹窗方式。
- 调整暗色模式 UI 显示,整体显示更美观。
- 调整购买套餐弹窗样式。
- 后台显示设置新增 `显示全局水印` 选项开启后将在对话页显示基于用户ID的水印。
- 后台插件显示-基础显示,新增 `隐藏插件` 选项,开启后,用户端将隐藏插件功能。
- 环境变量新增自定义后台路径设置,后台地址可自行使用 `/admin` 之外的的路径。
- 新增自定义欢迎页,跳转样式参考:
```html
<button class="button" onclick="goToChat()">开始对话</button>
<script>
function goToChat() {
window.parent.postMessage('goToChat', '*');
}
</script>
```
- ~~后台新增本地存储(开启后将优先使用本地存储方式保存数据,有些场景需开启跨域访问,可能需额外自行解决读写权限问题。文件存储目录为 `/public/file`,更新迁移时请做好数据维护及备份。)~~
- ~~开启本地存储后,生成的视频及音乐将默认保存到本地。~~
- ~~新增知识库问答【数据管理】-【内容预设】。通过检测提问关键词,将匹配到的内容附加到 `system` 参数中。~~
- ~~Midjourney 绘图适配 `describe` ,支持以图生文。~~
- ~~Suno 音乐新增调整歌词,选择音乐类型及风格。~~
注:划线部分为开发版保留功能。
<details>
<summary>历史日志</summary>
### 稳定版 v3.5.0 ### 稳定版 v3.5.0
主要更新内容: 主要更新内容:
@ -123,10 +158,6 @@
- 优化首页“九宫格”显示(使用内置对话预设、不再依赖后端配置) - 优化首页“九宫格”显示(使用内置对话预设、不再依赖后端配置)
- Midjourney 绘图支持 `图生图`、`人脸一致性`、`风格一致性`、`MJ版本`自定义参数等自定义选择。 - Midjourney 绘图支持 `图生图`、`人脸一致性`、`风格一致性`、`MJ版本`自定义参数等自定义选择。
<details>
<summary>历史日志</summary>
### 稳定版 v3.3.0 ### 稳定版 v3.3.0
- 重构流式回复逻辑,加入错误反馈并优化用户端等待动画。 - 重构流式回复逻辑,加入错误反馈并优化用户端等待动画。

12
dist/app.module.js vendored
View File

@ -50,9 +50,17 @@ AppModule = __decorate([
database_module_1.DatabaseModule, database_module_1.DatabaseModule,
serve_static_1.ServeStaticModule.forRoot({ serve_static_1.ServeStaticModule.forRoot({
rootPath: (0, path_1.join)(__dirname, '..', 'public/admin'), rootPath: (0, path_1.join)(__dirname, '..', 'public/admin'),
serveRoot: '/admin', serveRoot: process.env.ADMIN_SERVE_ROOT || '/admin',
}, { }, {
rootPath: (0, path_1.join)(__dirname, '..', 'public'), rootPath: (0, path_1.join)(__dirname, '..', 'public/file'),
serveRoot: '/file',
serveStaticOptions: {
setHeaders: (res, path, stat) => {
res.set('Access-Control-Allow-Origin', '*');
},
},
}, {
rootPath: (0, path_1.join)(__dirname, '..', 'public/chat'),
serveRoot: '/', serveRoot: '/',
}), }),
user_module_1.UserModule, user_module_1.UserModule,

View File

@ -7,20 +7,31 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.AllExceptionsFilter = void 0; exports.AllExceptionsFilter = void 0;
const common_1 = require("@nestjs/common");
const result_1 = require("../result"); const result_1 = require("../result");
const common_1 = require("@nestjs/common");
let AllExceptionsFilter = class AllExceptionsFilter { let AllExceptionsFilter = class AllExceptionsFilter {
catch(exception, host) { catch(exception, host) {
const ctx = host.switchToHttp(); const ctx = host.switchToHttp();
const response = ctx.getResponse(); const response = ctx.getResponse();
const request = ctx.getRequest(); const request = ctx.getRequest();
const exceptionRes = exception.getResponse() || 'inter server error'; const exceptionRes = exception.getResponse() || 'Internal server error';
const message = (exceptionRes === null || exceptionRes === void 0 ? void 0 : exceptionRes.message) ? (Array.isArray(exceptionRes) ? exceptionRes['message'][0] : exceptionRes['message']) : exceptionRes; const message = (exceptionRes === null || exceptionRes === void 0 ? void 0 : exceptionRes.message)
const statusCode = exception.getStatus() || 400; ? Array.isArray(exceptionRes)
const status = exception instanceof common_1.HttpException ? exception.getStatus() : common_1.HttpStatus.INTERNAL_SERVER_ERROR; ? exceptionRes['message'][0]
response.status(status); : exceptionRes['message']
response.header('Content-Type', 'application/json; charset=utf-8'); : exceptionRes;
response.send(result_1.Result.fail(statusCode, Array.isArray(message) ? message[0] : message)); const status = exception instanceof common_1.HttpException
? exception.getStatus()
: common_1.HttpStatus.INTERNAL_SERVER_ERROR;
if (status === common_1.HttpStatus.NOT_FOUND) {
response.redirect('/');
}
else {
const statusCode = status || 400;
response.status(status);
response.header('Content-Type', 'application/json; charset=utf-8');
response.send(result_1.Result.fail(statusCode, Array.isArray(message) ? message[0] : message));
}
} }
}; };
AllExceptionsFilter = __decorate([ AllExceptionsFilter = __decorate([

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getTokenCount = void 0; exports.getTokenCount = void 0;
const tiktoken_1 = require("@dqbd/tiktoken"); const gpt_tokenizer_1 = require("gpt-tokenizer");
const getTokenCount = async (input) => { const getTokenCount = async (input) => {
let text = ''; let text = '';
if (Array.isArray(input)) { if (Array.isArray(input)) {
@ -25,7 +25,6 @@ const getTokenCount = async (input) => {
text = String(input); text = String(input);
} }
text = text.replace(/<\|endoftext\|>/g, ''); text = text.replace(/<\|endoftext\|>/g, '');
const tokenizer = (0, tiktoken_1.get_encoding)('cl100k_base'); return (0, gpt_tokenizer_1.encode)(text).length;
return tokenizer.encode(text).length;
}; };
exports.getTokenCount = getTokenCount; exports.getTokenCount = getTokenCount;

7
dist/main.js vendored
View File

@ -32,7 +32,12 @@ async function bootstrap() {
app.useLogger(app.get(custom_logger_service_1.CustomLoggerService)); app.useLogger(app.get(custom_logger_service_1.CustomLoggerService));
app.use(compression()); app.use(compression());
app.use(xmlBodyParser()); app.use(xmlBodyParser());
app.enableCors(); app.enableCors({
origin: '*',
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
preflightContinue: false,
optionsSuccessStatus: 204,
});
app.setGlobalPrefix('/api'); app.setGlobalPrefix('/api');
app.useGlobalInterceptors(new transform_interceptor_1.TransformInterceptor()); app.useGlobalInterceptors(new transform_interceptor_1.TransformInterceptor());
app.useGlobalFilters(new typeOrmQueryFailed_filter_1.TypeOrmQueryFailedFilter()); app.useGlobalFilters(new typeOrmQueryFailed_filter_1.TypeOrmQueryFailedFilter());

View File

@ -13,9 +13,13 @@ exports.LumaVideoService = void 0;
const common_1 = require("@nestjs/common"); const common_1 = require("@nestjs/common");
const axios_1 = require("axios"); const axios_1 = require("axios");
const chatLog_service_1 = require("../chatLog/chatLog.service"); const chatLog_service_1 = require("../chatLog/chatLog.service");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const upload_service_1 = require("../upload/upload.service");
let LumaVideoService = class LumaVideoService { let LumaVideoService = class LumaVideoService {
constructor(chatLogService) { constructor(chatLogService, globalConfigService, uploadService) {
this.chatLogService = chatLogService; this.chatLogService = chatLogService;
this.globalConfigService = globalConfigService;
this.uploadService = uploadService;
} }
async lumaVideo(inputs) { async lumaVideo(inputs) {
var _a, _b, _c; var _a, _b, _c;
@ -32,12 +36,15 @@ let LumaVideoService = class LumaVideoService {
let payloadJson = {}; let payloadJson = {};
const headers = { Authorization: `Bearer ${apiKey}` }; const headers = { Authorization: `Bearer ${apiKey}` };
url = `${proxyUrl}/luma/generations/`; url = `${proxyUrl}/luma/generations/`;
const aspectRatio = '16:9'; const aspectRatio = extraParam.size || '16:9';
payloadJson = { payloadJson = {
user_prompt: prompt, user_prompt: prompt,
aspect_ratio: aspectRatio, aspect_ratio: aspectRatio,
expand_prompt: true, expand_prompt: true,
}; };
if (fileInfo) {
payloadJson['image_url'] = fileInfo;
}
common_1.Logger.log(`正在准备发送请求到 ${url}payload: ${JSON.stringify(payloadJson)}, headers: ${JSON.stringify(headers)}`, 'LumaService'); common_1.Logger.log(`正在准备发送请求到 ${url}payload: ${JSON.stringify(payloadJson)}, headers: ${JSON.stringify(headers)}`, 'LumaService');
try { try {
response = await axios_1.default.post(url, payloadJson, { headers }); response = await axios_1.default.post(url, payloadJson, { headers });
@ -150,6 +157,25 @@ let LumaVideoService = class LumaVideoService {
result.taskId = responses.id; result.taskId = responses.id;
result.taskData = JSON.stringify(responses); result.taskData = JSON.stringify(responses);
result.fileInfo = responses.video.url; result.fileInfo = responses.video.url;
try {
const localStorageStatus = await this.globalConfigService.getConfigs([
'localStorageStatus',
]);
if (Number(localStorageStatus)) {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const currentDate = `${year}${month}/${day}`;
result.fileInfo = await this.uploadService.uploadFileFromUrl({
url: responses.video.download_url,
dir: `video/luma/${currentDate}`,
});
}
}
catch (error) {
common_1.Logger.error(`上传文件失败: ${error.message}`, 'LumaService');
}
result.answer = `提示词: "${responses.prompt}"`; result.answer = `提示词: "${responses.prompt}"`;
onSuccess(result); onSuccess(result);
clearInterval(interval); clearInterval(interval);
@ -180,6 +206,8 @@ let LumaVideoService = class LumaVideoService {
}; };
LumaVideoService = __decorate([ LumaVideoService = __decorate([
(0, common_1.Injectable)(), (0, common_1.Injectable)(),
__metadata("design:paramtypes", [chatLog_service_1.ChatLogService]) __metadata("design:paramtypes", [chatLog_service_1.ChatLogService,
globalConfig_service_1.GlobalConfigService,
upload_service_1.UploadService])
], LumaVideoService); ], LumaVideoService);
exports.LumaVideoService = LumaVideoService; exports.LumaVideoService = LumaVideoService;

View File

@ -22,8 +22,8 @@ let MidjourneyService = class MidjourneyService {
this.chatLogService = chatLogService; this.chatLogService = chatLogService;
} }
async midjourneyDraw(inputs) { async midjourneyDraw(inputs) {
var _a, _b; var _a, _b, _c, _d;
const { id, apiKey, proxyUrl, action, drawId, prompt, usePrompt, customId, timeout, assistantLogId, } = inputs; const { id, apiKey, proxyUrl, action, drawId, prompt, usePrompt, customId, timeout, fileInfo, assistantLogId, } = inputs;
let result = { let result = {
text: '', text: '',
fileInfo: '', fileInfo: '',
@ -34,6 +34,8 @@ let MidjourneyService = class MidjourneyService {
let response; let response;
let retryCount = 0; let retryCount = 0;
let url = ''; let url = '';
const headers = { 'mj-api-secret': apiKey };
common_1.Logger.debug(`当前任务类型: ${action}`, 'MidjourneyService');
while (retryCount < 3) { while (retryCount < 3) {
let payloadJson = {}; let payloadJson = {};
try { try {
@ -41,15 +43,40 @@ let MidjourneyService = class MidjourneyService {
url = `${proxyUrl}/mj/submit/imagine`; url = `${proxyUrl}/mj/submit/imagine`;
payloadJson = { prompt: usePrompt }; payloadJson = { prompt: usePrompt };
} }
else if (action === 'DESCRIBE') {
url = `${proxyUrl}/mj/submit/describe`;
if (fileInfo) {
const response = await fetch(fileInfo);
const blob = await response.blob();
const buffer = Buffer.from(await blob.arrayBuffer());
const base64String = buffer.toString('base64');
payloadJson = { base64: `data:image/png;base64,${base64String}` };
}
else {
return;
}
}
else if (action === 'PICREADER') {
url = `${proxyUrl}/mj/submit/action`;
payloadJson = { taskId: drawId, customId: customId };
response = await axios_1.default.post(url, payloadJson, { headers });
if ((response === null || response === void 0 ? void 0 : response.status) === 200 && ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result)) {
url = `${proxyUrl}/mj/submit/modal`;
payloadJson = { taskId: (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.result };
}
}
else { else {
url = `${proxyUrl}/mj/submit/action`; url = `${proxyUrl}/mj/submit/action`;
payloadJson = { taskId: drawId, customId: customId }; payloadJson = { taskId: drawId, customId: customId };
} }
const headers = { 'mj-api-secret': apiKey };
common_1.Logger.log(`正在准备发送请求到 ${url}payload: ${JSON.stringify(payloadJson)}, headers: ${JSON.stringify(headers)}`, 'MidjourneyService'); common_1.Logger.log(`正在准备发送请求到 ${url}payload: ${JSON.stringify(payloadJson)}, headers: ${JSON.stringify(headers)}`, 'MidjourneyService');
response = await axios_1.default.post(url, payloadJson, { headers }); response = await axios_1.default.post(url, payloadJson, { headers });
if ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) { if ((response === null || response === void 0 ? void 0 : response.status) === 200 && ((_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.result)) {
result.drawId = (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.result; common_1.Logger.debug(`收到响应: ${JSON.stringify(response.data)}`, 'MidjourneyService');
result.drawId = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.result;
result.state = 2;
result.answer = '绘画任务提交成功';
common_1.Logger.log(`绘画任务提交成功, 绘画ID: ${response.data.result}`, 'MidjourneyService');
break; break;
} }
else { else {
@ -59,6 +86,8 @@ let MidjourneyService = class MidjourneyService {
catch (error) { catch (error) {
retryCount++; retryCount++;
if (retryCount >= 3) { if (retryCount >= 3) {
result.answer = '任务提交失败,请检查提示词后重试';
result.status = 5;
common_1.Logger.log(`绘画任务提交失败, 请检查后台配置或者稍后重试! ${error}`, 'MidjourneyService'); common_1.Logger.log(`绘画任务提交失败, 请检查后台配置或者稍后重试! ${error}`, 'MidjourneyService');
} }
} }
@ -66,7 +95,7 @@ let MidjourneyService = class MidjourneyService {
this.pollMjDrawingResult({ this.pollMjDrawingResult({
proxyUrl, proxyUrl,
apiKey, apiKey,
drawId: response.data.result, drawId: result.drawId,
timeout, timeout,
prompt, prompt,
onSuccess: async (data) => { onSuccess: async (data) => {
@ -78,7 +107,7 @@ let MidjourneyService = class MidjourneyService {
drawId: data === null || data === void 0 ? void 0 : data.drawId, drawId: data === null || data === void 0 ? void 0 : data.drawId,
customId: data === null || data === void 0 ? void 0 : data.customId, customId: data === null || data === void 0 ? void 0 : data.customId,
}); });
common_1.Logger.log('绘图成功!'); common_1.Logger.log('绘图成功!', 'MidjourneyService');
}, },
onDrawing: async (data) => { onDrawing: async (data) => {
await this.chatLogService.updateChatLog(assistantLogId, { await this.chatLogService.updateChatLog(assistantLogId, {
@ -86,19 +115,18 @@ let MidjourneyService = class MidjourneyService {
progress: data === null || data === void 0 ? void 0 : data.progress, progress: data === null || data === void 0 ? void 0 : data.progress,
status: 2, status: 2,
}); });
common_1.Logger.log(`绘制中!绘制进度${data === null || data === void 0 ? void 0 : data.progress}`); common_1.Logger.log(`绘制中!绘制进度${data === null || data === void 0 ? void 0 : data.progress}`, 'MidjourneyService');
}, },
onFailure: async (data) => { onFailure: async (data) => {
await this.chatLogService.updateChatLog(assistantLogId, { await this.chatLogService.updateChatLog(assistantLogId, {
answer: '绘图失败', answer: '绘图失败',
status: data.status, status: data.status,
}); });
common_1.Logger.log('绘图失败'); common_1.Logger.log('绘图失败', 'MidjourneyService');
}, },
}).catch((error) => { }).catch((error) => {
common_1.Logger.error('查询绘图结果时发生错误:', error, 'MidjourneyService'); common_1.Logger.error('查询绘图结果时发生错误:', error, 'MidjourneyService');
}); });
common_1.Logger.log(`绘画任务提交成功, 绘画ID: ${response.data.result}`, 'MidjourneyService');
return result; return result;
} }
async pollMjDrawingResult(inputs) { async pollMjDrawingResult(inputs) {
@ -108,7 +136,6 @@ let MidjourneyService = class MidjourneyService {
'mjProxyImgUrl', 'mjProxyImgUrl',
'mjNotUseProxy', 'mjNotUseProxy',
]); ]);
let response;
let result = { let result = {
fileInfo: '', fileInfo: '',
drawId: '', drawId: '',
@ -117,11 +144,9 @@ let MidjourneyService = class MidjourneyService {
progress: 0, progress: 0,
answer: '', answer: '',
}; };
let payloadJson = {};
const startTime = Date.now(); const startTime = Date.now();
const POLL_INTERVAL = 5000; const POLL_INTERVAL = 5000;
let retryCount = 0; let retryCount = 0;
let pollingCount = 0;
try { try {
while (Date.now() - startTime < timeout) { while (Date.now() - startTime < timeout) {
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL)); await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL));
@ -133,6 +158,7 @@ let MidjourneyService = class MidjourneyService {
const url = `${proxyUrl}/mj/task/${drawId}/fetch`; const url = `${proxyUrl}/mj/task/${drawId}/fetch`;
const res = await axios_1.default.get(url, { headers }); const res = await axios_1.default.get(url, { headers });
const responses = res.data; const responses = res.data;
common_1.Logger.debug(`查询结果: ${JSON.stringify(responses)}`, 'MidjourneyService');
if (responses.status === 'SUCCESS') { if (responses.status === 'SUCCESS') {
common_1.Logger.log(`绘制成功, 获取到的URL: ${responses.imageUrl}`, 'MidjourneyService'); common_1.Logger.log(`绘制成功, 获取到的URL: ${responses.imageUrl}`, 'MidjourneyService');
let processedUrl = responses.imageUrl; let processedUrl = responses.imageUrl;
@ -150,7 +176,7 @@ let MidjourneyService = class MidjourneyService {
} }
if (mjNotSaveImg !== '1') { if (mjNotSaveImg !== '1') {
try { try {
common_1.Logger.log(`------> 开始上传图片!!!`); common_1.Logger.log(`------> 开始上传图片!!!`, 'MidjourneyService');
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); const month = String(now.getMonth() + 1).padStart(2, '0');

View File

@ -25,10 +25,34 @@ let OpenAIDrawService = OpenAIDrawService_1 = class OpenAIDrawService {
this.openAIChatService = openAIChatService; this.openAIChatService = openAIChatService;
this.logger = new common_1.Logger(OpenAIDrawService_1.name); this.logger = new common_1.Logger(OpenAIDrawService_1.name);
} }
async dalleDraw(inputs, messagesHistory) { async dalleDraw(inputs, buildMessageFromParentMessageId) {
var _a, _b, _c, _d; var _a, _b, _c, _d;
common_1.Logger.log('开始提交 Dalle 绘图任务 ', 'DrawService'); common_1.Logger.log('开始提交 Dalle 绘图任务 ', 'DrawService');
const { apiKey, model, proxyUrl, prompt, extraParam, timeout, onSuccess, onFailure, } = inputs; const { apiKey, model, proxyUrl, prompt, extraParam, timeout, onSuccess, onFailure, groupId, } = inputs;
const isDalleChat = await this.globalConfigService.getConfigs([
'isDalleChat',
]);
let drawPrompt;
if (isDalleChat === '1') {
try {
common_1.Logger.log('已开启连续绘画模式', 'DalleDraw');
const { messagesHistory } = await buildMessageFromParentMessageId(`参考上文,结合我的需求,给出绘画描述。我的需求是:${prompt}`, {
groupId,
systemMessage: '你是一个绘画提示词生成工具,请根据用户的要求,结合上下文,用一段文字,描述用户需要的绘画需求,不用包含任何礼貌性的寒暄,只需要场景的描述,可以适当联想',
maxModelTokens: 8000,
maxRounds: 5,
fileInfo: '',
}, this.chatLogService);
drawPrompt = await this.openAIChatService.chatFree(prompt, undefined, messagesHistory);
}
catch (error) {
console.error('调用chatFree失败', error);
drawPrompt = prompt;
}
}
else {
drawPrompt = prompt;
}
const size = (extraParam === null || extraParam === void 0 ? void 0 : extraParam.size) || '1024x1024'; const size = (extraParam === null || extraParam === void 0 ? void 0 : extraParam.size) || '1024x1024';
let result = { answer: '', fileInfo: '', status: 2 }; let result = { answer: '', fileInfo: '', status: 2 };
try { try {
@ -42,7 +66,7 @@ let OpenAIDrawService = OpenAIDrawService_1 = class OpenAIDrawService {
}, },
data: { data: {
model: model, model: model,
prompt: prompt, prompt: drawPrompt,
size, size,
}, },
}; };

View File

@ -24,7 +24,7 @@ let StableDiffusionService = StableDiffusionService_1 = class StableDiffusionSer
this.logger = new common_1.Logger(StableDiffusionService_1.name); this.logger = new common_1.Logger(StableDiffusionService_1.name);
} }
async sdxl(messagesHistory, inputs) { async sdxl(messagesHistory, inputs) {
const { onGenerate, onSuccess, onFailure, apiKey, model, proxyUrl, modelName, timeout, chatId, isFileUpload, prompt, } = inputs; const { onSuccess, onFailure, apiKey, model, proxyUrl, modelName, timeout, chatId, prompt, } = inputs;
let result = { let result = {
answer: '', answer: '',
model: model, model: model,
@ -58,12 +58,28 @@ let StableDiffusionService = StableDiffusionService_1 = class StableDiffusionSer
const match = content.match(regex); const match = content.match(regex);
if (match && match[1]) { if (match && match[1]) {
result.fileInfo = match[1]; result.fileInfo = match[1];
try {
const localStorageStatus = await this.globalConfigService.getConfigs(['localStorageStatus']);
if (Number(localStorageStatus)) {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const currentDate = `${year}${month}/${day}`;
result.fileInfo = await this.uploadService.uploadFileFromUrl({
url: result.fileInfo,
dir: `images/stable-diffusion/${currentDate}`,
});
}
}
catch (error) {
common_1.Logger.error(`上传文件失败: ${error.message}`, 'StableDiffusionService');
}
console.log('找到链接', match[1]); console.log('找到链接', match[1]);
} }
else { else {
console.log('没有找到链接'); console.log('没有找到链接');
} }
let revised_prompt_cn;
result.answer = `${prompt} 绘制成功`; result.answer = `${prompt} 绘制成功`;
if (result.fileInfo) { if (result.fileInfo) {
onSuccess(result); onSuccess(result);

View File

@ -13,9 +13,13 @@ exports.SunoService = void 0;
const common_1 = require("@nestjs/common"); const common_1 = require("@nestjs/common");
const axios_1 = require("axios"); const axios_1 = require("axios");
const chatLog_service_1 = require("../chatLog/chatLog.service"); const chatLog_service_1 = require("../chatLog/chatLog.service");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const upload_service_1 = require("../upload/upload.service");
let SunoService = class SunoService { let SunoService = class SunoService {
constructor(chatLogService) { constructor(chatLogService, uploadService, globalConfigService) {
this.chatLogService = chatLogService; this.chatLogService = chatLogService;
this.uploadService = uploadService;
this.globalConfigService = globalConfigService;
} }
async suno(inputs) { async suno(inputs) {
var _a, _b, _c; var _a, _b, _c;
@ -46,7 +50,7 @@ let SunoService = class SunoService {
throw new Error('taskData格式错误'); throw new Error('taskData格式错误');
} }
} }
common_1.Logger.log(`正在准备发送请求到 ${url}payload: ${JSON.stringify(payloadJson)}, headers: ${JSON.stringify(headers)}`); common_1.Logger.log(`正在准备发送请求到 ${url}payload: ${JSON.stringify(payloadJson)}, headers: ${JSON.stringify(headers)}`, 'SunoService');
try { try {
response = await axios_1.default.post(url, payloadJson, { headers }); response = await axios_1.default.post(url, payloadJson, { headers });
} }
@ -164,6 +168,7 @@ let SunoService = class SunoService {
try { try {
const res = await axios_1.default.get(url, { headers }); const res = await axios_1.default.get(url, { headers });
const responses = res.data.data; const responses = res.data.data;
common_1.Logger.debug(`轮询结果: ${JSON.stringify(responses)}`, 'SunoService');
if (action === 'LYRICS') { if (action === 'LYRICS') {
if (responses.status === 'SUCCESS') { if (responses.status === 'SUCCESS') {
result.taskId = responses.data.id; result.taskId = responses.data.id;
@ -179,7 +184,6 @@ let SunoService = class SunoService {
} }
} }
if (action === 'MUSIC') { if (action === 'MUSIC') {
const data = responses.data;
if (responses.data) { if (responses.data) {
const data = responses.data; const data = responses.data;
result.taskData = JSON.stringify(data); result.taskData = JSON.stringify(data);
@ -195,30 +199,100 @@ let SunoService = class SunoService {
.filter((url) => url); .filter((url) => url);
const titles = data.map((item) => item.title); const titles = data.map((item) => item.title);
const firstTitle = titles.length > 0 ? titles[0] : '音乐已生成'; const firstTitle = titles.length > 0 ? titles[0] : '音乐已生成';
const audioUrls = validAudioUrls.join(','); if (responses.status === 'SUCCESS') {
const videoUrls = validVideoUrls.join(','); let audioUrls = [];
const imageUrls = validImageUrls.join(','); let videoUrls = [];
result.audioUrl = audioUrls; let imageUrls = [];
result.videoUrl = videoUrls; try {
result.fileInfo = imageUrls; const localStorageStatus = await this.globalConfigService.getConfigs([
if (validAudioUrls.length === 2) { 'localStorageStatus',
result.status = 3; ]);
result.answer = firstTitle; if (Number(localStorageStatus)) {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const currentDate = `${year}${month}/${day}`;
for (const url of validAudioUrls) {
try {
const uploadedUrl = await this.uploadService.uploadFileFromUrl({
url: url,
dir: `audio/suno-music/${currentDate}`,
});
audioUrls.push(uploadedUrl);
}
catch (error) {
common_1.Logger.error(`上传音频文件失败: ${error.message}`, 'SunoService');
audioUrls.push(url);
}
}
for (const url of validVideoUrls) {
try {
const uploadedUrl = await this.uploadService.uploadFileFromUrl({
url: url,
dir: `video/suno-music/${currentDate}`,
});
videoUrls.push(uploadedUrl);
}
catch (error) {
common_1.Logger.error(`上传视频文件失败: ${error.message}`, 'SunoService');
videoUrls.push(url);
}
}
for (const url of validImageUrls) {
try {
const uploadedUrl = await this.uploadService.uploadFileFromUrl({
url: url,
dir: `images/suno-music/${currentDate}`,
});
imageUrls.push(uploadedUrl);
}
catch (error) {
common_1.Logger.error(`上传图片文件失败: ${error.message}`, 'SunoService');
imageUrls.push(url);
}
}
}
else {
audioUrls = validAudioUrls;
videoUrls = validVideoUrls;
imageUrls = validImageUrls;
}
}
catch (error) {
common_1.Logger.error(`获取配置失败: ${error.message}`, 'LumaService');
audioUrls = validAudioUrls;
videoUrls = validVideoUrls;
imageUrls = validImageUrls;
}
result.audioUrl = audioUrls.join(',');
result.videoUrl = videoUrls.join(',');
result.fileInfo = imageUrls.join(',');
if (validAudioUrls.length === 2) {
result.status = 3;
result.answer = firstTitle;
}
else {
result.status = 2;
result.progress = responses === null || responses === void 0 ? void 0 : responses.progress;
result.answer = `当前生成进度 ${responses === null || responses === void 0 ? void 0 : responses.progress}`;
}
common_1.Logger.debug(`音乐生成成功: ${JSON.stringify(data)}`, 'SunoService');
onSuccess(result);
return;
} }
else { else {
result.audioUrl = validAudioUrls.join(',');
result.videoUrl = validVideoUrls.join(',');
result.fileInfo = validImageUrls.join(',');
result.status = 2; result.status = 2;
result.progress = responses === null || responses === void 0 ? void 0 : responses.progress; result.progress = responses === null || responses === void 0 ? void 0 : responses.progress;
result.answer = `当前生成进度 ${responses === null || responses === void 0 ? void 0 : responses.progress}`; result.answer = firstTitle;
onAudioSuccess(result);
} }
onAudioSuccess(result);
} }
} }
if (responses.status === 'SUCCESS') { if (!result.audioUrl && result.progress && result.status === 2) {
common_1.Logger.debug(`音乐生成成功: ${JSON.stringify(data)}`, 'SunoService');
onSuccess(result);
return;
}
if (result.progress && result.status === 2) {
onGenerating(result); onGenerating(result);
} }
} }
@ -242,6 +316,8 @@ let SunoService = class SunoService {
}; };
SunoService = __decorate([ SunoService = __decorate([
(0, common_1.Injectable)(), (0, common_1.Injectable)(),
__metadata("design:paramtypes", [chatLog_service_1.ChatLogService]) __metadata("design:paramtypes", [chatLog_service_1.ChatLogService,
upload_service_1.UploadService,
globalConfig_service_1.GlobalConfigService])
], SunoService); ], SunoService);
exports.SunoService = SunoService; exports.SunoService = SunoService;

View File

@ -300,7 +300,6 @@ let AppService = class AppService {
} }
async updateSystemApp(body) { async updateSystemApp(body) {
const { id, name } = body; const { id, name } = body;
common_1.Logger.log(`尝试更新应用: ${name} (ID: ${id})`);
const existingApp = await this.appEntity.findOne({ const existingApp = await this.appEntity.findOne({
where: { name, id: (0, typeorm_2.Not)(id) }, where: { name, id: (0, typeorm_2.Not)(id) },
}); });
@ -310,7 +309,6 @@ let AppService = class AppService {
} }
const res = await this.appEntity.update({ id }, body); const res = await this.appEntity.update({ id }, body);
if (res.affected > 0) { if (res.affected > 0) {
common_1.Logger.log(`修改系统应用信息成功: ${name}`);
return '修改系统应用信息成功'; return '修改系统应用信息成功';
} }
common_1.Logger.error(`修改系统应用信息失败:${name}`); common_1.Logger.error(`修改系统应用信息失败:${name}`);

View File

@ -43,9 +43,6 @@ let AuthController = class AuthController {
async getInfo(req) { async getInfo(req) {
return this.authService.getInfo(req); return this.authService.getInfo(req);
} }
async captcha(parmas) {
return this.authService.captcha(parmas);
}
async sendCode(parmas) { async sendCode(parmas) {
return this.authService.sendCode(parmas); return this.authService.sendCode(parmas);
} }
@ -109,14 +106,6 @@ __decorate([
__metadata("design:paramtypes", [Object]), __metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
], AuthController.prototype, "getInfo", null); ], AuthController.prototype, "getInfo", null);
__decorate([
(0, common_1.Post)('captcha'),
(0, swagger_1.ApiOperation)({ summary: '获取一个图形验证码' }),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "captcha", null);
__decorate([ __decorate([
(0, common_1.Post)('sendCode'), (0, common_1.Post)('sendCode'),
(0, swagger_1.ApiOperation)({ summary: '发送验证码' }), (0, swagger_1.ApiOperation)({ summary: '发送验证码' }),

View File

@ -21,7 +21,6 @@ const jwt_1 = require("@nestjs/jwt");
const typeorm_1 = require("@nestjs/typeorm"); const typeorm_1 = require("@nestjs/typeorm");
const bcrypt = require("bcryptjs"); const bcrypt = require("bcryptjs");
const os = require("os"); const os = require("os");
const svgCaptcha = require("svg-captcha");
const typeorm_2 = require("typeorm"); const typeorm_2 = require("typeorm");
const config_entity_1 = require("../globalConfig/config.entity"); const config_entity_1 = require("../globalConfig/config.entity");
const mailer_service_1 = require("../mailer/mailer.service"); const mailer_service_1 = require("../mailer/mailer.service");
@ -44,7 +43,6 @@ let AuthService = class AuthService {
this.getIp(); this.getIp();
} }
async register(body, req) { async register(body, req) {
await this.verificationService.verifyCaptcha(body);
const { password, contact, code, invitedBy } = body; const { password, contact, code, invitedBy } = body;
let email = '', phone = ''; let email = '', phone = '';
const isEmail = /\S+@\S+\.\S+/.test(contact); const isEmail = /\S+@\S+\.\S+/.test(contact);
@ -99,11 +97,11 @@ let AuthService = class AuthService {
throw new common_1.HttpException('请输入验证码', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('请输入验证码', common_1.HttpStatus.BAD_REQUEST);
} }
if (!redisCode) { if (!redisCode) {
common_1.Logger.log(`验证码过期: ${contact}`); common_1.Logger.log(`验证码过期: ${contact}`, 'authService');
throw new common_1.HttpException('验证码已过期,请重新发送!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('验证码已过期,请重新发送!', common_1.HttpStatus.BAD_REQUEST);
} }
if (code !== redisCode) { if (code !== redisCode) {
common_1.Logger.log(`验证码错误: ${contact} 输入的验证码: ${code}, 期望的验证码: ${redisCode}`); common_1.Logger.log(`验证码错误: ${contact} 输入的验证码: ${code}, 期望的验证码: ${redisCode}`, 'authService');
throw new common_1.HttpException('验证码填写错误,请重新输入!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('验证码填写错误,请重新输入!', common_1.HttpStatus.BAD_REQUEST);
} }
} }
@ -197,11 +195,11 @@ let AuthService = class AuthService {
const key = `${nameSpace}:CODE:${contact}`; const key = `${nameSpace}:CODE:${contact}`;
const redisCode = await this.redisCacheService.get({ key }); const redisCode = await this.redisCacheService.get({ key });
if (!redisCode) { if (!redisCode) {
common_1.Logger.log(`验证码过期: ${contact}`); common_1.Logger.log(`验证码过期: ${contact}`, 'authService');
throw new common_1.HttpException('验证码已过期,请重新发送!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('验证码已过期,请重新发送!', common_1.HttpStatus.BAD_REQUEST);
} }
if (code !== redisCode) { if (code !== redisCode) {
common_1.Logger.log(`验证码错误: ${contact} 输入的验证码: ${code}, 期望的验证码: ${redisCode}`); common_1.Logger.log(`验证码错误: ${contact} 输入的验证码: ${code}, 期望的验证码: ${redisCode}`, 'authService');
throw new common_1.HttpException('验证码填写错误,请重新输入!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('验证码填写错误,请重新输入!', common_1.HttpStatus.BAD_REQUEST);
} }
let u; let u;
@ -292,28 +290,6 @@ let AuthService = class AuthService {
}); });
this.ipAddress = ipAddress; this.ipAddress = ipAddress;
} }
async captcha(parmas) {
const nameSpace = await this.globalConfigService.getNamespace();
const { color = '#fff' } = parmas;
const captcha = svgCaptcha.create({
size: 4,
ignoreChars: '0o1i',
noise: 4,
color: true,
background: color,
height: 35,
width: 120,
charPreset: 'abcdefghijklmnopqrstuvwxyz',
});
const text = captcha.text;
const randomId = Math.random().toString(36).substr(2, 9);
const key = `${nameSpace}:CAPTCHA:${randomId}`;
await this.redisCacheService.set({ key, val: text }, 5 * 60);
return {
svgCode: captcha.data,
code: randomId,
};
}
async sendCode(body) { async sendCode(body) {
const { contact, isLogin } = body; const { contact, isLogin } = body;
let email = '', phone = ''; let email = '', phone = '';
@ -324,7 +300,6 @@ let AuthService = class AuthService {
throw new common_1.HttpException('请提供有效的邮箱地址或手机号码。', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('请提供有效的邮箱地址或手机号码。', common_1.HttpStatus.BAD_REQUEST);
} }
if (!isLogin) { if (!isLogin) {
await this.verificationService.verifyCaptcha(body);
if (isEmail) { if (isEmail) {
email = contact; email = contact;
const isAvailable = await this.userService.verifyUserRegister({ const isAvailable = await this.userService.verifyUserRegister({

View File

@ -29,16 +29,6 @@ __decorate([
(0, swagger_1.ApiProperty)({ example: 'ai@aiweb.com', description: '用户邮箱' }), (0, swagger_1.ApiProperty)({ example: 'ai@aiweb.com', description: '用户邮箱' }),
__metadata("design:type", String) __metadata("design:type", String)
], UserRegisterDto.prototype, "email", void 0); ], UserRegisterDto.prototype, "email", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: '5k3n', description: '图形验证码' }),
(0, class_validator_1.IsNotEmpty)({ message: '验证码为空!' }),
__metadata("design:type", String)
], UserRegisterDto.prototype, "captchaCode", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: '2313ko423ko', description: '图形验证码KEY' }),
(0, class_validator_1.IsNotEmpty)({ message: '验证ID不能为空' }),
__metadata("design:type", String)
], UserRegisterDto.prototype, "captchaId", void 0);
__decorate([ __decorate([
(0, swagger_1.ApiProperty)({ (0, swagger_1.ApiProperty)({
example: 'FRJDLJHFNV', example: 'FRJDLJHFNV',

View File

@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.UserRegisterByPhoneDto = void 0; exports.UserRegisterByPhoneDto = void 0;
const class_validator_1 = require("class-validator");
const swagger_1 = require("@nestjs/swagger"); const swagger_1 = require("@nestjs/swagger");
const class_validator_1 = require("class-validator");
class UserRegisterByPhoneDto { class UserRegisterByPhoneDto {
} }
__decorate([ __decorate([

View File

@ -13,15 +13,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.AutoreplyController = void 0; exports.AutoreplyController = void 0;
const autoreply_service_1 = require("./autoreply.service");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const queryAutoReply_dto_1 = require("./dto/queryAutoReply.dto");
const addAutoReply_dto_1 = require("./dto/addAutoReply.dto");
const updateAutoReply_dto_1 = require("./dto/updateAutoReply.dto");
const delBadWords_dto_1 = require("./dto/delBadWords.dto");
const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard"); const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
const superAuth_guard_1 = require("../../common/auth/superAuth.guard"); const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const autoreply_service_1 = require("./autoreply.service");
const addAutoReply_dto_1 = require("./dto/addAutoReply.dto");
const delBadWords_dto_1 = require("./dto/delBadWords.dto");
const queryAutoReply_dto_1 = require("./dto/queryAutoReply.dto");
const updateAutoReply_dto_1 = require("./dto/updateAutoReply.dto");
let AutoreplyController = class AutoreplyController { let AutoreplyController = class AutoreplyController {
constructor(autoreplyService) { constructor(autoreplyService) {
this.autoreplyService = autoreplyService; this.autoreplyService = autoreplyService;
@ -66,7 +66,7 @@ __decorate([
(0, swagger_1.ApiBearerAuth)(), (0, swagger_1.ApiBearerAuth)(),
__param(0, (0, common_1.Body)()), __param(0, (0, common_1.Body)()),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [updateAutoReply_dto_1.UpdateAutpReplyDto]), __metadata("design:paramtypes", [updateAutoReply_dto_1.UpdateAutoReplyDto]),
__metadata("design:returntype", void 0) __metadata("design:returntype", void 0)
], AutoreplyController.prototype, "updateAutoreply", null); ], AutoreplyController.prototype, "updateAutoreply", null);
__decorate([ __decorate([

View File

@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.AutoReplyEntity = void 0; exports.AutoReplyEntity = void 0;
const typeorm_1 = require("typeorm");
const baseEntity_1 = require("../../common/entity/baseEntity"); const baseEntity_1 = require("../../common/entity/baseEntity");
const typeorm_1 = require("typeorm");
let AutoReplyEntity = class AutoReplyEntity extends baseEntity_1.BaseEntity { let AutoReplyEntity = class AutoReplyEntity extends baseEntity_1.BaseEntity {
}; };
__decorate([ __decorate([
@ -22,6 +22,10 @@ __decorate([
(0, typeorm_1.Column)({ comment: '定义的答案', type: 'text' }), (0, typeorm_1.Column)({ comment: '定义的答案', type: 'text' }),
__metadata("design:type", String) __metadata("design:type", String)
], AutoReplyEntity.prototype, "answer", void 0); ], AutoReplyEntity.prototype, "answer", void 0);
__decorate([
(0, typeorm_1.Column)({ default: 1, comment: '是否开启AI回复0关闭 1启用' }),
__metadata("design:type", Number)
], AutoReplyEntity.prototype, "isAIReplyEnabled", void 0);
__decorate([ __decorate([
(0, typeorm_1.Column)({ default: 1, comment: '启用当前自动回复状态, 0关闭 1启用' }), (0, typeorm_1.Column)({ default: 1, comment: '启用当前自动回复状态, 0关闭 1启用' }),
__metadata("design:type", Number) __metadata("design:type", Number)

View File

@ -8,16 +8,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.AutoreplyModule = void 0; exports.AutoreplyModule = void 0;
const common_1 = require("@nestjs/common"); const common_1 = require("@nestjs/common");
const autoreply_controller_1 = require("./autoreply.controller");
const autoreply_service_1 = require("./autoreply.service");
const typeorm_1 = require("@nestjs/typeorm"); const typeorm_1 = require("@nestjs/typeorm");
const autoreplay_entity_1 = require("./autoreplay.entity"); const autoreply_controller_1 = require("./autoreply.controller");
const autoreply_entity_1 = require("./autoreply.entity");
const autoreply_service_1 = require("./autoreply.service");
let AutoreplyModule = class AutoreplyModule { let AutoreplyModule = class AutoreplyModule {
}; };
AutoreplyModule = __decorate([ AutoreplyModule = __decorate([
(0, common_1.Global)(), (0, common_1.Global)(),
(0, common_1.Module)({ (0, common_1.Module)({
imports: [typeorm_1.TypeOrmModule.forFeature([autoreplay_entity_1.AutoReplyEntity])], imports: [typeorm_1.TypeOrmModule.forFeature([autoreply_entity_1.AutoReplyEntity])],
controllers: [autoreply_controller_1.AutoreplyController], controllers: [autoreply_controller_1.AutoreplyController],
providers: [autoreply_service_1.AutoreplyService], providers: [autoreply_service_1.AutoreplyService],
exports: [autoreply_service_1.AutoreplyService], exports: [autoreply_service_1.AutoreplyService],

View File

@ -16,7 +16,7 @@ exports.AutoreplyService = void 0;
const common_1 = require("@nestjs/common"); const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm"); const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm"); const typeorm_2 = require("typeorm");
const autoreplay_entity_1 = require("./autoreplay.entity"); const autoreply_entity_1 = require("./autoreply.entity");
let AutoreplyService = class AutoreplyService { let AutoreplyService = class AutoreplyService {
constructor(autoReplyEntity) { constructor(autoReplyEntity) {
this.autoReplyEntity = autoReplyEntity; this.autoReplyEntity = autoReplyEntity;
@ -25,20 +25,57 @@ let AutoreplyService = class AutoreplyService {
this.autoReplyFuzzyMatch = true; this.autoReplyFuzzyMatch = true;
} }
async onModuleInit() { async onModuleInit() {
this.loadAutoReplyList(); await this.loadAutoReplyList();
} }
async loadAutoReplyList() { async loadAutoReplyList() {
const res = await this.autoReplyEntity.find({ where: { status: 1 }, select: ['prompt', 'answer'] }); const res = await this.autoReplyEntity.find({
where: { status: 1 },
select: ['prompt', 'answer', 'isAIReplyEnabled'],
});
this.autoReplyMap = {}; this.autoReplyMap = {};
res.forEach((t) => (this.autoReplyMap[t.prompt] = t.answer)); this.autoReplyKes = [];
this.autoReplyKes = Object.keys(this.autoReplyMap); res.forEach((t) => {
this.autoReplyMap[t.prompt] = {
answer: t.answer,
isAIReplyEnabled: t.isAIReplyEnabled,
};
const keywords = t.prompt.split(' ').map((k) => k.trim());
this.autoReplyKes.push({ prompt: t.prompt, keywords });
});
} }
async checkAutoReply(prompt) { async checkAutoReply(prompt) {
let question = prompt; let answers = [];
let isAIReplyEnabled = 0;
const seenGroups = new Set();
if (this.autoReplyFuzzyMatch) { if (this.autoReplyFuzzyMatch) {
question = this.autoReplyKes.find((item) => item.includes(prompt)); for (const item of this.autoReplyKes) {
if (item.keywords.some((keyword) => prompt.includes(keyword))) {
if (!seenGroups.has(item.prompt)) {
answers.push(this.autoReplyMap[item.prompt].answer);
seenGroups.add(item.prompt);
if (this.autoReplyMap[item.prompt].isAIReplyEnabled === 1) {
isAIReplyEnabled = 1;
}
}
}
}
} }
return question ? this.autoReplyMap[question] : ''; else {
const matches = this.autoReplyKes.filter((item) => item.prompt === prompt);
for (const match of matches) {
if (!seenGroups.has(match.prompt)) {
answers.push(this.autoReplyMap[match.prompt].answer);
seenGroups.add(match.prompt);
if (this.autoReplyMap[match.prompt].isAIReplyEnabled === 1) {
isAIReplyEnabled = 1;
}
}
}
}
return {
answer: answers.join('\n'),
isAIReplyEnabled,
};
} }
async queryAutoreply(query) { async queryAutoreply(query) {
const { page = 1, size = 10, prompt, status } = query; const { page = 1, size = 10, prompt, status } = query;
@ -54,11 +91,6 @@ let AutoreplyService = class AutoreplyService {
return { rows, count }; return { rows, count };
} }
async addAutoreply(body) { async addAutoreply(body) {
const { prompt } = body;
const a = await this.autoReplyEntity.findOne({ where: { prompt } });
if (a) {
throw new common_1.HttpException('该问题已存在,请检查您的提交信息', common_1.HttpStatus.BAD_REQUEST);
}
await this.autoReplyEntity.save(body); await this.autoReplyEntity.save(body);
await this.loadAutoReplyList(); await this.loadAutoReplyList();
return '添加问题成功!'; return '添加问题成功!';
@ -88,7 +120,7 @@ let AutoreplyService = class AutoreplyService {
}; };
AutoreplyService = __decorate([ AutoreplyService = __decorate([
(0, common_1.Injectable)(), (0, common_1.Injectable)(),
__param(0, (0, typeorm_1.InjectRepository)(autoreplay_entity_1.AutoReplyEntity)), __param(0, (0, typeorm_1.InjectRepository)(autoreply_entity_1.AutoReplyEntity)),
__metadata("design:paramtypes", [typeorm_2.Repository]) __metadata("design:paramtypes", [typeorm_2.Repository])
], AutoreplyService); ], AutoreplyService);
exports.AutoreplyService = AutoreplyService; exports.AutoreplyService = AutoreplyService;

View File

@ -9,29 +9,33 @@ var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateAutpReplyDto = void 0; exports.UpdateAutoReplyDto = void 0;
const class_validator_1 = require("class-validator");
const swagger_1 = require("@nestjs/swagger"); const swagger_1 = require("@nestjs/swagger");
class UpdateAutpReplyDto { const class_validator_1 = require("class-validator");
class UpdateAutoReplyDto {
} }
__decorate([ __decorate([
(0, swagger_1.ApiProperty)({ example: 1, description: '自动回复id', required: true }), (0, swagger_1.ApiProperty)({ example: 1, description: '自动回复id', required: true }),
(0, class_validator_1.IsOptional)(), (0, class_validator_1.IsOptional)(),
__metadata("design:type", Number) __metadata("design:type", Number)
], UpdateAutpReplyDto.prototype, "id", void 0); ], UpdateAutoReplyDto.prototype, "id", void 0);
__decorate([ __decorate([
(0, swagger_1.ApiProperty)({ example: '你可以干嘛', description: '问题', required: false }), (0, swagger_1.ApiProperty)({ example: '你可以干嘛', description: '问题', required: false }),
(0, class_validator_1.IsOptional)(), (0, class_validator_1.IsOptional)(),
__metadata("design:type", String) __metadata("design:type", String)
], UpdateAutpReplyDto.prototype, "prompt", void 0); ], UpdateAutoReplyDto.prototype, "prompt", void 0);
__decorate([ __decorate([
(0, swagger_1.ApiProperty)({ example: '我可以干很多事情.......', description: '答案', required: false }), (0, swagger_1.ApiProperty)({
example: '我可以干很多事情.......',
description: '答案',
required: false,
}),
(0, class_validator_1.IsOptional)(), (0, class_validator_1.IsOptional)(),
__metadata("design:type", String) __metadata("design:type", String)
], UpdateAutpReplyDto.prototype, "answer", void 0); ], UpdateAutoReplyDto.prototype, "answer", void 0);
__decorate([ __decorate([
(0, swagger_1.ApiProperty)({ example: 0, description: '状态', required: false }), (0, swagger_1.ApiProperty)({ example: 0, description: '状态', required: false }),
(0, class_validator_1.IsOptional)(), (0, class_validator_1.IsOptional)(),
__metadata("design:type", Number) __metadata("design:type", Number)
], UpdateAutpReplyDto.prototype, "status", void 0); ], UpdateAutoReplyDto.prototype, "status", void 0);
exports.UpdateAutpReplyDto = UpdateAutpReplyDto; exports.UpdateAutoReplyDto = UpdateAutoReplyDto;

View File

@ -13,13 +13,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatService = void 0; exports.ChatService = void 0;
const errorMessage_constant_1 = require("../../common/constants/errorMessage.constant");
const utils_1 = require("../../common/utils"); const utils_1 = require("../../common/utils");
const common_1 = require("@nestjs/common"); const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm"); const typeorm_1 = require("@nestjs/typeorm");
const axios_1 = require("axios"); const axios_1 = require("axios");
const typeorm_2 = require("typeorm"); const typeorm_2 = require("typeorm");
const uuid = require("uuid");
const lumaVideo_service_1 = require("../ai/lumaVideo.service"); const lumaVideo_service_1 = require("../ai/lumaVideo.service");
const midjourneyDraw_service_1 = require("../ai/midjourneyDraw.service"); const midjourneyDraw_service_1 = require("../ai/midjourneyDraw.service");
const openaiChat_service_1 = require("../ai/openaiChat.service"); const openaiChat_service_1 = require("../ai/openaiChat.service");
@ -60,7 +58,6 @@ let ChatService = class ChatService {
this.lumaVideoService = lumaVideoService; this.lumaVideoService = lumaVideoService;
} }
async chatProcess(body, req, res) { async chatProcess(body, req, res) {
var _a, _b, _c;
const { options = {}, usingPluginId, appId = null, specialModel, prompt, fileInfo, modelType, extraParam, model, drawId, customId, action, modelName, modelAvatar, } = body; const { options = {}, usingPluginId, appId = null, specialModel, prompt, fileInfo, modelType, extraParam, model, drawId, customId, action, modelName, modelAvatar, } = body;
let appInfo; let appInfo;
if (specialModel) { if (specialModel) {
@ -77,15 +74,15 @@ let ChatService = class ChatService {
} }
} }
const { groupId, fileParsing } = options; const { groupId, fileParsing } = options;
const { openaiTimeout, openaiBaseUrl, openaiBaseKey, systemPreMessage, isMjTranslate, mjTranslatePrompt, isDalleChat, openaiTemperature, } = await this.globalConfigService.getConfigs([ const { openaiTimeout, openaiBaseUrl, openaiBaseKey, systemPreMessage, isMjTranslate, mjTranslatePrompt, openaiTemperature, openaiBaseModel, } = await this.globalConfigService.getConfigs([
'openaiTimeout', 'openaiTimeout',
'openaiBaseUrl', 'openaiBaseUrl',
'openaiBaseKey', 'openaiBaseKey',
'systemPreMessage', 'systemPreMessage',
'isMjTranslate', 'isMjTranslate',
'mjTranslatePrompt', 'mjTranslatePrompt',
'isDalleChat',
'openaiTemperature', 'openaiTemperature',
'openaiBaseModel',
]); ]);
await this.userService.checkUserStatus(req.user); await this.userService.checkUserStatus(req.user);
res && res &&
@ -97,9 +94,7 @@ let ChatService = class ChatService {
res && res.status(200); res && res.status(200);
let response = null; let response = null;
const curIp = (0, utils_1.getClientIp)(req); const curIp = (0, utils_1.getClientIp)(req);
let isStop = true;
let usePrompt; let usePrompt;
let isSuccess = false;
let useModelAvatar = ''; let useModelAvatar = '';
let usingPlugin; let usingPlugin;
if (usingPluginId) { if (usingPluginId) {
@ -114,14 +109,12 @@ let ChatService = class ChatService {
if (isGPTs) { if (isGPTs) {
currentRequestModelKey = currentRequestModelKey =
await this.modelsService.getCurrentModelKeyInfo('gpts'); await this.modelsService.getCurrentModelKeyInfo('gpts');
await this.chatLogService.checkModelLimits(req.user, 'gpts');
currentRequestModelKey.model = `gpt-4-gizmo-${gizmoID}`; currentRequestModelKey.model = `gpt-4-gizmo-${gizmoID}`;
} }
else if (!isGPTs && isFixedModel && appModel) { else if (!isGPTs && isFixedModel && appModel) {
appInfo.preset && (setSystemMessage = appInfo.preset); appInfo.preset && (setSystemMessage = appInfo.preset);
currentRequestModelKey = currentRequestModelKey =
await this.modelsService.getCurrentModelKeyInfo(appModel); await this.modelsService.getCurrentModelKeyInfo(appModel);
await this.chatLogService.checkModelLimits(req.user, appModel);
currentRequestModelKey.model = appModel; currentRequestModelKey.model = appModel;
if (fileParsing) { if (fileParsing) {
setSystemMessage = `${setSystemMessage}以下是我提供给你的知识库:【${fileParsing}】,在回答问题之前,先检索知识库内有没有相关的内容,尽量使用知识库中获取到的信息来回答我的问题,以知识库中的为准。`; setSystemMessage = `${setSystemMessage}以下是我提供给你的知识库:【${fileParsing}】,在回答问题之前,先检索知识库内有没有相关的内容,尽量使用知识库中获取到的信息来回答我的问题,以知识库中的为准。`;
@ -132,7 +125,6 @@ let ChatService = class ChatService {
appInfo.preset && (setSystemMessage = appInfo.preset); appInfo.preset && (setSystemMessage = appInfo.preset);
currentRequestModelKey = currentRequestModelKey =
await this.modelsService.getCurrentModelKeyInfo(model); await this.modelsService.getCurrentModelKeyInfo(model);
await this.chatLogService.checkModelLimits(req.user, model);
if (fileParsing) { if (fileParsing) {
setSystemMessage = `${setSystemMessage}以下是我提供给你的知识库:【${fileParsing}】,在回答问题之前,先检索知识库内有没有相关的内容,尽量使用知识库中获取到的信息来回答我的问题,以知识库中的为准。`; setSystemMessage = `${setSystemMessage}以下是我提供给你的知识库:【${fileParsing}】,在回答问题之前,先检索知识库内有没有相关的内容,尽量使用知识库中获取到的信息来回答我的问题,以知识库中的为准。`;
} }
@ -153,14 +145,12 @@ let ChatService = class ChatService {
setSystemMessage = pluginPrompt; setSystemMessage = pluginPrompt;
currentRequestModelKey = currentRequestModelKey =
await this.modelsService.getCurrentModelKeyInfo(model); await this.modelsService.getCurrentModelKeyInfo(model);
await this.chatLogService.checkModelLimits(req.user, model);
common_1.Logger.log(`使用插件预设: ${setSystemMessage}`, 'ChatService'); common_1.Logger.log(`使用插件预设: ${setSystemMessage}`, 'ChatService');
} }
else if (fileParsing) { else if (fileParsing) {
setSystemMessage = `以下是我提供给你的知识库:【${fileParsing}】,在回答问题之前,先检索知识库内有没有相关的内容,尽量使用知识库中获取到的信息来回答我的问题,以知识库中的为准。`; setSystemMessage = `以下是我提供给你的知识库:【${fileParsing}】,在回答问题之前,先检索知识库内有没有相关的内容,尽量使用知识库中获取到的信息来回答我的问题,以知识库中的为准。`;
currentRequestModelKey = currentRequestModelKey =
await this.modelsService.getCurrentModelKeyInfo(model); await this.modelsService.getCurrentModelKeyInfo(model);
await this.chatLogService.checkModelLimits(req.user, model);
common_1.Logger.log(`使用文件解析: ${setSystemMessage}`, 'ChatService'); common_1.Logger.log(`使用文件解析: ${setSystemMessage}`, 'ChatService');
} }
else { else {
@ -168,17 +158,54 @@ let ChatService = class ChatService {
setSystemMessage = systemPreMessage + `\n Current date: ${currentDate}`; setSystemMessage = systemPreMessage + `\n Current date: ${currentDate}`;
currentRequestModelKey = currentRequestModelKey =
await this.modelsService.getCurrentModelKeyInfo(model); await this.modelsService.getCurrentModelKeyInfo(model);
await this.chatLogService.checkModelLimits(req.user, model);
common_1.Logger.log(`使用全局预设: ${setSystemMessage}`, 'ChatService'); common_1.Logger.log(`使用全局预设: ${setSystemMessage}`, 'ChatService');
} }
} }
if (!currentRequestModelKey) {
common_1.Logger.debug('未找到当前模型key切换至全局模型', 'ChatService');
currentRequestModelKey = await this.modelsService.getCurrentModelKeyInfo(openaiBaseModel);
const groupInfo = await this.chatGroupService.getGroupInfoFromId(groupId);
let updatedConfig = groupInfo.config;
try {
const parsedConfig = JSON.parse(groupInfo.config);
if (parsedConfig.modelInfo) {
parsedConfig.modelInfo.modelName = currentRequestModelKey.modelName;
parsedConfig.modelInfo.model = currentRequestModelKey.model;
updatedConfig = JSON.stringify(parsedConfig);
}
}
catch (error) {
common_1.Logger.debug('模型切换错误,请检查全局模型配置!', 'ChatService');
throw new common_1.HttpException('配置解析错误!', common_1.HttpStatus.BAD_REQUEST);
}
await this.chatGroupService.update({
groupId,
title: groupInfo.title,
isSticky: false,
config: updatedConfig,
}, req);
}
const { deduct, isTokenBased, tokenFeeRatio, deductType, key, id: keyId, maxRounds, proxyUrl, maxModelTokens, timeout, model: useModel, isFileUpload, } = currentRequestModelKey; const { deduct, isTokenBased, tokenFeeRatio, deductType, key, id: keyId, maxRounds, proxyUrl, maxModelTokens, timeout, model: useModel, isFileUpload, } = currentRequestModelKey;
if (isMjTranslate === '1' && mjTranslatePrompt && model === 'midjourney') { if (await this.chatLogService.checkModelLimits(req.user, useModel)) {
const translatePrompt = await this.openAIChatService.chatFree(prompt, mjTranslatePrompt); throw new common_1.HttpException('1 小时内对话次数过多,请切换模型或稍后再试!', common_1.HttpStatus.TOO_MANY_REQUESTS);
usePrompt = }
isFileUpload === '1' && fileInfo common_1.Logger.debug(`原始用户提问: ${prompt}, 是否翻译: ${isMjTranslate}, 翻译提示: ${mjTranslatePrompt}, 模型: ${model}, 是否文件上传: ${isFileUpload}, 文件信息: ${fileInfo}`);
? fileInfo + ' ' + translatePrompt if (isMjTranslate === '1' &&
: translatePrompt; action === 'IMAGINE' &&
model === 'midjourney') {
const [beforeArgs, afterArgs] = prompt.split(/(?= --)/);
const urlPattern = /(https?:\/\/[^\s]+)/g;
const urls = beforeArgs.match(urlPattern) || [];
let textToTranslate = beforeArgs.replace(urlPattern, '').trim();
const translatedText = await this.openAIChatService.chatFree(textToTranslate, mjTranslatePrompt ||
"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.");
const finalTranslatedPrompt = [...urls, translatedText].join(' ').trim();
usePrompt = afterArgs
? `${finalTranslatedPrompt}${afterArgs}`
: finalTranslatedPrompt;
if (isFileUpload === '1' && fileInfo) {
usePrompt = `${fileInfo} ${usePrompt}`;
}
} }
else { else {
usePrompt = usePrompt =
@ -190,32 +217,11 @@ let ChatService = class ChatService {
const modelKey = key || openaiBaseKey; const modelKey = key || openaiBaseKey;
const modelTimeout = (timeout || openaiTimeout || 300) * 1000; const modelTimeout = (timeout || openaiTimeout || 300) * 1000;
const temperature = Number(openaiTemperature) || 1; const temperature = Number(openaiTemperature) || 1;
common_1.Logger.log(`\n` +
`超时设置: ${modelTimeout / 1000} s\n` +
`请求地址: ${proxyResUrl}\n` +
`使用的模型名称: ${useModeName}\n` +
`使用的模型: ${useModel}`, 'ChatService');
if (!currentRequestModelKey) {
throw new common_1.HttpException('当前流程所需要的模型已被管理员下架、请联系管理员上架专属模型!', common_1.HttpStatus.BAD_REQUEST);
}
if (groupId) { if (groupId) {
const groupInfo = await this.chatGroupService.getGroupInfoFromId(groupId); const groupInfo = await this.chatGroupService.getGroupInfoFromId(groupId);
this.updateChatTitle(groupId, groupInfo, modelType, prompt, req); this.updateChatTitle(groupId, groupInfo, modelType, prompt, req);
await this.chatGroupService.updateTime(groupId); await this.chatGroupService.updateTime(groupId);
} }
const { messagesHistory } = await this.buildMessageFromParentMessageId(prompt, {
groupId,
systemMessage: setSystemMessage,
maxModelTokens,
maxRounds: (usingPlugin === null || usingPlugin === void 0 ? void 0 : usingPlugin.parameters) === 'net-search' ||
(usingPlugin === null || usingPlugin === void 0 ? void 0 : usingPlugin.parameters) === 'mind-map' ||
useModel.includes('suno')
? 0
: maxRounds,
fileInfo: fileInfo,
model: useModel,
isFileUpload,
}, this.chatLogService);
const userSaveLog = await this.chatLogService.saveChatLog({ const userSaveLog = await this.chatLogService.saveChatLog({
appId: appId, appId: appId,
curIp, curIp,
@ -251,31 +257,23 @@ let ChatService = class ChatService {
groupId: groupId ? groupId : null, groupId: groupId ? groupId : null,
status: 2, status: 2,
modelAvatar: (usingPlugin === null || usingPlugin === void 0 ? void 0 : usingPlugin.pluginImg) || useModelAvatar || modelAvatar || '', modelAvatar: (usingPlugin === null || usingPlugin === void 0 ? void 0 : usingPlugin.pluginImg) || useModelAvatar || modelAvatar || '',
pluginParam: (usingPlugin === null || usingPlugin === void 0 ? void 0 : usingPlugin.parameters) ? usingPlugin === null || usingPlugin === void 0 ? void 0 : usingPlugin.parameters : null, pluginParam: (usingPlugin === null || usingPlugin === void 0 ? void 0 : usingPlugin.parameters)
? usingPlugin.parameters
: modelType === 2
? useModel
: null,
}); });
common_1.Logger.log('开始处理对话!', 'ChatService');
const userLogId = userSaveLog.id; const userLogId = userSaveLog.id;
const assistantLogId = assistantSaveLog.id; const assistantLogId = assistantSaveLog.id;
const autoReplyRes = await this.autoreplyService.checkAutoReply(prompt); const { messagesHistory } = await this.buildMessageFromParentMessageId(prompt, {
if (autoReplyRes && res) { groupId,
const msg = { text: autoReplyRes }; systemMessage: setSystemMessage,
const chars = autoReplyRes.split(''); maxModelTokens,
const sendCharByChar = (index) => { maxRounds: maxRounds,
if (index < chars.length) { fileInfo: fileInfo,
const msg = { text: chars[index] }; model: useModel,
res.write(`${JSON.stringify(msg)}\n`); isFileUpload,
setTimeout(() => sendCharByChar(index + 1), 10); }, this.chatLogService);
}
else {
res.end();
}
};
sendCharByChar(0);
await this.chatLogService.updateChatLog(assistantLogId, {
answer: autoReplyRes,
});
return;
}
let charge = action !== 'UPSCALE' && useModel === 'midjourney' ? deduct * 4 : deduct; let charge = action !== 'UPSCALE' && useModel === 'midjourney' ? deduct * 4 : deduct;
const abortController = new AbortController(); const abortController = new AbortController();
try { try {
@ -292,36 +290,15 @@ let ChatService = class ChatService {
useModel === 'luma-video' || useModel === 'luma-video' ||
useModel.includes('stable-diffusion')) { useModel.includes('stable-diffusion')) {
if (useModel === 'dall-e-3') { if (useModel === 'dall-e-3') {
let drawPrompt;
if (isDalleChat === '1') {
try {
common_1.Logger.log('已开启连续绘画模式', 'DalleDraw');
const { messagesHistory } = await this.buildMessageFromParentMessageId(`参考上文,结合我的需求,给出绘画描述。我的需求是:${prompt}`, {
groupId,
systemMessage: '你是一个绘画提示词生成工具,请根据用户的要求,结合上下文,用一段文字,描述用户需要的绘画需求,不用包含任何礼貌性的寒暄,只需要场景的描述,可以适当联想',
maxModelTokens: 8000,
maxRounds: 5,
fileInfo: '',
isFileUpload,
}, this.chatLogService);
drawPrompt = await this.openAIChatService.chatFree(prompt, undefined, messagesHistory);
}
catch (error) {
console.error('调用chatFree失败', error);
drawPrompt = prompt;
}
}
else {
drawPrompt = prompt;
}
response = this.openAIDrawService.dalleDraw({ response = this.openAIDrawService.dalleDraw({
prompt: drawPrompt, prompt: prompt,
extraParam: extraParam, extraParam: extraParam,
apiKey: modelKey, apiKey: modelKey,
proxyUrl: proxyResUrl, proxyUrl: proxyResUrl,
model: useModel, model: useModel,
timeout: modelTimeout, timeout: modelTimeout,
modelName: useModeName, modelName: useModeName,
groupId: groupId,
onSuccess: async (data) => { onSuccess: async (data) => {
await this.chatLogService.updateChatLog(assistantLogId, { await this.chatLogService.updateChatLog(assistantLogId, {
fileInfo: data === null || data === void 0 ? void 0 : data.fileInfo, fileInfo: data === null || data === void 0 ? void 0 : data.fileInfo,
@ -329,16 +306,14 @@ let ChatService = class ChatService {
progress: '100%', progress: '100%',
status: data.status, status: data.status,
}); });
common_1.Logger.log('绘图成功! ', 'DalleDraw');
}, },
onFailure: async (data) => { onFailure: async (data) => {
await this.chatLogService.updateChatLog(assistantLogId, { await this.chatLogService.updateChatLog(assistantLogId, {
answer: '绘图失败', answer: '绘图失败',
status: data.status, status: data.status,
}); });
common_1.Logger.log('绘图失败', 'DalleDraw');
}, },
}, messagesHistory); }, this.buildMessageFromParentMessageId);
await this.chatLogService.updateChatLog(assistantLogId, { await this.chatLogService.updateChatLog(assistantLogId, {
answer: '绘制中', answer: '绘制中',
}); });
@ -383,7 +358,6 @@ let ChatService = class ChatService {
progress: '100%', progress: '100%',
status: 3, status: 3,
}); });
common_1.Logger.log('视频生成成功', 'LumaVideo');
}, },
onFailure: async (data) => { onFailure: async (data) => {
await this.chatLogService.updateChatLog(assistantLogId, { await this.chatLogService.updateChatLog(assistantLogId, {
@ -429,7 +403,7 @@ let ChatService = class ChatService {
}); });
} }
else { else {
response = this.midjourneyService.midjourneyDraw({ response = await this.midjourneyService.midjourneyDraw({
usePrompt: usePrompt, usePrompt: usePrompt,
prompt: prompt, prompt: prompt,
apiKey: modelKey, apiKey: modelKey,
@ -439,21 +413,26 @@ let ChatService = class ChatService {
drawId, drawId,
customId, customId,
action, action,
fileInfo,
timeout: modelTimeout, timeout: modelTimeout,
assistantLogId, assistantLogId,
}); });
await this.chatLogService.updateChatLog(assistantLogId, { await this.chatLogService.updateChatLog(assistantLogId, {
answer: '绘制中', answer: response.answer,
status: response.status,
}); });
} }
await this.modelsService.saveUseLog(keyId, 1); if (response.status !== 5) {
await this.userBalanceService.deductFromBalance(req.user.id, deductType, charge); await this.modelsService.saveUseLog(keyId, 1);
await this.userBalanceService.deductFromBalance(req.user.id, deductType, charge);
}
else {
common_1.Logger.log('任务提交失败,不执行扣费', 'ChatService');
}
const userBalance = await this.userBalanceService.queryUserBalance(req.user.id); const userBalance = await this.userBalanceService.queryUserBalance(req.user.id);
response.userBalance = Object.assign({}, userBalance); response.userBalance = Object.assign({}, userBalance);
response.text = '提交成功'; response.text = response.answer;
isStop = false; response.status = response.status || 2;
isSuccess = true;
response.status = 2;
response.model = model; response.model = model;
response.modelName = modelName; response.modelName = modelName;
return res.write(`\n${JSON.stringify(response)}`); return res.write(`\n${JSON.stringify(response)}`);
@ -488,8 +467,6 @@ let ChatService = class ChatService {
abortController, abortController,
}); });
if (response.errMsg) { if (response.errMsg) {
isStop = false;
isSuccess = true;
common_1.Logger.error(`用户ID: ${req.user.id} 模型名称: ${useModeName} 模型: ${model} 回复出错,本次不扣除积分`, 'ChatService'); common_1.Logger.error(`用户ID: ${req.user.id} 模型名称: ${useModeName} 模型: ${model} 回复出错,本次不扣除积分`, 'ChatService');
return res.write(`\n${JSON.stringify(response)}`); return res.write(`\n${JSON.stringify(response)}`);
} }
@ -522,8 +499,6 @@ let ChatService = class ChatService {
common_1.Logger.log(`用户ID: ${req.user.id} 模型名称: ${useModeName} 模型: ${model} 消耗token: ${promptTokens + completionTokens}, 消耗积分: ${charge}`, 'ChatService'); common_1.Logger.log(`用户ID: ${req.user.id} 模型名称: ${useModeName} 模型: ${model} 消耗token: ${promptTokens + completionTokens}, 消耗积分: ${charge}`, 'ChatService');
const userBalance = await this.userBalanceService.queryUserBalance(req.user.id); const userBalance = await this.userBalanceService.queryUserBalance(req.user.id);
response.userBalance = Object.assign({}, userBalance); response.userBalance = Object.assign({}, userBalance);
isStop = false;
isSuccess = true;
return res.write(`\n${JSON.stringify(response)}`); return res.write(`\n${JSON.stringify(response)}`);
} }
} }
@ -533,7 +508,6 @@ let ChatService = class ChatService {
status: 5, status: 5,
}); });
response = { error: '处理请求时发生错误' }; response = { error: '处理请求时发生错误' };
isStop = false;
} }
} }
else { else {
@ -558,68 +532,11 @@ let ChatService = class ChatService {
} }
catch (error) { catch (error) {
common_1.Logger.error('chat-error <----------------------------------------->', modelKey, error); common_1.Logger.error('chat-error <----------------------------------------->', modelKey, error);
const code = (error === null || error === void 0 ? void 0 : error.statusCode) || 400;
const status = ((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) || (error === null || error === void 0 ? void 0 : error.statusCode) || 400;
common_1.Logger.error('chat-error-detail <----------------------------------------->', 'code: ', code, 'message', error === null || error === void 0 ? void 0 : error.message, 'statusText:', (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.statusText, 'status', (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.status);
if (error.status && error.status === 402) {
const errMsg = { message: `Catch Error ${error.message}`, code: 402 };
if (res) {
return res.write(JSON.stringify(errMsg));
}
else {
throw new common_1.HttpException(error.message, common_1.HttpStatus.PAYMENT_REQUIRED);
}
}
if (!status) {
if (res) {
return res.write(JSON.stringify({ message: error.message, code: 500 }));
}
else {
throw new common_1.HttpException(error.message, common_1.HttpStatus.BAD_REQUEST);
}
}
let message = errorMessage_constant_1.OpenAiErrorCodeMessage[status]
? errorMessage_constant_1.OpenAiErrorCodeMessage[status]
: '服务异常、请重新试试吧!!!';
if ((error === null || error === void 0 ? void 0 : error.message.includes('The OpenAI account associated with this API key has been deactivated.')) &&
Number(modelType) === 1) {
await this.modelsService.lockKey(keyId, '当前模型key已被封禁、已冻结当前调用Key、尝试重新对话试试吧', -1);
message = '当前模型key已被封禁';
}
if ((error === null || error === void 0 ? void 0 : error.statusCode) === 429 &&
error.message.includes('billing') &&
Number(modelType) === 1) {
await this.modelsService.lockKey(keyId, '当前模型key余额已耗尽、已冻结当前调用Key、尝试重新对话试试吧', -3);
message = '当前模型key余额已耗尽';
}
if ((error === null || error === void 0 ? void 0 : error.statusCode) === 429 &&
(error === null || error === void 0 ? void 0 : error.statusText) === 'Too Many Requests') {
message = '当前模型调用过于频繁、请重新试试吧!';
}
if ((error === null || error === void 0 ? void 0 : error.statusCode) === 401 &&
error.message.includes('Incorrect API key provided') &&
Number(modelType) === 1) {
await this.modelsService.lockKey(keyId, '提供了错误的模型秘钥', -2);
message = '提供了错误的模型秘钥、已冻结当前调用Key、请重新尝试对话';
}
if ((error === null || error === void 0 ? void 0 : error.statusCode) === 404 &&
error.message.includes('This is not a chat model and thus not supported') &&
Number(modelType) === 1) {
await this.modelsService.lockKey(keyId, '当前模型不是聊天模型', -4);
message = '当前模型不是聊天模型、已冻结当前调用Key、请重新尝试对话';
}
if (code === 400) {
common_1.Logger.error('400 error', error, error.message);
}
const errMsg = {
message: message || 'Please check the back-end console',
code: code === 401 ? 400 : code || 500,
};
if (res) { if (res) {
return res.write(JSON.stringify(errMsg)); return res.write('发生未知错误,请稍后再试');
} }
else { else {
throw new common_1.HttpException(errMsg.message, common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('发生未知错误,请稍后再试', common_1.HttpStatus.BAD_REQUEST);
} }
} }
finally { finally {
@ -660,7 +577,7 @@ let ChatService = class ChatService {
try { try {
chatTitle = await this.openAIChatService.chatFree(`根据用户提问{${prompt}}给这个对话取一个名字不超过10个字`); chatTitle = await this.openAIChatService.chatFree(`根据用户提问{${prompt}}给这个对话取一个名字不超过10个字`);
if (chatTitle.length > 15) { if (chatTitle.length > 15) {
chatTitle = chatTitle.slice(0, 15); chatTitle = chatTitle.slice(0, 15);
} }
} }
catch (error) { catch (error) {
@ -684,6 +601,10 @@ let ChatService = class ChatService {
} }
async buildMessageFromParentMessageId(text, options, chatLogService) { async buildMessageFromParentMessageId(text, options, chatLogService) {
let { systemMessage = '', fileInfo, groupId, maxRounds = 5, maxModelTokens = 8000, isFileUpload = 0, } = options; let { systemMessage = '', fileInfo, groupId, maxRounds = 5, maxModelTokens = 8000, isFileUpload = 0, } = options;
if (systemMessage.length > maxModelTokens) {
common_1.Logger.log('系统消息超过最大长度,将被截断', 'ChatService');
systemMessage = systemMessage.slice(0, maxModelTokens);
}
let messages = []; let messages = [];
if (systemMessage) { if (systemMessage) {
messages.push({ role: 'system', content: systemMessage }); messages.push({ role: 'system', content: systemMessage });
@ -694,7 +615,9 @@ let ChatService = class ChatService {
history.forEach((record) => { history.forEach((record) => {
try { try {
let content; let content;
if (isFileUpload === 2 && record.fileInfo && record.role === 'user') { if ((isFileUpload === 2 || isFileUpload === 3) &&
record.fileInfo &&
record.role === 'user') {
content = [ content = [
{ type: 'text', text: record.text }, { type: 'text', text: record.text },
{ type: 'image_url', image_url: { url: record.fileInfo } }, { type: 'image_url', image_url: { url: record.fileInfo } },
@ -728,7 +651,7 @@ let ChatService = class ChatService {
}); });
} }
let currentMessageContent; let currentMessageContent;
if (isFileUpload === 2 && fileInfo) { if ((isFileUpload === 2 || isFileUpload === 3) && fileInfo) {
currentMessageContent = [ currentMessageContent = [
{ type: 'text', text }, { type: 'text', text },
{ type: 'image_url', image_url: { url: fileInfo } }, { type: 'image_url', image_url: { url: fileInfo } },
@ -816,15 +739,12 @@ let ChatService = class ChatService {
const response = await (0, axios_1.default)(options); const response = await (0, axios_1.default)(options);
common_1.Logger.log('TTS 请求获取成功', 'TTSService'); common_1.Logger.log('TTS 请求获取成功', 'TTSService');
const buffer = Buffer.from(response.data); const buffer = Buffer.from(response.data);
const filename = `${uuid.v4().slice(0, 10)}.mp3`;
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0'); const day = String(now.getDate()).padStart(2, '0');
const currentDate = `${year}${month}/${day}`; const currentDate = `${year}${month}/${day}`;
common_1.Logger.log('开始上传语音', 'TTSService'); const ttsUrl = await this.uploadService.uploadFile({ buffer, mimetype: 'audio/mpeg' }, `audio/openai/${currentDate}`);
const ttsUrl = await this.uploadService.uploadFile({ filename, buffer }, `audio/openai/${currentDate}`);
common_1.Logger.log(`文件上传成功URL: ${ttsUrl}`, 'TTSService');
await Promise.all([ await Promise.all([
this.chatLogService.updateChatLog(chatId, { ttsUrl }), this.chatLogService.updateChatLog(chatId, { ttsUrl }),
this.userBalanceService.deductFromBalance(req.user.id, deductType, deduct), this.userBalanceService.deductFromBalance(req.user.id, deductType, deduct),

View File

@ -28,7 +28,7 @@ let ChatGroupService = class ChatGroupService {
async create(body, req) { async create(body, req) {
const { id } = req.user; const { id } = req.user;
const { appId, modelConfig: bodyModelConfig } = body; const { appId, modelConfig: bodyModelConfig } = body;
let modelConfig = bodyModelConfig || await this.modelsService.getBaseConfig(appId); let modelConfig = bodyModelConfig || (await this.modelsService.getBaseConfig());
if (!modelConfig) { if (!modelConfig) {
throw new common_1.HttpException('管理员未配置任何AI模型、请先联系管理员开通聊天模型配置', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('管理员未配置任何AI模型、请先联系管理员开通聊天模型配置', common_1.HttpStatus.BAD_REQUEST);
} }
@ -44,7 +44,7 @@ let ChatGroupService = class ChatGroupService {
isGPTs, isGPTs,
isFixedModel, isFixedModel,
modelAvatar: coverImg, modelAvatar: coverImg,
modelName: name modelName: name,
}); });
if (isGPTs === 1 || isFixedModel === 1) { if (isGPTs === 1 || isFixedModel === 1) {
const appModelKey = await this.modelsService.getCurrentModelKeyInfo(isFixedModel === 1 ? appModel : 'gpts'); const appModelKey = await this.modelsService.getCurrentModelKeyInfo(isFixedModel === 1 ? appModel : 'gpts');
@ -52,7 +52,7 @@ let ChatGroupService = class ChatGroupService {
deductType: appModelKey.deductType, deductType: appModelKey.deductType,
deduct: appModelKey.deduct, deduct: appModelKey.deduct,
model: appModel, model: appModel,
isFileUpload: appModelKey.isFileUpload isFileUpload: appModelKey.isFileUpload,
}); });
} }
if (![1, 3, 4, 5].includes(status)) { if (![1, 3, 4, 5].includes(status)) {
@ -69,13 +69,16 @@ let ChatGroupService = class ChatGroupService {
try { try {
const { id } = req.user; const { id } = req.user;
const params = { userId: id, isDelete: false }; const params = { userId: id, isDelete: false };
const res = await this.chatGroupEntity.find({ where: params, order: { isSticky: 'DESC', updatedAt: 'DESC' } }); const res = await this.chatGroupEntity.find({
where: params,
order: { isSticky: 'DESC', updatedAt: 'DESC' },
});
return res; return res;
const appIds = res.filter(t => t.appId).map(t => t.appId); const appIds = res.filter((t) => t.appId).map((t) => t.appId);
const appInfos = await this.appEntity.find({ where: { id: (0, typeorm_2.In)(appIds) } }); const appInfos = await this.appEntity.find({ where: { id: (0, typeorm_2.In)(appIds) } });
return res.map((item) => { return res.map((item) => {
var _a; var _a;
item.appLogo = (_a = appInfos.find(t => t.id === item.appId)) === null || _a === void 0 ? void 0 : _a.coverImg; item.appLogo = (_a = appInfos.find((t) => t.id === item.appId)) === null || _a === void 0 ? void 0 : _a.coverImg;
return item; return item;
}); });
} }
@ -86,7 +89,9 @@ let ChatGroupService = class ChatGroupService {
async update(body, req) { async update(body, req) {
const { title, isSticky, groupId, config } = body; const { title, isSticky, groupId, config } = body;
const { id } = req.user; const { id } = req.user;
const g = await this.chatGroupEntity.findOne({ where: { id: groupId, userId: id } }); const g = await this.chatGroupEntity.findOne({
where: { id: groupId, userId: id },
});
if (!g) { if (!g) {
throw new common_1.HttpException('请先选择一个对话或者新加一个对话再操作!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('请先选择一个对话或者新加一个对话再操作!', common_1.HttpStatus.BAD_REQUEST);
} }
@ -115,13 +120,15 @@ let ChatGroupService = class ChatGroupService {
} }
async updateTime(groupId) { async updateTime(groupId) {
await this.chatGroupEntity.update(groupId, { await this.chatGroupEntity.update(groupId, {
updatedAt: new Date() updatedAt: new Date(),
}); });
} }
async del(body, req) { async del(body, req) {
const { groupId } = body; const { groupId } = body;
const { id } = req.user; const { id } = req.user;
const g = await this.chatGroupEntity.findOne({ where: { id: groupId, userId: id } }); const g = await this.chatGroupEntity.findOne({
where: { id: groupId, userId: id },
});
if (!g) { if (!g) {
throw new common_1.HttpException('非法操作、您在删除一个非法资源!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('非法操作、您在删除一个非法资源!', common_1.HttpStatus.BAD_REQUEST);
} }

View File

@ -13,21 +13,21 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatLogController = void 0; exports.ChatLogController = void 0;
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 common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger"); const swagger_1 = require("@nestjs/swagger");
const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
const chatLog_service_1 = require("./chatLog.service"); const chatLog_service_1 = require("./chatLog.service");
const queryAllDrawLog_dto_1 = require("./dto/queryAllDrawLog.dto");
const queryAllChatLog_dto_1 = require("./dto/queryAllChatLog.dto");
const recDrawImg_dto_1 = require("./dto/recDrawImg.dto");
const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
const queryMyChatLog_dto_1 = require("./dto/queryMyChatLog.dto");
const exportExcelChatlog_dto_1 = require("./dto/exportExcelChatlog.dto");
const chatList_dto_1 = require("./dto/chatList.dto"); const chatList_dto_1 = require("./dto/chatList.dto");
const del_dto_1 = require("./dto/del.dto"); const del_dto_1 = require("./dto/del.dto");
const delByGroup_dto_1 = require("./dto/delByGroup.dto"); const delByGroup_dto_1 = require("./dto/delByGroup.dto");
const exportExcelChatlog_dto_1 = require("./dto/exportExcelChatlog.dto");
const queryAllChatLog_dto_1 = require("./dto/queryAllChatLog.dto");
const queryAllDrawLog_dto_1 = require("./dto/queryAllDrawLog.dto");
const queryByAppId_dto_1 = require("./dto/queryByAppId.dto"); const queryByAppId_dto_1 = require("./dto/queryByAppId.dto");
const queryMyChatLog_dto_1 = require("./dto/queryMyChatLog.dto");
const recDrawImg_dto_1 = require("./dto/recDrawImg.dto");
let ChatLogController = class ChatLogController { let ChatLogController = class ChatLogController {
constructor(chatLogService) { constructor(chatLogService) {
this.chatLogService = chatLogService; this.chatLogService = chatLogService;
@ -56,6 +56,9 @@ let ChatLogController = class ChatLogController {
delByGroupId(req, body) { delByGroupId(req, body) {
return this.chatLogService.delByGroupId(req, body); return this.chatLogService.delByGroupId(req, body);
} }
deleteChatsAfterId(req, body) {
return this.chatLogService.deleteChatsAfterId(req, body);
}
byAppId(req, params) { byAppId(req, params) {
return this.chatLogService.byAppId(req, params); return this.chatLogService.byAppId(req, params);
} }
@ -143,6 +146,17 @@ __decorate([
__metadata("design:paramtypes", [Object, delByGroup_dto_1.DelByGroupDto]), __metadata("design:paramtypes", [Object, delByGroup_dto_1.DelByGroupDto]),
__metadata("design:returntype", void 0) __metadata("design:returntype", void 0)
], ChatLogController.prototype, "delByGroupId", null); ], ChatLogController.prototype, "delByGroupId", null);
__decorate([
(0, common_1.Post)('deleteChatsAfterId'),
(0, swagger_1.ApiOperation)({ summary: '删除对话组中某条对话及其后的所有对话' }),
(0, swagger_1.ApiBearerAuth)(),
(0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
__param(0, (0, common_1.Req)()),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", void 0)
], ChatLogController.prototype, "deleteChatsAfterId", null);
__decorate([ __decorate([
(0, common_1.Get)('byAppId'), (0, common_1.Get)('byAppId'),
(0, swagger_1.ApiOperation)({ summary: '查询某个应用的问答记录' }), (0, swagger_1.ApiOperation)({ summary: '查询某个应用的问答记录' }),

View File

@ -283,7 +283,6 @@ let ChatLogService = class ChatLogService {
return record; return record;
}) })
.reverse(); .reverse();
common_1.Logger.debug('处理后的结果:', JSON.stringify(result, null, 2));
return result; return result;
} }
async deleteChatLog(req, body) { async deleteChatLog(req, body) {
@ -318,6 +317,22 @@ let ChatLogService = class ChatLogService {
throw new common_1.HttpException('当前页面已经没有东西可以删除了!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('当前页面已经没有东西可以删除了!', common_1.HttpStatus.BAD_REQUEST);
} }
} }
async deleteChatsAfterId(req, body) {
const { id } = body;
const { id: userId } = req.user;
const chatLog = await this.chatLogEntity.findOne({ where: { id, userId } });
if (!chatLog) {
throw new common_1.HttpException('你删除的对话记录不存在、请检查!', common_1.HttpStatus.BAD_REQUEST);
}
const { groupId } = chatLog;
const result = await this.chatLogEntity.update({ groupId, id: (0, typeorm_2.MoreThanOrEqual)(id) }, { isDelete: true });
if (result.affected > 0) {
return '删除对话记录成功!';
}
else {
throw new common_1.HttpException('当前页面已经没有东西可以删除了!', common_1.HttpStatus.BAD_REQUEST);
}
}
async byAppId(req, body) { async byAppId(req, body) {
const { id } = req.user; const { id } = req.user;
const { appId, page = 1, size = 10 } = body; const { appId, page = 1, size = 10 } = body;
@ -330,8 +345,8 @@ let ChatLogService = class ChatLogService {
return { rows, count }; return { rows, count };
} }
async checkModelLimits(userId, model) { async checkModelLimits(userId, model) {
const oneHourAgo = new Date(Date.now() - 3600 * 1000); const ONE_HOUR_IN_MS = 3600 * 1000;
let adjustedUsageCount; const oneHourAgo = new Date(Date.now() - ONE_HOUR_IN_MS);
try { try {
const usageCount = await this.chatLogEntity.count({ const usageCount = await this.chatLogEntity.count({
where: { where: {
@ -340,15 +355,24 @@ let ChatLogService = class ChatLogService {
createdAt: (0, typeorm_2.MoreThan)(oneHourAgo), createdAt: (0, typeorm_2.MoreThan)(oneHourAgo),
}, },
}); });
adjustedUsageCount = Math.ceil(usageCount / 2); const adjustedUsageCount = Math.ceil(usageCount / 2);
common_1.Logger.debug(`用户ID: ${userId.id} 模型: ${model} 一小时内已调用: ${adjustedUsageCount}`); common_1.Logger.log(`用户ID: ${userId.id} 一小时内调用 ${model} 模型 ${adjustedUsageCount + 1}`, 'ChatLogService');
let modelInfo;
if (model.startsWith('gpt-4-gizmo')) {
modelInfo = await this.modelsService.getCurrentModelKeyInfo('gpts');
}
else {
modelInfo = await this.modelsService.getCurrentModelKeyInfo(model);
}
const modelLimits = Number(modelInfo.modelLimits);
common_1.Logger.log(`模型 ${model} 的使用次数限制为 ${modelLimits}`, 'ChatLogService');
if (adjustedUsageCount > modelLimits) {
return true;
}
return false;
} }
catch (error) { catch (error) {
common_1.Logger.error(`查询数据库出错 - 用户ID: ${userId}, 模型: ${model}, 错误信息: ${error.message}`); common_1.Logger.error(`查询数据库出错 - 用户ID: ${userId.id}, 模型: ${model}, 错误信息: ${error.message}`, error.stack, 'ChatLogService');
}
const modelInfo = await this.modelsService.getCurrentModelKeyInfo(model);
if (adjustedUsageCount > modelInfo.modelLimits) {
throw new common_1.HttpException('1 小时内请求次数过多,请稍后再试!', common_1.HttpStatus.TOO_MANY_REQUESTS);
} }
} }
}; };

View File

@ -54,7 +54,7 @@ let DatabaseService = class DatabaseService {
const { username, password, status, email, role } = userInfo; const { username, password, status, email, role } = userInfo;
const user = await this.connection.query(`INSERT INTO users (username, password, status, email, role) VALUES ('${username}', '${password}', '${status}', '${email}', '${role}')`); const user = await this.connection.query(`INSERT INTO users (username, password, status, email, role) VALUES ('${username}', '${password}', '${status}', '${email}', '${role}')`);
const userId = user.insertId; const userId = user.insertId;
const balance = await this.connection.query(`INSERT INTO balance (userId, balance, usesLeft, paintCount) VALUES ('${userId}', 0, 1000, 100)`); await this.connection.query(`INSERT INTO balance (userId, balance, usesLeft, paintCount) VALUES ('${userId}', 0, 1000, 100)`);
common_1.Logger.log(`初始化创建${role}用户成功、用户名为[${username}]、初始密码为[${username === 'super' ? 'super' : '123456'}] ==============> 请注意查阅`, 'DatabaseService'); common_1.Logger.log(`初始化创建${role}用户成功、用户名为[${username}]、初始密码为[${username === 'super' ? 'super' : '123456'}] ==============> 请注意查阅`, 'DatabaseService');
} }
catch (error) { catch (error) {

View File

@ -8,11 +8,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.GlobalConfigModule = void 0; exports.GlobalConfigModule = void 0;
const common_1 = require("@nestjs/common"); const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
const config_entity_1 = require("./config.entity");
const globalConfig_controller_1 = require("./globalConfig.controller"); const globalConfig_controller_1 = require("./globalConfig.controller");
const globalConfig_service_1 = require("./globalConfig.service"); const globalConfig_service_1 = require("./globalConfig.service");
const typeorm_1 = require("@nestjs/typeorm");
const config_entity_1 = require("./config.entity");
const chatLog_entity_1 = require("../chatLog/chatLog.entity");
let GlobalConfigModule = class GlobalConfigModule { let GlobalConfigModule = class GlobalConfigModule {
}; };
GlobalConfigModule = __decorate([ GlobalConfigModule = __decorate([

View File

@ -188,15 +188,20 @@ let GlobalConfigService = class GlobalConfigService {
'mjHideWorkIn', 'mjHideWorkIn',
'isVerifyEmail', 'isVerifyEmail',
'isHideSidebar', 'isHideSidebar',
'showWatermark',
'isHideTts', 'isHideTts',
'isHideDefaultPreset',
'isHideModel3Point', 'isHideModel3Point',
'isHideModel4Point', 'isHideModel4Point',
'isHideDrawMjPoint', 'isHideDrawMjPoint',
'isHidePlugin',
'model3Name', 'model3Name',
'model4Name', 'model4Name',
'drawMjName', 'drawMjName',
'isModelInherited', 'isModelInherited',
'noVerifyRegister', 'noVerifyRegister',
'noticeInfo',
'homeHtml',
]; ];
const data = await this.configEntity.find({ const data = await this.configEntity.find({
where: { configKey: (0, typeorm_2.In)(allowKeys) }, where: { configKey: (0, typeorm_2.In)(allowKeys) },

View File

@ -68,7 +68,9 @@ let MidjourneyService = class MidjourneyService {
else { else {
let resultPromise; let resultPromise;
if (action === 'MODAL') { if (action === 'MODAL') {
resultPromise = this.getDrawActionDetail(action, drawId, customId).then((res) => res.drawId); common_1.Logger.debug('customId:', customId);
drawInfo.drawId = (await this.getDrawActionDetail(drawId, customId)).drawId;
resultPromise = this.sendDrawCommand(drawInfo, modelInfo);
} }
else { else {
resultPromise = this.sendDrawCommand(drawInfo, modelInfo); resultPromise = this.sendDrawCommand(drawInfo, modelInfo);
@ -83,7 +85,7 @@ let MidjourneyService = class MidjourneyService {
common_1.Logger.error('Error in other draw operation:', error); common_1.Logger.error('Error in other draw operation:', error);
}); });
} }
common_1.Logger.log(`执行预扣费,扣除费用:${action === 'UPSCALE' ? deduct : deduct * 4}积分。`); common_1.Logger.log(`执行预扣费,扣除费用:${action === 'UPSCALE' ? deduct : deduct * 4}积分。`, 'MidjourneyService');
await this.userBalanceService.deductFromBalance(req.user.id, deductType, action === 'UPSCALE' ? deduct : deduct * 4); await this.userBalanceService.deductFromBalance(req.user.id, deductType, action === 'UPSCALE' ? deduct : deduct * 4);
return true; return true;
} }
@ -106,7 +108,7 @@ let MidjourneyService = class MidjourneyService {
} }
async addDrawQueue(params) { async addDrawQueue(params) {
try { try {
const { prompt, imgUrl = '', extraParam = '', action, userId, customId, drawId, } = params; const { prompt, imgUrl = '', extraParam = '', action, userId, customId, drawId, base64, } = params;
const fullPrompt = imgUrl const fullPrompt = imgUrl
? `${imgUrl} ${prompt} ${extraParam}` ? `${imgUrl} ${prompt} ${extraParam}`
: `${prompt} ${extraParam}`; : `${prompt} ${extraParam}`;
@ -120,6 +122,7 @@ let MidjourneyService = class MidjourneyService {
status: midjourney_constant_1.MidjourneyStatusEnum.WAITING, status: midjourney_constant_1.MidjourneyStatusEnum.WAITING,
action, action,
customId, customId,
base64,
}; };
const res = await this.midjourneyEntity.save(drawInfo); const res = await this.midjourneyEntity.save(drawInfo);
return res; return res;
@ -231,6 +234,7 @@ let MidjourneyService = class MidjourneyService {
else if (action === 'MODAL') { else if (action === 'MODAL') {
url = `${mjProxyUrl}/mj/submit/modal`; url = `${mjProxyUrl}/mj/submit/modal`;
payloadJson = { maskBase64: base64, taskId: drawId, prompt: prompt }; payloadJson = { maskBase64: base64, taskId: drawId, prompt: prompt };
console.log('提交参数', payloadJson);
} }
else { else {
url = `${mjProxyUrl}/mj/submit/action`; url = `${mjProxyUrl}/mj/submit/action`;
@ -354,24 +358,22 @@ let MidjourneyService = class MidjourneyService {
throw new common_1.HttpException('获取我得绘制列表失败', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('获取我得绘制列表失败', common_1.HttpStatus.BAD_REQUEST);
} }
} }
async getDrawActionDetail(action, drawId, customId) { async getDrawActionDetail(drawId, customId) {
const modelInfo = await this.modelsService.getSpecialModelKeyInfo('midjourney'); const modelInfo = await this.modelsService.getSpecialModelKeyInfo('midjourney');
const { openaiBaseUrl, openaiBaseKey } = await this.globalConfigService.getConfigs([ const { openaiBaseUrl, openaiBaseKey } = await this.globalConfigService.getConfigs([
'openaiBaseUrl', 'openaiBaseUrl',
'openaiBaseKey', 'openaiBaseKey',
]); ]);
const { deduct, isTokenBased, tokenFeeRatio, deductType, key, modelName, id: keyId, maxRounds, proxyUrl, maxModelTokens, timeout, model: useModel, } = modelInfo; const { key, id: keyId, maxRounds, proxyUrl, maxModelTokens, timeout, model: useModel, } = modelInfo;
const mjProxyUrl = proxyUrl; const mjProxyUrl = proxyUrl;
const mjKey = key || openaiBaseKey; const mjKey = key || openaiBaseKey;
const headers = { 'mj-api-secret': mjKey || openaiBaseUrl }; const headers = { 'mj-api-secret': mjKey || openaiBaseUrl };
let resultId; let resultId;
if (action === 'MODAL') { const payloadJson = { taskId: drawId, customId: customId };
const payloadJson = { taskId: drawId, customId: customId }; const url = `${mjProxyUrl}/mj/submit/action`;
const url = `${mjProxyUrl}/mj/submit/action`; const res = await axios_1.default.post(url, payloadJson, { headers });
const res = await axios_1.default.post(url, payloadJson, { headers }); resultId = res.data.result;
resultId = res.data.result; console.log('Received response from action submission:', resultId);
console.log('Received response from action submission:', resultId);
}
return { drawId: resultId }; return { drawId: resultId };
} }
async deleteDraw(id, req) { async deleteDraw(id, req) {

View File

@ -72,11 +72,11 @@ let ModelsService = class ModelsService {
this.initCalcKey(); this.initCalcKey();
} }
async getCurrentModelKeyInfo(model) { async getCurrentModelKeyInfo(model) {
const modelKeyInfo = await this.modelsEntity.findOne({ let modelKeyInfo = await this.modelsEntity.findOne({
where: { model: model }, where: { model: model },
}); });
if (!modelKeyInfo) { if (!modelKeyInfo) {
throw new common_1.HttpException('当前调用模型的key未找到请重新选择模型', common_1.HttpStatus.BAD_REQUEST); return null;
} }
return modelKeyInfo; return modelKeyInfo;
} }
@ -92,7 +92,7 @@ let ModelsService = class ModelsService {
const modifiedModel = Object.assign(Object.assign({}, firstMatchModel), { model: modifiedModelName }); const modifiedModel = Object.assign(Object.assign({}, firstMatchModel), { model: modifiedModelName });
return modifiedModel; return modifiedModel;
} }
async getBaseConfig(appId) { async getBaseConfig() {
if (!this.modelTypes.length || !Object.keys(this.modelMaps).length) if (!this.modelTypes.length || !Object.keys(this.modelMaps).length)
return; return;
const { keyType, modelName, model, deductType, deduct, isFileUpload, modelAvatar, modelDescription, } = this.modelMaps[1][0]; const { keyType, modelName, model, deductType, deduct, isFileUpload, modelAvatar, modelDescription, } = this.modelMaps[1][0];

View File

@ -109,13 +109,13 @@ let OfficialService = class OfficialService {
} }
async scan(openID, sceneStr) { async scan(openID, sceneStr) {
try { try {
common_1.Logger.log(`Scanning with openID: ${openID}, sceneStr: ${sceneStr}`); common_1.Logger.log(`Scanning with openID: ${openID}, sceneStr: ${sceneStr}`, 'OfficialService');
if (!this.sceneStrMap[sceneStr]) { if (!this.sceneStrMap[sceneStr]) {
common_1.Logger.error(`非法参数: 未找到的 sceneStr ${sceneStr}`); common_1.Logger.error(`非法参数: 未找到的 sceneStr ${sceneStr}`);
throw new common_1.HttpException('非法参数', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('非法参数', common_1.HttpStatus.BAD_REQUEST);
} }
const user = await this.userService.getUserFromOpenId(openID, sceneStr); const user = await this.userService.getUserFromOpenId(openID, sceneStr);
common_1.Logger.log(`User found: ${user ? user.id : 'No user found'}`); common_1.Logger.log(`User found: ${user ? user.id : 'No user found'}`, 'OfficialService');
this.scanedSceneStrMap[sceneStr] = user.id; this.scanedSceneStrMap[sceneStr] = user.id;
} }
catch (error) { catch (error) {

View File

@ -52,13 +52,17 @@ let PayService = class PayService {
return this.notifyMpay(params); return this.notifyMpay(params);
} }
async pay(userId, orderId, payType = 'wxpay') { async pay(userId, orderId, payType = 'wxpay') {
const order = await this.orderEntity.findOne({ where: { userId, orderId } }); const order = await this.orderEntity.findOne({
where: { userId, orderId },
});
if (!order) if (!order)
throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST);
const goods = await this.cramiPackageEntity.findOne({ where: { id: order.goodsId } }); const goods = await this.cramiPackageEntity.findOne({
where: { id: order.goodsId },
});
if (!goods) if (!goods)
throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST);
console.log('本次支付类型: ', order.payPlatform); common_1.Logger.log('本次支付类型: ', order.payPlatform);
try { try {
if (order.payPlatform == 'wechat') { if (order.payPlatform == 'wechat') {
return this.payWeChat(userId, orderId, payType); return this.payWeChat(userId, orderId, payType);
@ -77,7 +81,7 @@ let PayService = class PayService {
} }
} }
catch (error) { catch (error) {
console.log('支付请求失败: ', error); common_1.Logger.log('支付请求失败: ', error);
throw new common_1.HttpException('支付请求失败!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('支付请求失败!', common_1.HttpStatus.BAD_REQUEST);
} }
} }
@ -88,12 +92,16 @@ let PayService = class PayService {
return order; return order;
} }
async notifyHupi(params) { async notifyHupi(params) {
const payHupiSecret = await this.globalConfigService.getConfigs(['payHupiSecret']); const payHupiSecret = await this.globalConfigService.getConfigs([
'payHupiSecret',
]);
const hash = params['hash']; const hash = params['hash'];
delete params['hash']; delete params['hash'];
if (this.sign(params, payHupiSecret) != hash) if (this.sign(params, payHupiSecret) != hash)
return 'failed'; return 'failed';
const order = await this.orderEntity.findOne({ where: { orderId: params['trade_order_id'], status: 0 } }); const order = await this.orderEntity.findOne({
where: { orderId: params['trade_order_id'], status: 0 },
});
if (!order) if (!order)
return 'failed'; return 'failed';
await this.userBalanceService.addBalanceToOrder(order); await this.userBalanceService.addBalanceToOrder(order);
@ -103,18 +111,22 @@ let PayService = class PayService {
return 'success'; return 'success';
} }
async payHupi(userId, orderId, payType = 'wxpay') { async payHupi(userId, orderId, payType = 'wxpay') {
const order = await this.orderEntity.findOne({ where: { userId, orderId } }); const order = await this.orderEntity.findOne({
where: { userId, orderId },
});
if (!order) if (!order)
throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST);
const goods = await this.cramiPackageEntity.findOne({ where: { id: order.goodsId } }); const goods = await this.cramiPackageEntity.findOne({
where: { id: order.goodsId },
});
if (!goods) if (!goods)
throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST);
const { payHupiAppId, payHupiSecret, payHupiNotifyUrl, payHupiReturnUrl, payHupiGatewayUrl } = await this.globalConfigService.getConfigs([ const { payHupiAppId, payHupiSecret, payHupiNotifyUrl, payHupiReturnUrl, payHupiGatewayUrl, } = await this.globalConfigService.getConfigs([
'payHupiAppId', 'payHupiAppId',
'payHupiSecret', 'payHupiSecret',
'payHupiNotifyUrl', 'payHupiNotifyUrl',
'payHupiReturnUrl', 'payHupiReturnUrl',
'payHupiGatewayUrl' 'payHupiGatewayUrl',
]); ]);
const params = {}; const params = {};
params['version'] = '1.1'; params['version'] = '1.1';
@ -134,7 +146,10 @@ let PayService = class PayService {
return { url_qrcode, url }; return { url_qrcode, url };
} }
async queryHupi(orderId) { async queryHupi(orderId) {
const { payHupiAppId, payHupiSecret } = await this.globalConfigService.getConfigs(['payHupiAppId', 'payHupiSecret']); const { payHupiAppId, payHupiSecret } = await this.globalConfigService.getConfigs([
'payHupiAppId',
'payHupiSecret',
]);
const params = {}; const params = {};
params['version'] = '1.1'; params['version'] = '1.1';
params['appid'] = payHupiAppId; params['appid'] = payHupiAppId;
@ -151,11 +166,15 @@ let PayService = class PayService {
const sign = params['sign']; const sign = params['sign'];
delete params['sign']; delete params['sign'];
delete params['sign_type']; delete params['sign_type'];
const payEpaySecret = await this.globalConfigService.getConfigs(['payEpaySecret']); const payEpaySecret = await this.globalConfigService.getConfigs([
'payEpaySecret',
]);
if (this.sign(params, payEpaySecret) != sign) if (this.sign(params, payEpaySecret) != sign)
return 'failed'; return 'failed';
console.log('校验签名通过'); common_1.Logger.log('校验签名通过');
const order = await this.orderEntity.findOne({ where: { orderId: params['out_trade_no'], status: 0 } }); const order = await this.orderEntity.findOne({
where: { orderId: params['out_trade_no'], status: 0 },
});
if (!order) if (!order)
return 'failed'; return 'failed';
const status = params['trade_status'] == 'TRADE_SUCCESS' ? 1 : 2; const status = params['trade_status'] == 'TRADE_SUCCESS' ? 1 : 2;
@ -168,13 +187,17 @@ let PayService = class PayService {
return 'success'; return 'success';
} }
async payEpay(userId, orderId, payType = 'alipay') { async payEpay(userId, orderId, payType = 'alipay') {
const order = await this.orderEntity.findOne({ where: { userId, orderId } }); const order = await this.orderEntity.findOne({
where: { userId, orderId },
});
if (!order) if (!order)
throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST);
const goods = await this.cramiPackageEntity.findOne({ where: { id: order.goodsId } }); const goods = await this.cramiPackageEntity.findOne({
where: { id: order.goodsId },
});
if (!goods) if (!goods)
throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST);
const { payEpayPid, payEpaySecret, payEpayNotifyUrl, payEpayReturnUrl, payEpayApiPayUrl } = await this.globalConfigService.getConfigs([ const { payEpayPid, payEpaySecret, payEpayNotifyUrl, payEpayReturnUrl, payEpayApiPayUrl, } = await this.globalConfigService.getConfigs([
'payEpayPid', 'payEpayPid',
'payEpaySecret', 'payEpaySecret',
'payEpayNotifyUrl', 'payEpayNotifyUrl',
@ -204,15 +227,30 @@ let PayService = class PayService {
const queryParams = new URLSearchParams(params).toString(); const queryParams = new URLSearchParams(params).toString();
const apiUrl = `${payEpayApiPayUrl}?${queryParams}`; const apiUrl = `${payEpayApiPayUrl}?${queryParams}`;
if (payEpayApiPayUrl.includes('submit.php')) { if (payEpayApiPayUrl.includes('submit.php')) {
return { url_qrcode: null, redirectUrl: apiUrl, channel: payType, isRedirect: true }; return {
url_qrcode: null,
redirectUrl: apiUrl,
channel: payType,
isRedirect: true,
};
} }
else { else {
const res = await axios_1.default.get(payEpayApiPayUrl, { params }); const config = {
console.log('epay ---> res: ', res.data); headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
};
const res = await axios_1.default.post(payEpayApiPayUrl, params, config);
common_1.Logger.log('epay ---> res: ', res.data);
const { data: { code, msg, qrcode: url_qrcode }, } = res; const { data: { code, msg, qrcode: url_qrcode }, } = res;
if (code != 1) if (code != 1)
throw new common_1.HttpException(msg, common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException(msg, common_1.HttpStatus.BAD_REQUEST);
return { url_qrcode, redirectUrl: null, channel: payType, isRedirect: false }; return {
url_qrcode,
redirectUrl: null,
channel: payType,
isRedirect: false,
};
} }
} }
async queryEpay(orderId) { async queryEpay(orderId) {
@ -235,16 +273,20 @@ let PayService = class PayService {
const sign = params['sign']; const sign = params['sign'];
delete params['sign']; delete params['sign'];
delete params['sign_type']; delete params['sign_type'];
const payMpaySecret = await this.globalConfigService.getConfigs(['payMpaySecret']); const payMpaySecret = await this.globalConfigService.getConfigs([
console.log('校验签名'); 'payMpaySecret',
]);
common_1.Logger.log('校验签名');
if (this.sign(params, payMpaySecret) != sign) if (this.sign(params, payMpaySecret) != sign)
return 'failed'; return 'failed';
console.log('校验签名通过'); common_1.Logger.log('校验签名通过');
const order = await this.orderEntity.findOne({ where: { orderId: params['out_trade_no'], status: 0 } }); const order = await this.orderEntity.findOne({
where: { orderId: params['out_trade_no'], status: 0 },
});
if (!order) if (!order)
return 'failed'; return 'failed';
const status = params['trade_status'] == 'TRADE_SUCCESS' ? 1 : 2; const status = params['trade_status'] == 'TRADE_SUCCESS' ? 1 : 2;
console.log('status: ', status); common_1.Logger.log('status: ', status);
const result = await this.orderEntity.update({ orderId: params['out_trade_no'] }, { status, paydAt: new Date() }); const result = await this.orderEntity.update({ orderId: params['out_trade_no'] }, { status, paydAt: new Date() });
if (status === 1) { if (status === 1) {
await this.userBalanceService.addBalanceToOrder(order); await this.userBalanceService.addBalanceToOrder(order);
@ -254,13 +296,17 @@ let PayService = class PayService {
return 'success'; return 'success';
} }
async payMpay(userId, orderId, payType = 'wxpay') { async payMpay(userId, orderId, payType = 'wxpay') {
const order = await this.orderEntity.findOne({ where: { userId, orderId } }); const order = await this.orderEntity.findOne({
where: { userId, orderId },
});
if (!order) if (!order)
throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST);
const goods = await this.cramiPackageEntity.findOne({ where: { id: order.goodsId } }); const goods = await this.cramiPackageEntity.findOne({
where: { id: order.goodsId },
});
if (!goods) if (!goods)
throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST);
const { payMpayPid, payMpaySecret, payMpayNotifyUrl, payMpayReturnUrl, payMpayApiPayUrl } = await this.globalConfigService.getConfigs([ const { payMpayPid, payMpaySecret, payMpayNotifyUrl, payMpayReturnUrl, payMpayApiPayUrl, } = await this.globalConfigService.getConfigs([
'payMpayPid', 'payMpayPid',
'payMpaySecret', 'payMpaySecret',
'payMpayNotifyUrl', 'payMpayNotifyUrl',
@ -279,11 +325,20 @@ let PayService = class PayService {
params['sign_type'] = 'MD5'; params['sign_type'] = 'MD5';
const queryParams = new URLSearchParams(params).toString(); const queryParams = new URLSearchParams(params).toString();
const apiUrl = `${payMpayApiPayUrl}?${queryParams}`; const apiUrl = `${payMpayApiPayUrl}?${queryParams}`;
return { url_qrcode: null, redirectUrl: apiUrl, channel: payType, isRedirect: true }; return {
url_qrcode: null,
redirectUrl: apiUrl,
channel: payType,
isRedirect: true,
};
const res = await axios_1.default.get(payMpayApiPayUrl, { params }); const res = await axios_1.default.get(payMpayApiPayUrl, { params });
} }
async queryMpay(orderId) { async queryMpay(orderId) {
const { payMpayApiQueryUrl } = await this.globalConfigService.getConfigs(['payMpayPid', 'payMpaySecret', 'payMpayApiQueryUrl']); const { payMpayApiQueryUrl } = await this.globalConfigService.getConfigs([
'payMpayPid',
'payMpaySecret',
'payMpayApiQueryUrl',
]);
const params = {}; const params = {};
params['type'] = 2; params['type'] = 2;
params['order_no'] = orderId; params['order_no'] = orderId;
@ -293,8 +348,8 @@ let PayService = class PayService {
return result; return result;
} }
async notifyWeChat(params) { async notifyWeChat(params) {
console.log('微信支付通知params: ', params); common_1.Logger.log('微信支付通知params: ', params);
const { payWeChatAppId, payWeChatMchId, payWeChatSecret, payWeChatPublicKey, payWeChatPrivateKey } = await this.globalConfigService.getConfigs([ const { payWeChatAppId, payWeChatMchId, payWeChatSecret, payWeChatPublicKey, payWeChatPrivateKey, } = await this.globalConfigService.getConfigs([
'payWeChatAppId', 'payWeChatAppId',
'payWeChatMchId', 'payWeChatMchId',
'payWeChatSecret', 'payWeChatSecret',
@ -311,7 +366,9 @@ let PayService = class PayService {
if (params['event_type'] == 'TRANSACTION.SUCCESS') { if (params['event_type'] == 'TRANSACTION.SUCCESS') {
const { ciphertext, associated_data, nonce } = params['resource']; const { ciphertext, associated_data, nonce } = params['resource'];
const resource = pay.decipher_gcm(ciphertext, associated_data, nonce, payWeChatSecret); const resource = pay.decipher_gcm(ciphertext, associated_data, nonce, payWeChatSecret);
const order = await this.orderEntity.findOne({ where: { orderId: resource['out_trade_no'], status: 0 } }); const order = await this.orderEntity.findOne({
where: { orderId: resource['out_trade_no'], status: 0 },
});
if (!order) if (!order)
return 'failed'; return 'failed';
const status = resource['trade_state'] == 'SUCCESS' ? 1 : 2; const status = resource['trade_state'] == 'SUCCESS' ? 1 : 2;
@ -325,28 +382,30 @@ let PayService = class PayService {
return 'success'; return 'success';
} }
catch (error) { catch (error) {
console.log('error: ', error); common_1.Logger.log('error: ', error);
console.log('支付通知验证失败: ', error); common_1.Logger.log('支付通知验证失败: ', error);
return 'failed'; return 'failed';
} }
} }
async payWeChat(userId, orderId, payType = 'native') { async payWeChat(userId, orderId, payType = 'native') {
var _a, _b, _c, _d, _e, _f, _g; var _a, _b, _c, _d, _e, _f, _g;
console.log('payType: ', payType); common_1.Logger.log('payType: ', payType);
const order = await this.orderEntity.findOne({ where: { userId, orderId } }); const order = await this.orderEntity.findOne({
where: { userId, orderId },
});
if (!order) if (!order)
throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST);
const goods = await this.cramiPackageEntity.findOne({ where: { id: order.goodsId } }); const goods = await this.cramiPackageEntity.findOne({
where: { id: order.goodsId },
});
if (!goods) if (!goods)
throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST);
const { payWeChatAppId, payWeChatMchId, payWeChatPublicKey, payWeChatPrivateKey, payWeChatNotifyUrl, payWeChatH5Name, payWeChatH5Url } = await this.globalConfigService.getConfigs([ const { payWeChatAppId, payWeChatMchId, payWeChatPublicKey, payWeChatPrivateKey, payWeChatNotifyUrl, } = await this.globalConfigService.getConfigs([
'payWeChatAppId', 'payWeChatAppId',
'payWeChatMchId', 'payWeChatMchId',
'payWeChatPublicKey', 'payWeChatPublicKey',
'payWeChatPrivateKey', 'payWeChatPrivateKey',
'payWeChatNotifyUrl', 'payWeChatNotifyUrl',
'payWeChatH5Name',
'payWeChatH5Url',
]); ]);
const pay = new this.WxPay({ const pay = new this.WxPay({
appid: payWeChatAppId, appid: payWeChatAppId,
@ -364,17 +423,17 @@ let PayService = class PayService {
total: Math.round(order.total * 100), total: Math.round(order.total * 100),
}, },
}; };
console.log('wechat-pay: ', params); common_1.Logger.log('wechat-pay: ', params);
if (payType == 'jsapi') { if (payType == 'jsapi') {
console.log(`[WeChat Pay JSAPI] 开始JSAPI支付流程用户ID: ${userId}, 订单ID: ${orderId}`); common_1.Logger.log(`[WeChat Pay JSAPI] 开始JSAPI支付流程用户ID: ${userId}, 订单ID: ${orderId}`);
const openid = await this.userService.getOpenIdByUserId(userId); const openid = await this.userService.getOpenIdByUserId(userId);
console.log(`[WeChat Pay JSAPI] 用户OpenID: ${openid}`); common_1.Logger.log(`[WeChat Pay JSAPI] 用户OpenID: ${openid}`);
params['payer'] = { openid: openid }; params['payer'] = { openid: openid };
console.log(`[WeChat Pay JSAPI] 发送支付请求参数: `, JSON.stringify(params, null, 2)); common_1.Logger.log(`[WeChat Pay JSAPI] 发送支付请求参数: `, JSON.stringify(params, null, 2));
try { try {
const response = await pay.transactions_jsapi(params); const response = await pay.transactions_jsapi(params);
const result = response.data ? response.data : response; const result = response.data ? response.data : response;
console.log(`[WeChat Pay JSAPI] 支付请求成功,返回结果: `, JSON.stringify(result, null, 2)); common_1.Logger.log(`[WeChat Pay JSAPI] 支付请求成功,返回结果: `, JSON.stringify(result, null, 2));
return { return {
status: response.status || 'unknown', status: response.status || 'unknown',
appId: result.appId || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.appId), appId: result.appId || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.appId),
@ -382,7 +441,7 @@ let PayService = class PayService {
nonceStr: result.nonceStr || ((_c = result.data) === null || _c === void 0 ? void 0 : _c.nonceStr), 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), 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), 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) paySign: result.paySign || ((_f = result.data) === null || _f === void 0 ? void 0 : _f.paySign),
}; };
} }
catch (error) { catch (error) {
@ -392,16 +451,16 @@ let PayService = class PayService {
} }
} }
if (payType == 'native') { if (payType == 'native') {
console.log(`开始进行微信Native支付流程订单ID: ${orderId}, 用户ID: ${userId}`); common_1.Logger.log(`开始进行微信Native支付流程订单ID: ${orderId}, 用户ID: ${userId}`);
try { try {
const res = await pay.transactions_native(params); const res = await pay.transactions_native(params);
console.log(`微信Native支付响应数据: `, JSON.stringify(res, null, 2)); common_1.Logger.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); let url_qrcode = res.code_url || ((_g = res.data) === null || _g === void 0 ? void 0 : _g.code_url);
if (!url_qrcode) { if (!url_qrcode) {
console.error(`微信Native支付请求成功但未返回code_url响应数据: `, JSON.stringify(res, null, 2)); console.error(`微信Native支付请求成功但未返回code_url响应数据: `, JSON.stringify(res, null, 2));
} }
else { else {
console.log(`微信Native支付请求成功code_url: ${url_qrcode}`); common_1.Logger.log(`微信Native支付请求成功code_url: ${url_qrcode}`);
} }
return { url_qrcode, isRedirect: false }; return { url_qrcode, isRedirect: false };
} }
@ -417,7 +476,12 @@ let PayService = class PayService {
} }
} }
async queryWeChat(orderId) { async queryWeChat(orderId) {
const { payWeChatAppId, payWeChatMchId, payWeChatPublicKey, payWeChatPrivateKey, payWeChatNotifyUrl, payWeChatH5Name, payWeChatH5Url } = await this.globalConfigService.getConfigs(['payWeChatAppId', 'payWeChatMchId', 'payWeChatPublicKey', 'payWeChatPrivateKey']); const { payWeChatAppId, payWeChatMchId, payWeChatPublicKey, payWeChatPrivateKey, payWeChatNotifyUrl, } = await this.globalConfigService.getConfigs([
'payWeChatAppId',
'payWeChatMchId',
'payWeChatPublicKey',
'payWeChatPrivateKey',
]);
const pay = new this.WxPay({ const pay = new this.WxPay({
appid: payWeChatAppId, appid: payWeChatAppId,
mchid: payWeChatMchId, mchid: payWeChatMchId,
@ -438,21 +502,25 @@ let PayService = class PayService {
const paramsArr = Object.keys(params); const paramsArr = Object.keys(params);
paramsArr.sort(); paramsArr.sort();
const stringArr = []; const stringArr = [];
paramsArr.map(key => { paramsArr.map((key) => {
stringArr.push(key + '=' + params[key]); stringArr.push(key + '=' + params[key]);
}); });
stringArr.push("key=" + secret); stringArr.push('key=' + secret);
const str = stringArr.join('&'); const str = stringArr.join('&');
return crypto.createHash('md5').update(str).digest('hex').toUpperCase(); return crypto.createHash('md5').update(str).digest('hex').toUpperCase();
} }
async payLtzf(userId, orderId, payType = 'wxpay') { async payLtzf(userId, orderId, payType = 'wxpay') {
const order = await this.orderEntity.findOne({ where: { userId, orderId } }); const order = await this.orderEntity.findOne({
where: { userId, orderId },
});
if (!order) if (!order)
throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('订单不存在!', common_1.HttpStatus.BAD_REQUEST);
const goods = await this.cramiPackageEntity.findOne({ where: { id: order.goodsId } }); const goods = await this.cramiPackageEntity.findOne({
where: { id: order.goodsId },
});
if (!goods) if (!goods)
throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('套餐不存在!', common_1.HttpStatus.BAD_REQUEST);
const { payLtzfMchId, payLtzfSecret, payLtzfNotifyUrl, payLtzfReturnUrl, } = await this.globalConfigService.getConfigs([ const { payLtzfMchId, payLtzfSecret, payLtzfNotifyUrl, payLtzfReturnUrl } = await this.globalConfigService.getConfigs([
'payLtzfMchId', 'payLtzfMchId',
'payLtzfSecret', 'payLtzfSecret',
'payLtzfNotifyUrl', 'payLtzfNotifyUrl',
@ -468,11 +536,13 @@ let PayService = class PayService {
params['sign'] = this.ltzfSign(params, payLtzfSecret); params['sign'] = this.ltzfSign(params, payLtzfSecret);
params['attach'] = 'ltzf'; params['attach'] = 'ltzf';
params['return_url'] = payLtzfReturnUrl; params['return_url'] = payLtzfReturnUrl;
const formBody = Object.keys(params).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(params[key])).join('&'); const formBody = Object.keys(params)
.map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(params[key]))
.join('&');
const config = { const config = {
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded',
} },
}; };
const response = await axios_1.default.post('https://api.ltzf.cn/api/wxpay/jsapi_convenient', formBody, config); const response = await axios_1.default.post('https://api.ltzf.cn/api/wxpay/jsapi_convenient', formBody, config);
const { code, data, msg } = response.data; const { code, data, msg } = response.data;
@ -483,17 +553,22 @@ let PayService = class PayService {
return { url_qrcode, url }; return { url_qrcode, url };
} }
async queryLtzf(orderId) { async queryLtzf(orderId) {
const { payLtzfMchId, payLtzfSecret } = await this.globalConfigService.getConfigs(['payLtzfMchId', 'payLtzfSecret']); const { payLtzfMchId, payLtzfSecret } = await this.globalConfigService.getConfigs([
'payLtzfMchId',
'payLtzfSecret',
]);
const params = {}; const params = {};
params['mch_id'] = payLtzfMchId; params['mch_id'] = payLtzfMchId;
params['timestamp'] = (Date.now() / 1000).toFixed(0); params['timestamp'] = (Date.now() / 1000).toFixed(0);
params['out_trade_no'] = orderId; params['out_trade_no'] = orderId;
params['sign'] = this.ltzfSign(params, payLtzfSecret); params['sign'] = this.ltzfSign(params, payLtzfSecret);
const formBody = Object.keys(params).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(params[key])).join('&'); const formBody = Object.keys(params)
.map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(params[key]))
.join('&');
const config = { const config = {
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded',
} },
}; };
const { data: { code, msg, data: result }, } = await axios_1.default.post('https://api.ltzf.cn/api/wxpay/get_pay_order', formBody, config); const { data: { code, msg, data: result }, } = await axios_1.default.post('https://api.ltzf.cn/api/wxpay/get_pay_order', formBody, config);
if (code != 0) if (code != 0)
@ -501,7 +576,9 @@ let PayService = class PayService {
return result; return result;
} }
async notifyLtzf(params) { async notifyLtzf(params) {
const payLtzfSecret = await this.globalConfigService.getConfigs(['payLtzfSecret']); const payLtzfSecret = await this.globalConfigService.getConfigs([
'payLtzfSecret',
]);
const hash = params['sign']; const hash = params['sign'];
delete params['sign']; delete params['sign'];
delete params['pay_channel']; delete params['pay_channel'];
@ -511,7 +588,9 @@ let PayService = class PayService {
delete params['openid']; delete params['openid'];
if (this.ltzfSign(params, payLtzfSecret) != hash) if (this.ltzfSign(params, payLtzfSecret) != hash)
return 'FAIL'; return 'FAIL';
const order = await this.orderEntity.findOne({ where: { orderId: params['out_trade_no'], status: 0 } }); const order = await this.orderEntity.findOne({
where: { orderId: params['out_trade_no'], status: 0 },
});
if (!order) if (!order)
return 'FAIL'; return 'FAIL';
await this.userBalanceService.addBalanceToOrder(order); await this.userBalanceService.addBalanceToOrder(order);

View File

@ -16,19 +16,37 @@ exports.PluginService = void 0;
const common_1 = require("@nestjs/common"); const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm"); const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm"); const typeorm_2 = require("typeorm");
const models_service_1 = require("../models/models.service");
const plugin_entity_1 = require("./plugin.entity"); const plugin_entity_1 = require("./plugin.entity");
let PluginService = class PluginService { let PluginService = class PluginService {
constructor(PluginEntity) { constructor(PluginEntity, modelsService) {
this.PluginEntity = PluginEntity; this.PluginEntity = PluginEntity;
this.modelsService = modelsService;
} }
async pluginList(query) { async pluginList(query) {
const { page = 1, size = 1000 } = query; const { page = 1, size = 100 } = query;
const rows = await this.PluginEntity.find({ const rows = await this.PluginEntity.find({
order: { sortOrder: 'ASC', id: 'DESC' }, order: { sortOrder: 'ASC', id: 'DESC' },
skip: (page - 1) * size, skip: (page - 1) * size,
take: size, take: size,
}); });
return { rows, count: rows.length }; const processedRows = await Promise.all(rows.map(async (plugin) => {
if (plugin.isSystemPlugin === 1) {
try {
const parameters = await this.modelsService.getCurrentModelKeyInfo(plugin.parameters);
const deductType = parameters.deductType;
return Object.assign(Object.assign({}, plugin), { deductType });
}
catch (error) {
return Object.assign(Object.assign({}, plugin), { deductType: 0 });
}
}
else {
return Object.assign(Object.assign({}, plugin), { deductType: 0 });
}
}));
const filteredRows = processedRows.filter((plugin) => plugin !== null);
return { rows: filteredRows, count: filteredRows.length };
} }
async createPlugin(body) { async createPlugin(body) {
const { name, pluginImg, description, isEnabled, isSystemPlugin, parameters, sortOrder, } = body; const { name, pluginImg, description, isEnabled, isSystemPlugin, parameters, sortOrder, } = body;
@ -98,6 +116,7 @@ let PluginService = class PluginService {
PluginService = __decorate([ PluginService = __decorate([
(0, common_1.Injectable)(), (0, common_1.Injectable)(),
__param(0, (0, typeorm_1.InjectRepository)(plugin_entity_1.PluginEntity)), __param(0, (0, typeorm_1.InjectRepository)(plugin_entity_1.PluginEntity)),
__metadata("design:paramtypes", [typeorm_2.Repository]) __metadata("design:paramtypes", [typeorm_2.Repository,
models_service_1.ModelsService])
], PluginService); ], PluginService);
exports.PluginService = PluginService; exports.PluginService = PluginService;

View File

@ -220,6 +220,36 @@ let StatisticService = class StatisticService {
} }
return dailyData; return dailyData;
} }
async getNewAccessToken(baiduApiKey, baiduSecretKey, baiduRefreshToken) {
const tokenUrl = `http://openapi.baidu.com/oauth/2.0/token?grant_type=refresh_token&refresh_token=${baiduRefreshToken}&client_id=${baiduApiKey}&client_secret=${baiduSecretKey}`;
common_1.Logger.log('获取新 accessToken', tokenUrl);
try {
const tokenRes = await axios_1.default.get(tokenUrl);
if (tokenRes.status === 200 && tokenRes.data.access_token) {
return {
accessToken: tokenRes.data.access_token,
refreshToken: tokenRes.data.refresh_token,
};
}
else {
throw new Error('Failed to get new access token');
}
}
catch (tokenError) {
common_1.Logger.error('获取新 accessToken 失败', {
message: tokenError.message,
stack: tokenError.stack,
response: tokenError.response
? tokenError.response.data
: 'No response data',
});
throw new common_1.HttpException('获取新 accessToken 失败', common_1.HttpStatus.BAD_REQUEST);
}
}
async updateAccessTokenInDatabase(accessToken, refreshToken, configEntity) {
await configEntity.update({ configKey: 'baiduToken' }, { configVal: accessToken });
await configEntity.update({ configKey: 'baiduRefreshToken' }, { configVal: refreshToken });
}
async getBaiduStatistics(days) { async getBaiduStatistics(days) {
const end_date = (0, date_1.formatDate)(new Date(), 'YYYYMMDD'); const end_date = (0, date_1.formatDate)(new Date(), 'YYYYMMDD');
const start_date = (0, date_1.formatDate)(new Date(Date.now() - Number(days - 1) * 24 * 60 * 60 * 1000), 'YYYYMMDD'); const start_date = (0, date_1.formatDate)(new Date(Date.now() - Number(days - 1) * 24 * 60 * 60 * 1000), 'YYYYMMDD');
@ -232,58 +262,34 @@ let StatisticService = class StatisticService {
'baiduSecretKey', 'baiduSecretKey',
'baiduRefreshToken', 'baiduRefreshToken',
]); ]);
if (!baiduApiKey || if (!baiduApiKey || !baiduSiteId || !baiduRefreshToken || !baiduSecretKey) {
!baiduToken ||
!baiduSiteId ||
!baiduRefreshToken ||
!baiduSecretKey) {
return []; return [];
} }
let accessToken = baiduToken; let accessToken = baiduToken;
let url = `https://openapi.baidu.com/rest/2.0/tongji/report/getData?access_token=${accessToken}&site_id=${baiduSiteId}&method=${method}&start_date=${start_date}&end_date=${end_date}&metrics=${metrics}`;
let res; let res;
try { let url;
res = await axios_1.default.get(url); const fetchData = async (token) => {
} url = `https://openapi.baidu.com/rest/2.0/tongji/report/getData?access_token=${token}&site_id=${baiduSiteId}&method=${method}&start_date=${start_date}&end_date=${end_date}&metrics=${metrics}`;
catch (error) {
res = {
data: {
error_code: 111,
message: 'Access token invalid or no longer valid',
},
};
}
let { error_code, message } = res.data;
if (error_code === 111) {
const tokenUrl = `http://openapi.baidu.com/oauth/2.0/token?grant_type=refresh_token&refresh_token=${baiduRefreshToken}&client_id=${baiduApiKey}&client_secret=${baiduSecretKey}`;
common_1.Logger.log('获取新 accessToken', tokenUrl);
let tokenRes;
try { try {
tokenRes = await axios_1.default.get(tokenUrl); return await axios_1.default.get(url);
} }
catch (tokenError) { catch (error) {
common_1.Logger.error('获取新 accessToken 失败', { return {
message: tokenError.message, data: {
stack: tokenError.stack, error_code: 111,
response: tokenError.response message: 'Access token invalid or no longer valid',
? tokenError.response.data },
: 'No response data', };
});
throw new common_1.HttpException('获取新 accessToken 失败', common_1.HttpStatus.BAD_REQUEST);
}
if (tokenRes.status === 200 && tokenRes.data.access_token) {
accessToken = tokenRes.data.access_token;
await this.configEntity.update({ configKey: 'baiduToken' }, {
configVal: accessToken,
});
url = `https://openapi.baidu.com/rest/2.0/tongji/report/getData?access_token=${accessToken}&site_id=${baiduSiteId}&method=${method}&start_date=${start_date}&end_date=${end_date}&metrics=${metrics}`;
res = await axios_1.default.get(url);
({ error_code, message } = res.data);
}
else {
throw new common_1.HttpException('获取新 accessToken 失败', common_1.HttpStatus.BAD_REQUEST);
} }
};
res = await fetchData(accessToken);
if (res.data.error_code === 111 || !baiduToken) {
const { accessToken: newAccessToken, refreshToken: newRefreshToken } = await this.getNewAccessToken(baiduApiKey, baiduSecretKey, baiduRefreshToken);
accessToken = newAccessToken;
await this.updateAccessTokenInDatabase(accessToken, newRefreshToken, this.configEntity);
res = await fetchData(accessToken);
} }
const { error_code, message } = res.data;
if (error_code && error_code !== 200) { if (error_code && error_code !== 200) {
throw new common_1.HttpException(message || '获取百度统计数据失败', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException(message || '获取百度统计数据失败', common_1.HttpStatus.BAD_REQUEST);
} }

View File

@ -16,66 +16,75 @@ const ALIOSS = require("ali-oss");
const axios_1 = require("axios"); const axios_1 = require("axios");
const TENCENTCOS = require("cos-nodejs-sdk-v5"); const TENCENTCOS = require("cos-nodejs-sdk-v5");
const FormData = require("form-data"); const FormData = require("form-data");
const fs = require("fs"); const fs_1 = require("fs");
const path_1 = require("path"); const mime = require("mime-types");
const path = require("path");
const streamToBuffer = require("stream-to-buffer"); const streamToBuffer = require("stream-to-buffer");
const globalConfig_service_1 = require("../globalConfig/globalConfig.service"); const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
const blacklist = ['exe', 'sh', 'bat', 'js', 'php', 'py'];
let UploadService = class UploadService { let UploadService = class UploadService {
constructor(globalConfigService) { constructor(globalConfigService) {
this.globalConfigService = globalConfigService; this.globalConfigService = globalConfigService;
} }
onModuleInit() { } onModuleInit() { }
async uploadFile(file, dir = 'others') { async uploadFile(file, dir = 'others') {
const { filename: name, originalname, buffer, mimetype, } = file; const { buffer, mimetype } = file;
if (process.env.ISDEV) { if (process.env.ISDEV === 'TRUE') {
dir = `dev/${dir}`; dir = `dev/${dir}`;
} }
common_1.Logger.debug(`准备上传文件: ${dir}`, 'UploadService'); const fileExtension = mime.extension(mimetype) || '';
if (!fileExtension) {
common_1.Logger.error('无法识别文件类型,请检查文件', 'UploadService');
}
if (blacklist.includes(fileExtension.toLowerCase())) {
common_1.Logger.error('不允许上传此类型的文件', 'UploadService');
throw new Error('不允许上传此类型的文件');
}
const now = new Date(); const now = new Date();
const timestamp = now.getTime(); const timestamp = now.getTime();
const randomString = Math.random().toString(36).substring(2, 6); const randomString = Math.random().toString(36).substring(2, 6);
const fileType = mimetype ? mimetype.split('/')[1] : ''; const filename = `${timestamp}_${randomString}.${fileExtension}`;
const filename = `${timestamp}_${randomString}.${fileType}`;
common_1.Logger.debug(`准备上传文件: ${filename}, 类型: ${fileType}`, 'UploadService');
const { tencentCosStatus = 0, aliOssStatus = 0, cheveretoStatus = 0, } = await this.globalConfigService.getConfigs([ const { tencentCosStatus = 0, aliOssStatus = 0, cheveretoStatus = 0, } = await this.globalConfigService.getConfigs([
'tencentCosStatus', 'tencentCosStatus',
'aliOssStatus', 'aliOssStatus',
'cheveretoStatus', 'cheveretoStatus',
]); ]);
common_1.Logger.debug(`上传配置状态 - 腾讯云: ${tencentCosStatus}, 阿里云: ${aliOssStatus}, Chevereto: ${cheveretoStatus}`, 'UploadService'); common_1.Logger.log(`上传配置状态 - 腾讯云: ${tencentCosStatus}, 阿里云: ${aliOssStatus}, Chevereto: ${cheveretoStatus}`, 'UploadService');
if (!Number(tencentCosStatus) && if (!Number(tencentCosStatus) &&
!Number(aliOssStatus) && !Number(aliOssStatus) &&
!Number(cheveretoStatus)) { !Number(cheveretoStatus)) {
common_1.Logger.error('未配置任何上传方式', 'UploadService');
throw new common_1.HttpException('请先前往后台配置上传图片的方式', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('请先前往后台配置上传图片的方式', common_1.HttpStatus.BAD_REQUEST);
} }
try { try {
if (Number(tencentCosStatus)) { if (Number(tencentCosStatus)) {
common_1.Logger.debug(`使用腾讯云COS上传`, 'UploadService'); common_1.Logger.log('使用腾讯云 COS 上传文件', 'UploadService');
return await this.uploadFileByTencentCos({ const result = await this.uploadFileByTencentCos({
filename, filename,
buffer, buffer,
dir, dir,
fileType,
}); });
common_1.Logger.log(`文件已上传到腾讯云 COS。访问 URL: ${result}`, 'UploadService');
return result;
} }
if (Number(aliOssStatus)) { if (Number(aliOssStatus)) {
common_1.Logger.debug(`使用阿里云OSS上传`, 'UploadService'); common_1.Logger.log('使用阿里云 OSS 上传文件', 'UploadService');
return await this.uploadFileByAliOss({ const result = await this.uploadFileByAliOss({
filename, filename,
buffer, buffer,
dir, dir,
fileType,
}); });
common_1.Logger.log(`文件已上传到阿里云 OSS。访问 URL: ${result}`, 'UploadService');
return result;
} }
if (Number(cheveretoStatus)) { if (Number(cheveretoStatus)) {
common_1.Logger.debug(`使用Chevereto上传`, 'UploadService'); common_1.Logger.log('使用 Chevereto 上传文件', 'UploadService');
const { filename, buffer: fromBuffer, dir } = file; const result = await this.uploadFileByChevereto({
return await this.uploadFileByChevereto({
filename, filename,
buffer: fromBuffer.toString('base64'), buffer: buffer.toString('base64'),
dir,
fileType,
}); });
common_1.Logger.log(`文件已上传到 Chevereto。访问 URL: ${result}`, 'UploadService');
return result;
} }
} }
catch (error) { catch (error) {
@ -100,85 +109,13 @@ let UploadService = class UploadService {
} }
} }
async uploadFileFromUrl({ url, dir = 'others' }) { async uploadFileFromUrl({ url, dir = 'others' }) {
if (process.env.ISDEV) { if (process.env.ISDEV === 'TRUE') {
dir = `dev/${dir}`; dir = `dev/${dir}`;
} }
const now = new Date(); const { buffer, mimeType } = await this.getBufferFromUrl(url);
const timestamp = now.getTime(); return await this.uploadFile({ buffer, mimetype: mimeType }, dir);
const randomString = Math.random().toString(36).substring(2, 6);
const response = await axios_1.default.head(url);
const mimeType = response.headers['content-type'];
let fileExtension = '';
if (mimeType) {
const mimeTypeMap = {
'image/jpeg': 'jpg',
'image/png': 'png',
'image/gif': 'gif',
'image/webp': 'webp',
'image/bmp': 'bmp',
'image/svg+xml': 'svg',
'image/tiff': 'tiff',
'image/x-icon': 'ico',
'video/mp4': 'mp4',
'video/mpeg': 'mpeg',
'video/ogg': 'ogv',
'video/webm': 'webm',
'video/quicktime': 'mov',
'video/x-msvideo': 'avi',
'video/x-flv': 'flv',
'audio/mpeg': 'mp3',
'audio/ogg': 'ogg',
'audio/wav': 'wav',
'audio/x-wav': 'wav',
'audio/webm': 'weba',
'application/pdf': 'pdf',
'application/msword': 'doc',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',
'application/vnd.ms-excel': 'xls',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',
'application/vnd.ms-powerpoint': 'ppt',
'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'pptx',
'application/zip': 'zip',
'application/x-rar-compressed': 'rar',
'application/x-7z-compressed': '7z',
'text/plain': 'txt',
'text/html': 'html',
'text/css': 'css',
'text/javascript': 'js',
'application/json': 'json',
'application/xml': 'xml',
'application/octet-stream': 'bin',
'application/vnd.android.package-archive': 'apk',
'application/x-sh': 'sh',
};
fileExtension = mimeTypeMap[mimeType] || '';
}
const filename = fileExtension
? `${timestamp}_${randomString}.${fileExtension}`
: `${timestamp}_${randomString}`;
common_1.Logger.debug(`准备上传文件: ${filename}, URL: ${url}, 目录: ${dir}`, 'UploadService');
const { tencentCosStatus = 0, aliOssStatus = 0, cheveretoStatus = 0, } = await this.globalConfigService.getConfigs([
'tencentCosStatus',
'aliOssStatus',
'cheveretoStatus',
]);
if (!Number(tencentCosStatus) &&
!Number(aliOssStatus) &&
!Number(cheveretoStatus)) {
throw new common_1.HttpException('请先前往后台配置上传图片的方式', common_1.HttpStatus.BAD_REQUEST);
}
if (Number(tencentCosStatus)) {
return this.uploadFileByTencentCosFromUrl({ filename, url, dir });
}
if (Number(aliOssStatus)) {
const res = await this.uploadFileByAliOssFromUrl({ filename, url, dir });
return res;
}
if (Number(cheveretoStatus)) {
return await this.uploadFileByCheveretoFromUrl({ filename, url, dir });
}
} }
async uploadFileByTencentCos({ filename, buffer, dir, fileType }) { async uploadFileByTencentCos({ filename, buffer, dir }) {
const { Bucket, Region, SecretId, SecretKey } = await this.getUploadConfig('tencent'); const { Bucket, Region, SecretId, SecretKey } = await this.getUploadConfig('tencent');
this.tencentCos = new TENCENTCOS({ this.tencentCos = new TENCENTCOS({
SecretId, SecretId,
@ -187,11 +124,10 @@ let UploadService = class UploadService {
}); });
try { try {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const type = fileType || 'png';
this.tencentCos.putObject({ this.tencentCos.putObject({
Bucket: (0, utils_1.removeSpecialCharacters)(Bucket), Bucket: (0, utils_1.removeSpecialCharacters)(Bucket),
Region: (0, utils_1.removeSpecialCharacters)(Region), Region: (0, utils_1.removeSpecialCharacters)(Region),
Key: `${dir}/${filename || `${(0, utils_1.createRandomUid)()}.${fileType}`}`, Key: `${dir}/${filename}`,
StorageClass: 'STANDARD', StorageClass: 'STANDARD',
Body: buffer, Body: buffer,
}, async (err, data) => { }, async (err, data) => {
@ -214,28 +150,7 @@ let UploadService = class UploadService {
throw new common_1.HttpException('上传图片失败[ten]', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('上传图片失败[ten]', common_1.HttpStatus.BAD_REQUEST);
} }
} }
async uploadFileByTencentCosFromUrl({ filename, url, dir }) { async uploadFileByAliOss({ filename, buffer, dir }) {
const { Bucket, Region, SecretId, SecretKey } = await this.getUploadConfig('tencent');
this.tencentCos = new TENCENTCOS({
SecretId,
SecretKey,
FileParallelLimit: 10,
});
try {
const buffer = await this.getBufferFromUrl(url);
return await this.uploadFileByTencentCos({
filename,
buffer,
dir,
fileType: '',
});
}
catch (error) {
console.log('TODO->error: ', error);
throw new common_1.HttpException('上传图片失败[ten][url]', common_1.HttpStatus.BAD_REQUEST);
}
}
async uploadFileByAliOss({ filename, buffer, dir, fileType = 'png' }) {
const { region, bucket, accessKeyId, accessKeySecret } = await this.getUploadConfig('ali'); const { region, bucket, accessKeyId, accessKeySecret } = await this.getUploadConfig('ali');
const client = new ALIOSS({ const client = new ALIOSS({
region: (0, utils_1.removeSpecialCharacters)(region), region: (0, utils_1.removeSpecialCharacters)(region),
@ -247,7 +162,7 @@ let UploadService = class UploadService {
console.log('ali 开始上传'); console.log('ali 开始上传');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
client client
.put(`${dir}/${filename || `${(0, utils_1.createRandomUid)()}.${fileType}`}`, buffer) .put(`${dir}/${filename}`, buffer)
.then(async (result) => { .then(async (result) => {
const { acceleratedDomain } = await this.getUploadConfig('ali'); const { acceleratedDomain } = await this.getUploadConfig('ali');
if (acceleratedDomain) { if (acceleratedDomain) {
@ -265,46 +180,38 @@ let UploadService = class UploadService {
throw new common_1.HttpException('上传图片失败[ali]', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('上传图片失败[ali]', common_1.HttpStatus.BAD_REQUEST);
} }
} }
async uploadFileToLocalFromUrl({ filename, url, dir }) { async uploadFileToLocal({ filename, buffer, dir = 'others' }) {
const normalizedDir = path.normalize(dir).replace(/^(\.\.(\/|\\|$))+/, '');
const normalizedFilename = path.basename(filename);
const projectRoot = process.cwd();
const uploadDir = path.join(projectRoot, 'public', 'file', normalizedDir);
const filePath = path.join(uploadDir, normalizedFilename);
if (!filePath.startsWith(path.join(projectRoot, 'public', 'file'))) {
throw new Error('非法路径,禁止访问目录之外的位置');
}
try { try {
const buffer = await this.getBufferFromUrl(url); await fs_1.promises.mkdir(uploadDir, { recursive: true });
return await this.uploadFileToLocal({ filename, buffer, dir });
} }
catch (error) { catch (err) {
console.log('TODO->error: ', error); common_1.Logger.error(`创建目录失败: ${uploadDir}`, err);
throw new common_1.HttpException('上传图片失败[ten][url]', common_1.HttpStatus.BAD_REQUEST); throw err;
} }
} try {
async uploadFileToLocal({ filename, buffer, dir = 'ai' }) { await fs_1.promises.writeFile(filePath, buffer, { mode: 0o444 });
if (!filename || !buffer) {
throw new Error('必须提供文件名和文件内容');
} }
const appRoot = require('app-root-path'); catch (err) {
const uploadDir = path_1.default.join(appRoot.path, 'service', 'public', 'file'); common_1.Logger.error(`文件保存失败: ${filePath}`, err);
const filePath = path_1.default.join(uploadDir, filename); throw err;
if (!fs.existsSync(uploadDir)) { }
fs.mkdirSync(uploadDir, { recursive: true }); let fileUrl = `file/${normalizedDir}/${normalizedFilename}`;
common_1.Logger.log(`创建目录: ${uploadDir}`); const siteUrl = await this.globalConfigService.getConfigs(['siteUrl']);
if (siteUrl) {
const url = (0, utils_1.formatUrl)(siteUrl);
fileUrl = `${url}/${fileUrl}`;
} }
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; return fileUrl;
} }
async uploadFileByAliOssFromUrl({ filename, url, dir }) { async uploadFileByChevereto({ filename = '', buffer }) {
const { region, bucket, accessKeyId, accessKeySecret } = await this.getUploadConfig('ali');
const client = new ALIOSS({ region, accessKeyId, accessKeySecret, bucket });
try {
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);
}
}
async uploadFileByChevereto({ filename = '', buffer, dir = 'ai', fileType = 'png', }) {
var _a; var _a;
const { key, uploadPath } = await this.getUploadConfig('chevereto'); const { key, uploadPath } = await this.getUploadConfig('chevereto');
let url = uploadPath.endsWith('/') ? uploadPath.slice(0, -1) : uploadPath; let url = uploadPath.endsWith('/') ? uploadPath.slice(0, -1) : uploadPath;
@ -330,16 +237,6 @@ let UploadService = class UploadService {
throw new common_1.HttpException(`上传图片失败[Chevereto|buffer] --> ${(_a = error.response) === null || _a === void 0 ? void 0 : _a.data.error.message}`, common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException(`上传图片失败[Chevereto|buffer] --> ${(_a = error.response) === null || _a === void 0 ? void 0 : _a.data.error.message}`, common_1.HttpStatus.BAD_REQUEST);
} }
} }
async uploadFileByCheveretoFromUrl({ filename, url, dir }) {
try {
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);
}
}
async getUploadConfig(type) { async getUploadConfig(type) {
if (type === 'ali') { if (type === 'ali') {
const { aliOssRegion: region, aliOssBucket: bucket, aliOssAccessKeyId: accessKeyId, aliOssAccessKeySecret: accessKeySecret, aliOssAcceleratedDomain: acceleratedDomain, } = await this.globalConfigService.getConfigs([ const { aliOssRegion: region, aliOssBucket: bucket, aliOssAccessKeyId: accessKeyId, aliOssAccessKeySecret: accessKeySecret, aliOssAcceleratedDomain: acceleratedDomain, } = await this.globalConfigService.getConfigs([
@ -377,16 +274,18 @@ let UploadService = class UploadService {
} }
async getBufferFromUrl(url) { async getBufferFromUrl(url) {
const response = await axios_1.default.get(url, { responseType: 'stream' }); const response = await axios_1.default.get(url, { responseType: 'stream' });
return new Promise((resolve, reject) => { const buffer = await new Promise((resolve, reject) => {
streamToBuffer(response.data, (err, buffer) => { streamToBuffer(response.data, (err, buffer) => {
if (err) { if (err) {
throw new common_1.HttpException('获取图片资源失败请重新试试吧!', common_1.HttpStatus.BAD_REQUEST); reject(new common_1.HttpException('获取图片资源失败请重新试试吧!', common_1.HttpStatus.BAD_REQUEST));
} }
else { else {
resolve(buffer); resolve(buffer);
} }
}); });
}); });
const mimeType = response.headers['content-type'];
return { buffer, mimeType };
} }
}; };
UploadService = __decorate([ UploadService = __decorate([

View File

@ -207,6 +207,11 @@ let UserService = class UserService {
userInfo.isBindWx = !!(userInfo === null || userInfo === void 0 ? void 0 : userInfo.openId); userInfo.isBindWx = !!(userInfo === null || userInfo === void 0 ? void 0 : userInfo.openId);
delete userInfo.openId; delete userInfo.openId;
const userBalance = await this.userBalanceService.queryUserBalance(userId); const userBalance = await this.userBalanceService.queryUserBalance(userId);
const processedId = (userId * 123 + 100000000)
.toString(36)
.toUpperCase()
.slice(-6);
userInfo.id = processedId;
return { userInfo, userBalance: Object.assign({}, userBalance) }; return { userInfo, userBalance: Object.assign({}, userBalance) };
} }
async getUserById(id) { async getUserById(id) {

View File

@ -171,11 +171,11 @@ let UserBalanceService = class UserBalanceService {
: null; : null;
if (b.packageId && b[memberKey] + b[baseKey] < amount) { if (b.packageId && b[memberKey] + b[baseKey] < amount) {
if (b[baseKey] < amount) { if (b[baseKey] < amount) {
throw new common_1.HttpException(`您的账户余额不足,如果想继续体验服务,请联系管理员或购买专属套餐 `, common_1.HttpStatus.PAYMENT_REQUIRED); throw new common_1.HttpException(`积分不足,继续体验服务,请按需选购套餐`, common_1.HttpStatus.PAYMENT_REQUIRED);
} }
} }
if (!b.packageId && b[baseKey] < amount) { if (!b.packageId && b[baseKey] < amount) {
throw new common_1.HttpException(`您的账户余额不足,如果想继续体验服务,请联系管理员或购买专属套餐 `, common_1.HttpStatus.PAYMENT_REQUIRED); throw new common_1.HttpException(`积分不足,继续体验服务,请按需选购套餐`, common_1.HttpStatus.PAYMENT_REQUIRED);
} }
return b; return b;
} }
@ -211,7 +211,7 @@ let UserBalanceService = class UserBalanceService {
}; };
data[baseKey] = data[baseKey] + amount; data[baseKey] = data[baseKey] + amount;
if (data[baseKey] > settings[baseKey]) { if (data[baseKey] > settings[baseKey]) {
throw new common_1.HttpException(`今日当前类型免费额度已经使用完毕、建议您注册账户体验更加完整的服务内容`, common_1.HttpStatus.PAYMENT_REQUIRED); throw new common_1.HttpException(`今日体验额度使用完毕,请注册使用完整服务`, common_1.HttpStatus.PAYMENT_REQUIRED);
} }
else { else {
await this.fingerprintLogEntity.save(data); await this.fingerprintLogEntity.save(data);
@ -239,7 +239,7 @@ let UserBalanceService = class UserBalanceService {
data[baseKey] = data[baseKey] + amount; data[baseKey] = data[baseKey] + amount;
} }
if (data[baseKey] > settings[baseKey]) { if (data[baseKey] > settings[baseKey]) {
throw new common_1.HttpException(`今日当前类型免费额度已经使用完毕、建议您注册账户体验更加完整的服务内容`, common_1.HttpStatus.PAYMENT_REQUIRED); throw new common_1.HttpException(`今日体验额度使用完毕,请注册使用完整服务`, common_1.HttpStatus.PAYMENT_REQUIRED);
} }
else { else {
await this.fingerprintLogEntity.update({ fingerprint: id }, data); await this.fingerprintLogEntity.update({ fingerprint: id }, data);

View File

@ -29,8 +29,12 @@ let VerificationService = class VerificationService {
this.redisCacheService = redisCacheService; this.redisCacheService = redisCacheService;
} }
async createVerification(user, type, expir = 30 * 60) { async createVerification(user, type, expir = 30 * 60) {
const historyVerify = await this.verifycationEntity.findOne({ where: { userId: user.id, type }, order: { createdAt: 'DESC' } }); const historyVerify = await this.verifycationEntity.findOne({
if (historyVerify && historyVerify.createdAt.getTime() + 1 * 60 * 1000 > Date.now()) { where: { userId: user.id, type },
order: { createdAt: 'DESC' },
});
if (historyVerify &&
historyVerify.createdAt.getTime() + 1 * 60 * 1000 > Date.now()) {
const diffS = Math.ceil((historyVerify.createdAt.getTime() + 1 * 60 * 1000 - Date.now()) / 1000); const diffS = Math.ceil((historyVerify.createdAt.getTime() + 1 * 60 * 1000 - Date.now()) / 1000);
throw new common_1.HttpException(`${diffS}S内不得重新发送`, common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException(`${diffS}S内不得重新发送`, common_1.HttpStatus.BAD_REQUEST);
} }
@ -41,7 +45,10 @@ let VerificationService = class VerificationService {
return await this.verifycationEntity.save(verifycation); return await this.verifycationEntity.save(verifycation);
} }
async verifyCode({ code, id }, type) { async verifyCode({ code, id }, type) {
const v = await this.verifycationEntity.findOne({ where: { id, type }, order: { createdAt: 'DESC' } }); const v = await this.verifycationEntity.findOne({
where: { id, type },
order: { createdAt: 'DESC' },
});
if (!v) { if (!v) {
throw new common_1.HttpException('验证码不存在', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('验证码不存在', common_1.HttpStatus.BAD_REQUEST);
} }
@ -60,29 +67,26 @@ let VerificationService = class VerificationService {
} }
return v; return v;
} }
async verifyCaptcha(body) {
const { captchaId, captchaCode } = body;
const nameSpace = await this.globalConfigService.getNamespace();
const key = `${nameSpace}:CAPTCHA:${captchaId}`;
const code = await this.redisCacheService.get({ key });
await this.redisCacheService.del({ key });
if (!code) {
throw new common_1.HttpException('图形验证码已过期、请重新输入!', common_1.HttpStatus.BAD_REQUEST);
}
if (!code || code !== captchaCode) {
throw new common_1.HttpException('图形验证码错误、请检查填写!', common_1.HttpStatus.BAD_REQUEST);
}
}
async sendPhoneCode(messageInfo) { async sendPhoneCode(messageInfo) {
var _a; var _a;
const { accessKeyId, accessKeySecret, SignName, TemplateCode } = await this.globalConfigService.getPhoneVerifyConfig(); const { accessKeyId, accessKeySecret, SignName, TemplateCode } = await this.globalConfigService.getPhoneVerifyConfig();
console.log("Received messageInfo:", messageInfo); console.log('Received messageInfo:', messageInfo);
const { phone, code } = messageInfo; const { phone, code } = messageInfo;
if (!phone || !code) { if (!phone || !code) {
throw new common_1.HttpException('确实必要参数错误!', common_1.HttpStatus.BAD_REQUEST); throw new common_1.HttpException('确实必要参数错误!', common_1.HttpStatus.BAD_REQUEST);
} }
const client = new Core({ accessKeyId, accessKeySecret, endpoint: 'https://dysmsapi.aliyuncs.com', apiVersion: '2017-05-25' }); const client = new Core({
const params = { PhoneNumbers: phone, SignName, TemplateCode, TemplateParam: JSON.stringify({ code }) }; accessKeyId,
accessKeySecret,
endpoint: 'https://dysmsapi.aliyuncs.com',
apiVersion: '2017-05-25',
});
const params = {
PhoneNumbers: phone,
SignName,
TemplateCode,
TemplateParam: JSON.stringify({ code }),
};
const requestOption = { method: 'POST', formatParams: false }; const requestOption = { method: 'POST', formatParams: false };
try { try {
const response = await client.request('SendSms', params, requestOption); const response = await client.request('SendSms', params, requestOption);

View File

@ -1,6 +1,6 @@
{ {
"name": "99ai", "name": "99ai",
"version": "3.5.0", "version": "3.7.0",
"description": "", "description": "",
"author": "vastxie", "author": "vastxie",
"private": true, "private": true,
@ -27,30 +27,23 @@
}, },
"dependencies": { "dependencies": {
"@alicloud/pop-core": "^1.7.13", "@alicloud/pop-core": "^1.7.13",
"@dqbd/tiktoken": "^1.0.15",
"@keyv/redis": "^2.8.5",
"@nestjs/bull": "^0.6.3", "@nestjs/bull": "^0.6.3",
"@nestjs/common": "^9.4.3", "@nestjs/common": "^9.4.3",
"@nestjs/config": "^3.2.2",
"@nestjs/core": "^9.4.3", "@nestjs/core": "^9.4.3",
"@nestjs/jwt": "^10.2.0", "@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^9.0.3", "@nestjs/passport": "^9.0.3",
"@nestjs/platform-express": "^9.4.3", "@nestjs/platform-express": "^9.4.3",
"@nestjs/platform-socket.io": "^10.3.9",
"@nestjs/schedule": "^2.2.3", "@nestjs/schedule": "^2.2.3",
"@nestjs/serve-static": "^4.0.2", "@nestjs/serve-static": "^4.0.2",
"@nestjs/swagger": "^6.3.0", "@nestjs/swagger": "^6.3.0",
"@nestjs/typeorm": "^9.0.1", "@nestjs/typeorm": "^9.0.1",
"@nestjs/websockets": "^10.3.9", "@nestjs/websockets": "^10.3.9",
"@types/cache-manager-redis-store": "^2.0.4",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"ali-oss": "^6.20.0", "ali-oss": "^6.20.0",
"app-root-path": "^3.1.0",
"axios": "^1.7.2", "axios": "^1.7.2",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"bull": "^4.14.0", "bull": "^4.14.0",
"cache-manager-redis-store": "^3.0.1",
"class-transformer": "^0.5.1", "class-transformer": "^0.5.1",
"class-validator": "^0.14.1", "class-validator": "^0.14.1",
"compression": "^1.7.4", "compression": "^1.7.4",
@ -58,57 +51,41 @@
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"eventsource": "^2.0.2",
"exceljs": "^4.4.0", "exceljs": "^4.4.0",
"express": "^4.19.2", "express": "^4.19.2",
"express-xml-bodyparser": "^0.3.0", "express-xml-bodyparser": "^0.3.0",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"gpt-tokenizer": "^2.2.1",
"guid-typescript": "^1.0.9", "guid-typescript": "^1.0.9",
"handlebars": "^4.7.8",
"hbs": "^4.2.0",
"image-size": "^1.1.1", "image-size": "^1.1.1",
"ioredis": "^5.4.1", "ioredis": "^5.4.1",
"isomorphic-fetch": "^3.0.0", "isomorphic-fetch": "^3.0.0",
"javascript-obfuscator": "^4.1.1", "javascript-obfuscator": "^4.1.1",
"jimp": "^0.22.12",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"keyv": "^4.5.4",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"microsoft-cognitiveservices-speech-sdk": "^1.38.0", "mime-types": "^2.1.35",
"mysql2": "^3.10.1", "mysql2": "^3.10.1",
"nestjs-config": "^1.4.11",
"nestjs-rate-limiter": "^3.1.0",
"nestjs-redis": "^1.3.3",
"node-fetch": "^3.3.2",
"nodemailer": "^6.9.14", "nodemailer": "^6.9.14",
"passport": "^0.6.0", "passport": "^0.6.0",
"passport-jwt": "^4.0.1", "passport-jwt": "^4.0.1",
"qs": "^6.12.3",
"redis": "^4.6.14", "redis": "^4.6.14",
"reflect-metadata": "^0.1.14", "reflect-metadata": "^0.1.14",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"stream-to-buffer": "^0.1.0", "stream-to-buffer": "^0.1.0",
"svg-captcha": "^1.4.0",
"swagger-ui-express": "^4.6.3",
"typeorm": "^0.3.20", "typeorm": "^0.3.20",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"wechatpay-node-v3": "^2.2.0" "wechatpay-node-v3": "^2.2.0"
}, },
"devDependencies": { "devDependencies": {
"@nestjs/cli": "^9.5.0", "@nestjs/cli": "^9.5.0",
"@nestjs/schematics": "^9.2.0",
"@nestjs/testing": "^9.4.3", "@nestjs/testing": "^9.4.3",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/jest": "29.2.4",
"@types/node": "18.11.18", "@types/node": "18.11.18",
"@types/supertest": "^2.0.16",
"jest": "29.3.1", "jest": "29.3.1",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"source-map-support": "^0.5.21",
"supertest": "^6.3.4",
"ts-jest": "29.0.3", "ts-jest": "29.0.3",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"tsconfig-paths": "4.1.1",
"typescript": "^4.9.5" "typescript": "^4.9.5"
}, },
"jest": { "jest": {

View File

@ -3,7 +3,7 @@
"name": "99AI", "name": "99AI",
"script": "./dist/main.js", "script": "./dist/main.js",
"watch": true, "watch": true,
"ignore_watch": ["node_modules", "logs"], "ignore_watch": ["node_modules", "logs", "public/file"],
"env": { "env": {
"TZ": "Asia/Shanghai" "TZ": "Asia/Shanghai"
}, },

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as f}from"./index-DEc4xym2.js";export{f as default}; import{_ as f}from"./index-CAe0BuuW.js";export{f as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as m}from"./HCheckList.vue_vue_type_script_setup_true_lang-CJCRoI9L.js";import"./index-DEc4xym2.js";export{m as default}; import{_ as m}from"./HCheckList.vue_vue_type_script_setup_true_lang-Sefr8RNZ.js";import"./index-CAe0BuuW.js";export{m as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as u,av as n,aw as m,Z as b,g as a,c as t,F as o,s as p,Q as _,z as g,h,t as v,j as f}from"./index-DEc4xym2.js";const k={class:"inline-flex select-none items-center justify-center of-hidden rounded-md bg-stone-3 dark-bg-stone-7"},y=["disabled","onClick"],V=u({__name:"HCheckList",props:n({options:{},disabled:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:n(["change"],["update:modelValue"]),setup(i,{emit:d}){const r=d,l=m(i,"modelValue");return b(l,s=>{r("change",s)}),(s,x)=>{const c=f;return a(),t("div",k,[(a(!0),t(o,null,p(s.options,e=>(a(),t("button",{key:e.value,disabled:s.disabled||e.disabled,class:_(["flex cursor-pointer items-center truncate border-size-0 bg-inherit px-2 py-1.5 text-sm disabled-cursor-not-allowed disabled-opacity-50 hover-not-disabled-bg-ui-primary hover-not-disabled-text-ui-text",{"text-ui-text bg-ui-primary":l.value===e.value}]),onClick:C=>l.value=e.value},[e.icon?(a(),g(c,{key:0,name:e.icon},null,8,["name"])):(a(),t(o,{key:1},[h(v(e.label),1)],64))],10,y))),128))])}}});export{V as _}; import{d as u,av as n,aw as m,Z as b,g as a,c as t,F as o,s as p,Q as _,z as g,h,t as v,j as f}from"./index-CAe0BuuW.js";const k={class:"inline-flex select-none items-center justify-center of-hidden rounded-md bg-stone-3 dark-bg-stone-7"},y=["disabled","onClick"],V=u({__name:"HCheckList",props:n({options:{},disabled:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:n(["change"],["update:modelValue"]),setup(i,{emit:d}){const r=d,l=m(i,"modelValue");return b(l,s=>{r("change",s)}),(s,x)=>{const c=f;return a(),t("div",k,[(a(!0),t(o,null,p(s.options,e=>(a(),t("button",{key:e.value,disabled:s.disabled||e.disabled,class:_(["flex cursor-pointer items-center truncate border-size-0 bg-inherit px-2 py-1.5 text-sm disabled-cursor-not-allowed disabled-opacity-50 hover-not-disabled-bg-ui-primary hover-not-disabled-text-ui-text",{"text-ui-text bg-ui-primary":l.value===e.value}]),onClick:C=>l.value=e.value},[e.icon?(a(),g(c,{key:0,name:e.icon},null,8,["name"])):(a(),t(o,{key:1},[h(v(e.label),1)],64))],10,y))),128))])}}});export{V as _};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as m}from"./HDialog.vue_vue_type_script_setup_true_lang-mVa91NJt.js";import"./index-DEc4xym2.js";export{m as default}; import{_ as m}from"./HDialog.vue_vue_type_script_setup_true_lang-DFArSwGc.js";import"./index-CAe0BuuW.js";export{m as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as w,av as i,aw as h,O as b,r as k,p as C,g as p,z as B,w as t,b as s,i as e,ak as d,X as c,e as o,Q as V,al as T,ax as S,h as j,t as F,an as N,P as u,c as $,A as z,ap as M,aq as D,j as O}from"./index-DEc4xym2.js";const P={class:"fixed inset-0 overflow-y-auto"},q={class:"min-h-full flex items-end justify-center p-4 text-center lg-items-center"},A={flex:"~ items-center justify-between","px-4":"","py-3":"","border-b":"~ solid stone/15","text-6":""},E={key:0,flex:"~ items-center justify-end","px-4":"","py-3":"","border-t":"~ solid stone/15"},I=w({__name:"HDialog",props:i({appear:{type:Boolean,default:!1},title:{},preventClose:{type:Boolean,default:!1},overlay:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:i(["close"],["update:modelValue"]),setup(f,{emit:m}){const y=m,l=h(f,"modelValue"),v=b(),g=k({enter:"ease-in-out duration-500",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in-out duration-500",leaveFrom:"opacity-100",leaveTo:"opacity-0"}),x=C(()=>({enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 lg-translate-y-0 lg-scale-95",enterTo:"opacity-100 translate-y-0 lg-scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 lg-scale-100",leaveTo:"opacity-0 translate-y-4 lg-translate-y-0 lg-scale-95"}));function r(){l.value=!1,y("close")}return(a,n)=>{const _=O;return p(),B(e(D),{as:"template",appear:a.appear,show:l.value},{default:t(()=>[s(e(M),{class:"fixed inset-0 z-2000 flex",onClose:n[0]||(n[0]=G=>!a.preventClose&&r())},{default:t(()=>[s(e(d),c({as:"template",appear:a.appear},e(g)),{default:t(()=>[o("div",{class:V(["fixed inset-0 bg-stone-2/75 transition-opacity dark-bg-stone-8/75",{"backdrop-blur-sm":a.overlay}])},null,2)]),_:1},16,["appear"]),o("div",P,[o("div",q,[s(e(d),c({as:"template",appear:a.appear},e(x)),{default:t(()=>[s(e(T),{class:"relative w-full flex flex-col overflow-hidden rounded-xl bg-white text-left shadow-xl lg-my-8 lg-max-w-lg dark-bg-stone-8"},{default:t(()=>[o("div",A,[s(e(S),{"m-0":"","text-lg":"","text-dark":"","dark-text-white":""},{default:t(()=>[j(F(a.title),1)]),_:1}),s(_,{name:"i-carbon:close","cursor-pointer":"",onClick:r})]),s(e(N),{"m-0":"","overflow-y-auto":"","p-4":""},{default:t(()=>[u(a.$slots,"default")]),_:3}),e(v).footer?(p(),$("div",E,[u(a.$slots,"footer")])):z("",!0)]),_:3})]),_:3},16,["appear"])])])]),_:3})]),_:3},8,["appear","show"])}}});export{I as _}; import{d as w,av as i,aw as h,O as b,r as k,p as C,g as p,z as B,w as t,b as s,i as e,ak as d,X as c,e as o,Q as V,al as T,ax as S,h as j,t as F,an as N,P as u,c as $,A as z,ap as M,aq as D,j as O}from"./index-CAe0BuuW.js";const P={class:"fixed inset-0 overflow-y-auto"},q={class:"min-h-full flex items-end justify-center p-4 text-center lg-items-center"},A={flex:"~ items-center justify-between","px-4":"","py-3":"","border-b":"~ solid stone/15","text-6":""},E={key:0,flex:"~ items-center justify-end","px-4":"","py-3":"","border-t":"~ solid stone/15"},I=w({__name:"HDialog",props:i({appear:{type:Boolean,default:!1},title:{},preventClose:{type:Boolean,default:!1},overlay:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:i(["close"],["update:modelValue"]),setup(f,{emit:m}){const y=m,l=h(f,"modelValue"),v=b(),g=k({enter:"ease-in-out duration-500",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in-out duration-500",leaveFrom:"opacity-100",leaveTo:"opacity-0"}),x=C(()=>({enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 lg-translate-y-0 lg-scale-95",enterTo:"opacity-100 translate-y-0 lg-scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 lg-scale-100",leaveTo:"opacity-0 translate-y-4 lg-translate-y-0 lg-scale-95"}));function r(){l.value=!1,y("close")}return(a,n)=>{const _=O;return p(),B(e(D),{as:"template",appear:a.appear,show:l.value},{default:t(()=>[s(e(M),{class:"fixed inset-0 z-2000 flex",onClose:n[0]||(n[0]=G=>!a.preventClose&&r())},{default:t(()=>[s(e(d),c({as:"template",appear:a.appear},e(g)),{default:t(()=>[o("div",{class:V(["fixed inset-0 bg-stone-2/75 transition-opacity dark-bg-stone-8/75",{"backdrop-blur-sm":a.overlay}])},null,2)]),_:1},16,["appear"]),o("div",P,[o("div",q,[s(e(d),c({as:"template",appear:a.appear},e(x)),{default:t(()=>[s(e(T),{class:"relative w-full flex flex-col overflow-hidden rounded-xl bg-white text-left shadow-xl lg-my-8 lg-max-w-lg dark-bg-stone-8"},{default:t(()=>[o("div",A,[s(e(S),{"m-0":"","text-lg":"","text-dark":"","dark-text-white":""},{default:t(()=>[j(F(a.title),1)]),_:1}),s(_,{name:"i-carbon:close","cursor-pointer":"",onClick:r})]),s(e(N),{"m-0":"","overflow-y-auto":"","p-4":""},{default:t(()=>[u(a.$slots,"default")]),_:3}),e(v).footer?(p(),$("div",E,[u(a.$slots,"footer")])):z("",!0)]),_:3})]),_:3},16,["appear"])])])]),_:3})]),_:3},8,["appear","show"])}}});export{I as _};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{l as t,n,g as a,z as p,w as o,P as r,X as d}from"./index-DEc4xym2.js";const l={};function c(e,_){const s=n("VDropdown");return a(),p(s,d({"show-triggers":["hover"],"hide-triggers":["hover"],"auto-hide":!1,"popper-triggers":["hover"],delay:200},e.$attrs),{popper:o(()=>[r(e.$slots,"dropdown")]),default:o(()=>[r(e.$slots,"default")]),_:3},16)}const f=t(l,[["render",c]]);export{f as default}; import{l as t,n,g as a,z as p,w as o,P as r,X as d}from"./index-CAe0BuuW.js";const l={};function c(e,_){const s=n("VDropdown");return a(),p(s,d({"show-triggers":["hover"],"hide-triggers":["hover"],"auto-hide":!1,"popper-triggers":["hover"],delay:200},e.$attrs),{popper:o(()=>[r(e.$slots,"dropdown")]),default:o(()=>[r(e.$slots,"default")]),_:3},16)}const f=t(l,[["render",c]]);export{f as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as m}from"./HDropdownMenu.vue_vue_type_script_setup_true_lang-lZ406Ra4.js";import"./index-DEc4xym2.js";export{m as default}; import{_ as m}from"./HDropdownMenu.vue_vue_type_script_setup_true_lang-DvGMfvHr.js";import"./index-CAe0BuuW.js";export{m as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as h,p as g,n as k,g as t,z as f,w as n,c as s,s as a,i as _,F as l,P as w,X as y,t as x}from"./index-DEc4xym2.js";const C=["disabled","onClick"],z=h({__name:"HDropdownMenu",props:{items:{}},setup(d){const i=d,p=g(()=>i.items.map(e=>e.filter(o=>!o.hide)).filter(e=>e.length));return(e,o)=>{const c=k("VMenu");return t(),f(c,y({"show-triggers":["hover"],"auto-hide":!1,"popper-triggers":["hover","click"],delay:200},e.$attrs),{popper:n(()=>[(t(!0),s(l,null,a(_(p),(u,b)=>(t(),s("div",{key:b,class:"b-b-stone-2 b-b-solid p-1 last-b-b-size-0 dark-b-b-stone-7"},[(t(!0),s(l,null,a(u,(r,m)=>(t(),s("button",{key:m,disabled:r.disabled,class:"w-full flex cursor-pointer items-center gap-2 border-size-0 rounded-md bg-inherit px-2 py-1.5 text-sm text-dark disabled-cursor-not-allowed dark-text-white disabled-opacity-50 hover-not-disabled-bg-stone-1 dark-hover-not-disabled-bg-stone-9",onClick:r.handle},x(r.label),9,C))),128))]))),128))]),default:n(()=>[w(e.$slots,"default")]),_:3},16)}}});export{z as _}; import{d as h,p as g,n as k,g as t,z as f,w as n,c as s,s as a,i as _,F as l,P as w,X as y,t as x}from"./index-CAe0BuuW.js";const C=["disabled","onClick"],z=h({__name:"HDropdownMenu",props:{items:{}},setup(d){const i=d,p=g(()=>i.items.map(e=>e.filter(o=>!o.hide)).filter(e=>e.length));return(e,o)=>{const c=k("VMenu");return t(),f(c,y({"show-triggers":["hover"],"auto-hide":!1,"popper-triggers":["hover","click"],delay:200},e.$attrs),{popper:n(()=>[(t(!0),s(l,null,a(_(p),(u,b)=>(t(),s("div",{key:b,class:"b-b-stone-2 b-b-solid p-1 last-b-b-size-0 dark-b-b-stone-7"},[(t(!0),s(l,null,a(u,(r,m)=>(t(),s("button",{key:m,disabled:r.disabled,class:"w-full flex cursor-pointer items-center gap-2 border-size-0 rounded-md bg-inherit px-2 py-1.5 text-sm text-dark disabled-cursor-not-allowed dark-text-white disabled-opacity-50 hover-not-disabled-bg-stone-1 dark-hover-not-disabled-bg-stone-9",onClick:r.handle},x(r.label),9,C))),128))]))),128))]),default:n(()=>[w(e.$slots,"default")]),_:3},16)}}});export{z as _};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as m}from"./HInput.vue_vue_type_script_setup_true_lang-CdqOxX3g.js";import"./index-DEc4xym2.js";export{m as default}; import{_ as m}from"./HInput.vue_vue_type_script_setup_true_lang-DIeRn7Zh.js";import"./index-CAe0BuuW.js";export{m as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as r,av as n,aw as i,r as u,g as p,c,y as m,am as f,e as g}from"./index-DEc4xym2.js";const b={class:"relative w-full lg-w-48"},h=["placeholder","disabled"],w=r({__name:"HInput",props:n({placeholder:{},disabled:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:s}){const e=i(o,"modelValue"),d=u();return s({ref:d}),(l,a)=>(p(),c("div",b,[m(g("input",{"onUpdate:modelValue":a[0]||(a[0]=t=>e.value=t),type:"text",placeholder:l.placeholder,disabled:l.disabled,class:"relative block w-full border-0 rounded-md bg-white px-2.5 py-1.5 text-sm shadow-sm ring-1 ring-stone-2 ring-inset disabled-cursor-not-allowed dark-bg-dark disabled-opacity-50 focus-outline-none focus-ring-2 dark-ring-stone-8 focus-ring-ui-primary placeholder-stone-4 dark-placeholder-stone-5"},null,8,h),[[f,e.value]])]))}});export{w as _}; import{d as r,av as n,aw as i,r as u,g as p,c,y as m,am as f,e as g}from"./index-CAe0BuuW.js";const b={class:"relative w-full lg-w-48"},h=["placeholder","disabled"],w=r({__name:"HInput",props:n({placeholder:{},disabled:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:s}){const e=i(o,"modelValue"),d=u();return s({ref:d}),(l,a)=>(p(),c("div",b,[m(g("input",{"onUpdate:modelValue":a[0]||(a[0]=t=>e.value=t),type:"text",placeholder:l.placeholder,disabled:l.disabled,class:"relative block w-full border-0 rounded-md bg-white px-2.5 py-1.5 text-sm shadow-sm ring-1 ring-stone-2 ring-inset disabled-cursor-not-allowed dark-bg-dark disabled-opacity-50 focus-outline-none focus-ring-2 dark-ring-stone-8 focus-ring-ui-primary placeholder-stone-4 dark-placeholder-stone-5"},null,8,h),[[f,e.value]])]))}});export{w as _};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{l as t,g as n,c as r,P as s}from"./index-DEc4xym2.js";const o={},a={class:"mr-[4px] h-6 min-w-[24px] inline-flex items-center justify-center rounded bg-stone-1 px-1 text-[12px] text-dark font-medium font-sans ring-1 ring-stone-3 ring-inset last:mr-0 dark-bg-dark-9 dark-text-white dark-ring-stone-7"};function c(e,i){return n(),r("kbd",a,[s(e.$slots,"default")])}const l=t(o,[["render",c]]);export{l as default}; import{l as t,g as n,c as r,P as s}from"./index-CAe0BuuW.js";const o={},a={class:"mr-[4px] h-6 min-w-[24px] inline-flex items-center justify-center rounded bg-stone-1 px-1 text-[12px] text-dark font-medium font-sans ring-1 ring-stone-3 ring-inset last:mr-0 dark-bg-dark-9 dark-text-white dark-ring-stone-7"};function c(e,i){return n(),r("kbd",a,[s(e.$slots,"default")])}const l=t(o,[["render",c]]);export{l as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as b,av as m,aw as f,p as g,n as v,g as l,z as h,w as r,e as o,c as i,s as _,F as w,t as c,i as k,b as x,X as y,j as V,Q as C}from"./index-DEc4xym2.js";const B={class:"w-full inline-flex"},M=["disabled"],z={class:"block truncate"},S={class:"pointer-events-none absolute end-0 inset-y-0 flex items-center pe-2.5"},$={class:"max-h-60 w-full scroll-py-1 overflow-y-auto p-1 lg-w-48 focus-outline-none"},F=["disabled","onClick"],E=b({__name:"HSelect",props:m({options:{},disabled:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,n=f(t,"modelValue"),d=g({get(){return a.options.find(e=>e.value===n.value)??a.options[0]},set(e){n.value=e.value}});return(e,N)=>{const u=V,p=v("VMenu");return l(),h(p,y({triggers:["click"],"popper-triggers":["click"],delay:0,disabled:e.disabled},e.$attrs),{popper:r(()=>[o("div",$,[(l(!0),i(w,null,_(e.options,s=>(l(),i("button",{key:s.value,disabled:s.disabled,class:C(["w-full cursor-pointer truncate border-size-0 rounded-md bg-inherit px-2 py-1.5 text-left text-sm disabled-cursor-not-allowed hover-not-disabled-bg-stone-1 dark-hover-not-disabled-bg-stone-9",{"font-bold":t.modelValue===s.value}]),onClick:j=>d.value=s},c(s.label),11,F))),128))])]),default:r(()=>[o("div",B,[o("button",{class:"relative block w-full flex cursor-default items-center gap-x-2 border-0 rounded-md bg-white px-2.5 py-1.5 pe-9 text-left text-sm shadow-sm ring-1 ring-stone-2 ring-inset lg-w-48 disabled-cursor-not-allowed dark-bg-dark focus-outline-none focus-ring-2 dark-ring-stone-8 focus-ring-ui-primary",disabled:e.disabled},[o("span",z,c(k(d).label),1),o("span",S,[x(u,{name:"i-carbon:chevron-down",class:"h-5 w-5 flex-shrink-0 text-stone-5"})])],8,M)])]),_:1},16,["disabled"])}}});export{E as default}; import{d as b,av as m,aw as f,p as g,n as v,g as l,z as h,w as r,e as o,c as i,s as _,F as w,t as c,i as k,b as x,X as y,j as V,Q as C}from"./index-CAe0BuuW.js";const B={class:"w-full inline-flex"},M=["disabled"],z={class:"block truncate"},S={class:"pointer-events-none absolute end-0 inset-y-0 flex items-center pe-2.5"},$={class:"max-h-60 w-full scroll-py-1 overflow-y-auto p-1 lg-w-48 focus-outline-none"},F=["disabled","onClick"],E=b({__name:"HSelect",props:m({options:{},disabled:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,n=f(t,"modelValue"),d=g({get(){return a.options.find(e=>e.value===n.value)??a.options[0]},set(e){n.value=e.value}});return(e,N)=>{const u=V,p=v("VMenu");return l(),h(p,y({triggers:["click"],"popper-triggers":["click"],delay:0,disabled:e.disabled},e.$attrs),{popper:r(()=>[o("div",$,[(l(!0),i(w,null,_(e.options,s=>(l(),i("button",{key:s.value,disabled:s.disabled,class:C(["w-full cursor-pointer truncate border-size-0 rounded-md bg-inherit px-2 py-1.5 text-left text-sm disabled-cursor-not-allowed hover-not-disabled-bg-stone-1 dark-hover-not-disabled-bg-stone-9",{"font-bold":t.modelValue===s.value}]),onClick:j=>d.value=s},c(s.label),11,F))),128))])]),default:r(()=>[o("div",B,[o("button",{class:"relative block w-full flex cursor-default items-center gap-x-2 border-0 rounded-md bg-white px-2.5 py-1.5 pe-9 text-left text-sm shadow-sm ring-1 ring-stone-2 ring-inset lg-w-48 disabled-cursor-not-allowed dark-bg-dark focus-outline-none focus-ring-2 dark-ring-stone-8 focus-ring-ui-primary",disabled:e.disabled},[o("span",z,c(k(d).label),1),o("span",S,[x(u,{name:"i-carbon:chevron-down",class:"h-5 w-5 flex-shrink-0 text-stone-5"})])],8,M)])]),_:1},16,["disabled"])}}});export{E as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{cA as f}from"./index-DEc4xym2.js";export{f as default}; import{cA as f}from"./index-CAe0BuuW.js";export{f as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as o}from"./HTabList.vue_vue_type_script_setup_true_lang-DI-mkQdU.js";import"./index-DEc4xym2.js";import"./use-resolve-button-type-Cmxb6e8K.js";export{o as default}; import{_ as o}from"./HTabList.vue_vue_type_script_setup_true_lang-DVNTO8pP.js";import"./index-CAe0BuuW.js";import"./use-resolve-button-type-CIWo_h_W.js";export{o as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as o}from"./HToggle.vue_vue_type_script_setup_true_lang-BA9baXHJ.js";import"./index-DEc4xym2.js";import"./use-resolve-button-type-Cmxb6e8K.js";export{o as default}; import{_ as o}from"./HToggle.vue_vue_type_script_setup_true_lang-BMpWofWF.js";import"./index-CAe0BuuW.js";import"./use-resolve-button-type-CIWo_h_W.js";export{o as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{r as V,p as i,d as x,cs as D,$ as M,co as P,a as U,Z as A,a4 as y,cm as K,cB as L,cl as O,cp as q,cq as z,F,ct as h,av as H,aw as R,g,z as k,w as G,e as w,A as Q,Q as I,i as Z,j as J}from"./index-DEc4xym2.js";import{s as W}from"./use-resolve-button-type-Cmxb6e8K.js";function X(a,l,t){let o=V(t==null?void 0:t.value),n=i(()=>a.value!==void 0);return[i(()=>n.value?a.value:o.value),function(s){return n.value||(o.value=s),l==null?void 0:l(s)}]}function Y(a){var l,t;let o=(l=a==null?void 0:a.form)!=null?l:a.closest("form");if(o){for(let n of o.elements)if(n!==a&&(n.tagName==="INPUT"&&n.type==="submit"||n.tagName==="BUTTON"&&n.type==="submit"||n.nodeName==="INPUT"&&n.type==="image")){n.click();return}(t=o.requestSubmit)==null||t.call(o)}}let ee=Symbol("GroupContext"),ae=x({name:"Switch",emits:{"update:modelValue":a=>!0},props:{as:{type:[Object,String],default:"button"},modelValue:{type:Boolean,default:void 0},defaultChecked:{type:Boolean,optional:!0},form:{type:String,optional:!0},name:{type:String,optional:!0},value:{type:String,optional:!0},id:{type:String,default:null},disabled:{type:Boolean,default:!1},tabIndex:{type:Number,default:0}},inheritAttrs:!1,setup(a,{emit:l,attrs:t,slots:o,expose:n}){var s;let C=(s=a.id)!=null?s:`headlessui-switch-${D()}`,r=M(ee,null),[d,m]=X(i(()=>a.modelValue),e=>l("update:modelValue",e),i(()=>a.defaultChecked));function p(){m(!d.value)}let $=V(null),c=r===null?$:r.switchRef,B=W(i(()=>({as:a.as,type:t.type})),c);n({el:c,$el:c});function S(e){e.preventDefault(),p()}function N(e){e.key===h.Space?(e.preventDefault(),p()):e.key===h.Enter&&Y(e.currentTarget)}function T(e){e.preventDefault()}let f=i(()=>{var e,u;return(u=(e=P(c))==null?void 0:e.closest)==null?void 0:u.call(e,"form")});return U(()=>{A([f],()=>{if(!f.value||a.defaultChecked===void 0)return;function e(){m(a.defaultChecked)}return f.value.addEventListener("reset",e),()=>{var u;(u=f.value)==null||u.removeEventListener("reset",e)}},{immediate:!0})}),()=>{let{name:e,value:u,form:_,tabIndex:v,...b}=a,E={checked:d.value},j={id:C,ref:c,role:"switch",type:B.value,tabIndex:v===-1?0:v,"aria-checked":d.value,"aria-labelledby":r==null?void 0:r.labelledby.value,"aria-describedby":r==null?void 0:r.describedby.value,onClick:S,onKeyup:N,onKeypress:T};return y(F,[e!=null&&d.value!=null?y(K,L({features:O.Hidden,as:"input",type:"checkbox",hidden:!0,readOnly:!0,checked:d.value,form:_,disabled:b.disabled,name:e,value:u})):null,q({ourProps:j,theirProps:{...t,...z(b,["modelValue","defaultChecked"])},slot:E,attrs:t,slots:o,name:"Switch"})])}}});const le={class:"absolute inset-0 h-full w-full flex items-center justify-center"},oe=x({__name:"HToggle",props:H({disabled:{type:Boolean,default:!1},onIcon:{},offIcon:{}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const l=R(a,"modelValue");return(t,o)=>{const n=J;return g(),k(Z(ae),{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=s=>l.value=s),disabled:t.disabled,class:I(["relative h-5 w-10 inline-flex flex-shrink-0 cursor-pointer border-2 border-transparent rounded-full p-0 vertical-middle disabled-cursor-not-allowed disabled-opacity-50 focus-outline-none focus-visible-ring-2 focus-visible-ring-offset-2 focus-visible-ring-offset-white dark-focus-visible-ring-offset-gray-900",[l.value?"bg-ui-primary":"bg-stone-3 dark-bg-stone-7"]])},{default:G(()=>[w("span",{class:I(["pointer-events-none relative inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out dark-bg-dark",[l.value?"translate-x-5":"translate-x-0"]])},[w("span",le,[l.value&&t.onIcon||!l.value&&t.offIcon?(g(),k(n,{key:0,name:l.value?t.onIcon:t.offIcon,class:"h-3 w-3 text-stone-7 dark-text-stone-3"},null,8,["name"])):Q("",!0)])],2)]),_:1},8,["modelValue","disabled","class"])}}});export{oe as _}; import{r as V,p as i,d as x,cs as D,$ as M,co as P,a as U,Z as A,a4 as y,cm as K,cB as L,cl as O,cp as q,cq as z,F,ct as h,av as H,aw as R,g,z as k,w as G,e as w,A as Q,Q as I,i as Z,j as J}from"./index-CAe0BuuW.js";import{s as W}from"./use-resolve-button-type-CIWo_h_W.js";function X(a,l,t){let o=V(t==null?void 0:t.value),n=i(()=>a.value!==void 0);return[i(()=>n.value?a.value:o.value),function(s){return n.value||(o.value=s),l==null?void 0:l(s)}]}function Y(a){var l,t;let o=(l=a==null?void 0:a.form)!=null?l:a.closest("form");if(o){for(let n of o.elements)if(n!==a&&(n.tagName==="INPUT"&&n.type==="submit"||n.tagName==="BUTTON"&&n.type==="submit"||n.nodeName==="INPUT"&&n.type==="image")){n.click();return}(t=o.requestSubmit)==null||t.call(o)}}let ee=Symbol("GroupContext"),ae=x({name:"Switch",emits:{"update:modelValue":a=>!0},props:{as:{type:[Object,String],default:"button"},modelValue:{type:Boolean,default:void 0},defaultChecked:{type:Boolean,optional:!0},form:{type:String,optional:!0},name:{type:String,optional:!0},value:{type:String,optional:!0},id:{type:String,default:null},disabled:{type:Boolean,default:!1},tabIndex:{type:Number,default:0}},inheritAttrs:!1,setup(a,{emit:l,attrs:t,slots:o,expose:n}){var s;let C=(s=a.id)!=null?s:`headlessui-switch-${D()}`,r=M(ee,null),[d,m]=X(i(()=>a.modelValue),e=>l("update:modelValue",e),i(()=>a.defaultChecked));function p(){m(!d.value)}let $=V(null),c=r===null?$:r.switchRef,B=W(i(()=>({as:a.as,type:t.type})),c);n({el:c,$el:c});function S(e){e.preventDefault(),p()}function N(e){e.key===h.Space?(e.preventDefault(),p()):e.key===h.Enter&&Y(e.currentTarget)}function T(e){e.preventDefault()}let f=i(()=>{var e,u;return(u=(e=P(c))==null?void 0:e.closest)==null?void 0:u.call(e,"form")});return U(()=>{A([f],()=>{if(!f.value||a.defaultChecked===void 0)return;function e(){m(a.defaultChecked)}return f.value.addEventListener("reset",e),()=>{var u;(u=f.value)==null||u.removeEventListener("reset",e)}},{immediate:!0})}),()=>{let{name:e,value:u,form:_,tabIndex:v,...b}=a,E={checked:d.value},j={id:C,ref:c,role:"switch",type:B.value,tabIndex:v===-1?0:v,"aria-checked":d.value,"aria-labelledby":r==null?void 0:r.labelledby.value,"aria-describedby":r==null?void 0:r.describedby.value,onClick:S,onKeyup:N,onKeypress:T};return y(F,[e!=null&&d.value!=null?y(K,L({features:O.Hidden,as:"input",type:"checkbox",hidden:!0,readOnly:!0,checked:d.value,form:_,disabled:b.disabled,name:e,value:u})):null,q({ourProps:j,theirProps:{...t,...z(b,["modelValue","defaultChecked"])},slot:E,attrs:t,slots:o,name:"Switch"})])}}});const le={class:"absolute inset-0 h-full w-full flex items-center justify-center"},oe=x({__name:"HToggle",props:H({disabled:{type:Boolean,default:!1},onIcon:{},offIcon:{}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const l=R(a,"modelValue");return(t,o)=>{const n=J;return g(),k(Z(ae),{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=s=>l.value=s),disabled:t.disabled,class:I(["relative h-5 w-10 inline-flex flex-shrink-0 cursor-pointer border-2 border-transparent rounded-full p-0 vertical-middle disabled-cursor-not-allowed disabled-opacity-50 focus-outline-none focus-visible-ring-2 focus-visible-ring-offset-2 focus-visible-ring-offset-white dark-focus-visible-ring-offset-gray-900",[l.value?"bg-ui-primary":"bg-stone-3 dark-bg-stone-7"]])},{default:G(()=>[w("span",{class:I(["pointer-events-none relative inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out dark-bg-dark",[l.value?"translate-x-5":"translate-x-0"]])},[w("span",le,[l.value&&t.onIcon||!l.value&&t.offIcon?(g(),k(n,{key:0,name:l.value?t.onIcon:t.offIcon,class:"h-3 w-3 text-stone-7 dark-text-stone-3"},null,8,["name"])):Q("",!0)])],2)]),_:1},8,["modelValue","disabled","class"])}}});export{oe as _};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as m}from"./HTooltip.vue_vue_type_script_setup_true_lang-C9_oOtnv.js";import"./index-DEc4xym2.js";export{m as default}; import{_ as m}from"./HTooltip.vue_vue_type_script_setup_true_lang-DkOhIXEM.js";import"./index-CAe0BuuW.js";export{m as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as r,n as p,g as o,z as n,w as s,P as t,X as l,c as i,h as d,t as c}from"./index-DEc4xym2.js";const m={key:1},g=r({__name:"HTooltip",props:{text:{default:""},enable:{type:Boolean,default:!0}},setup(u){return(e,f)=>{const a=p("VTooltip");return e.enable?(o(),n(a,l({key:0,"popper-triggers":["hover"]},e.$attrs),{popper:s(()=>[t(e.$slots,"text",{},()=>[d(c(e.text),1)])]),default:s(()=>[t(e.$slots,"default")]),_:3},16)):(o(),i("div",m,[t(e.$slots,"default")]))}}});export{g as _}; import{d as r,n as p,g as o,z as n,w as s,P as t,X as l,c as i,h as d,t as c}from"./index-CAe0BuuW.js";const m={key:1},g=r({__name:"HTooltip",props:{text:{default:""},enable:{type:Boolean,default:!0}},setup(u){return(e,f)=>{const a=p("VTooltip");return e.enable?(o(),n(a,l({key:0,"popper-triggers":["hover"]},e.$attrs),{popper:s(()=>[t(e.$slots,"text",{},()=>[d(c(e.text),1)])]),default:s(()=>[t(e.$slots,"default")]),_:3},16)):(o(),i("div",m,[t(e.$slots,"default")]))}}});export{g as _};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as i,u,r as _,o as f,a as d,c as x,b as o,e as t,w as p,f as m,_ as v,g as w,h as g,t as h,i as k,j as B,k as s}from"./index-DEc4xym2.js";const N={class:"absolute left-[50%] top-[50%] flex flex-col items-center justify-between lg-flex-row -translate-x-50% -translate-y-50% lg-gap-12"},b={class:"flex flex-col gap-4"},S=t("h1",{class:"m-0 text-6xl font-sans"}," 404 ",-1),y=t("div",{class:"mx-0 text-xl text-stone-5"}," 抱歉,你访问的页面不存在 ",-1),I=i({__name:"[...all]",setup(C){const a=m(),l=u(),e=_({inter:Number.NaN,countdown:5});f(()=>{e.value.inter&&window.clearInterval(e.value.inter)}),d(()=>{e.value.inter=window.setInterval(()=>{e.value.countdown--,e.value.countdown===0&&(e.value.inter&&window.clearInterval(e.value.inter),n())},1e3)});function n(){a.push(l.settings.home.fullPath)}return(V,j)=>{const c=B,r=v;return w(),x("div",N,[o(c,{name:"404",class:"text-[300px] lg-text-[400px]"}),t("div",b,[S,y,t("div",null,[o(r,{onClick:n},{default:p(()=>[g(h(k(e).countdown)+" 秒后,返回首页 ",1)]),_:1})])])])}}});typeof s=="function"&&s(I);export{I as default}; import{d as i,u,r as _,o as f,a as d,c as x,b as o,e as t,w as p,f as m,_ as v,g as w,h as g,t as h,i as k,j as B,k as s}from"./index-CAe0BuuW.js";const N={class:"absolute left-[50%] top-[50%] flex flex-col items-center justify-between lg-flex-row -translate-x-50% -translate-y-50% lg-gap-12"},b={class:"flex flex-col gap-4"},S=t("h1",{class:"m-0 text-6xl font-sans"}," 404 ",-1),y=t("div",{class:"mx-0 text-xl text-stone-5"}," 抱歉,你访问的页面不存在 ",-1),I=i({__name:"[...all]",setup(C){const a=m(),l=u(),e=_({inter:Number.NaN,countdown:5});f(()=>{e.value.inter&&window.clearInterval(e.value.inter)}),d(()=>{e.value.inter=window.setInterval(()=>{e.value.countdown--,e.value.countdown===0&&(e.value.inter&&window.clearInterval(e.value.inter),n())},1e3)});function n(){a.push(l.settings.home.fullPath)}return(V,j)=>{const c=B,r=v;return w(),x("div",N,[o(c,{name:"404",class:"text-[300px] lg-text-[400px]"}),t("div",b,[S,y,t("div",null,[o(r,{onClick:n},{default:p(()=>[g(h(k(e).countdown)+" 秒后,返回首页 ",1)]),_:1})])])])}}});typeof s=="function"&&s(I);export{I as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as F}from"./index.vue_vue_type_script_setup_true_lang-DKdjIYRj.js";import{_ as H}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{I as M,d as G,r as _,m as P,a as O,n as r,q as K,g as u,c as h,b as a,w as t,F as R,s as V,i as m,h as d,y as J,z as C,t as b,e as Q,K as W,k as q}from"./index-DEc4xym2.js";import{o as X,p as Z,U as ee,m as ae}from"./index-J5zVJPyL.js";import{u as te}from"./utcformatTime-Bq4gDWNx.js";const le={upgradeBalance:g=>M.post("balance/upgradeBalance",g),queryUserAccountLog:g=>M.get("balance/accountLog",{params:g})},oe=Q("div",{class:"flex items-center gap-4"},"账户明细",-1),re=G({__name:"accountLog",setup(g){const T=_(),A=_(0),f=_(!1),n=P({userId:"",rechargeType:"",packageId:"",page:1,size:15});P({model3Count:[{required:!0,message:"请填写赠送基础模型额度",trigger:"blur"}],model4Count:[{required:!0,message:"请填写赠送高级模型额度",trigger:"blur"}],drawMjCount:[{required:!0,message:"请填写赠送绘画积分额度",trigger:"blur"}]});const U=_(),k=_([]);async function i(){try{f.value=!0;const s=await le.queryUserAccountLog(n),{rows:l,count:w}=s.data;f.value=!1,A.value=w,k.value=l}catch{f.value=!1}}async function D(s){const l=await W.queryAllUser({size:30,keyword:s});U.value=l.data.rows}function B(s){s==null||s.resetFields(),i()}return O(()=>i()),(s,l)=>{const w=H,x=r("el-option"),z=r("el-select"),y=r("el-form-item"),I=r("el-button"),L=r("el-form"),S=F,Y=r("el-avatar"),o=r("el-table-column"),v=r("el-tag"),E=r("el-table"),j=r("el-pagination"),N=r("el-row"),$=K("loading");return u(),h("div",null,[a(w,null,{title:t(()=>[oe]),_:1}),a(S,null,{default:t(()=>[a(L,{ref_key:"formRef",ref:T,inline:!0,model:n},{default:t(()=>[a(y,{label:"用户名称",prop:"userId"},{default:t(()=>[a(z,{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,style:{width:"200px"}},{default:t(()=>[(u(!0),h(R,null,V(U.value,e=>(u(),C(x,{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(z,{modelValue:n.rechargeType,"onUpdate:modelValue":l[1]||(l[1]=e=>n.rechargeType=e),placeholder:"请选择充值类型",clearable:"",style:{width:"160px"}},{default:t(()=>[(u(!0),h(R,null,V(m(X),e=>(u(),C(x,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(y,null,{default:t(()=>[a(I,{type:"primary",onClick:i},{default:t(()=>[d(" 查询 ")]),_:1}),a(I,{onClick:l[2]||(l[2]=e=>B(T.value))},{default:t(()=>[d(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),a(S,{style:{width:"100%"}},{default:t(()=>[J((u(),C(E,{border:"",data:k.value,style:{width:"100%"},size:"large"},{default:t(()=>[a(o,{prop:"avatar",label:"用户头像",width:"120",fixed:""},{default:t(e=>[a(Y,{src:e.row.avatar},null,8,["src"])]),_:1}),a(o,{prop:"username",label:"用户名称",width:"150",fixed:""}),a(o,{prop:"userId",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(b((c=e.row)!=null&&c.rechargeType?m(Z)[(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(b(((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(ee)[e.status]},{default:t(()=>[d(b(m(ae)[e.status]),1)]),_:2},1032,["type"])]),_:1}),a(o,{prop:"createdAt",label:"充值时间",width:"200",align:"center"},{default:t(e=>[d(b(m(te)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[$,f.value]]),a(N,{class:"mt-5 flex justify-end"},{default:t(()=>[a(j,{"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(re);export{re as default}; import{_ as F}from"./index.vue_vue_type_script_setup_true_lang-CHWp65cL.js";import{_ as H}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{I as M,d as G,r as _,m as P,a as O,n as r,q as K,g as u,c as h,b as a,w as t,F as R,s as V,i as m,h as d,y as J,z as C,t as b,e as Q,K as W,k as q}from"./index-CAe0BuuW.js";import{o as X,p as Z,U as ee,m as ae}from"./index-DfBvkKrB.js";import{u as te}from"./utcformatTime-Bq4gDWNx.js";const le={upgradeBalance:g=>M.post("balance/upgradeBalance",g),queryUserAccountLog:g=>M.get("balance/accountLog",{params:g})},oe=Q("div",{class:"flex items-center gap-4"},"账户明细",-1),re=G({__name:"accountLog",setup(g){const T=_(),A=_(0),f=_(!1),n=P({userId:"",rechargeType:"",packageId:"",page:1,size:15});P({model3Count:[{required:!0,message:"请填写赠送基础模型额度",trigger:"blur"}],model4Count:[{required:!0,message:"请填写赠送高级模型额度",trigger:"blur"}],drawMjCount:[{required:!0,message:"请填写赠送绘画积分额度",trigger:"blur"}]});const U=_(),k=_([]);async function i(){try{f.value=!0;const s=await le.queryUserAccountLog(n),{rows:l,count:w}=s.data;f.value=!1,A.value=w,k.value=l}catch{f.value=!1}}async function D(s){const l=await W.queryAllUser({size:30,keyword:s});U.value=l.data.rows}function B(s){s==null||s.resetFields(),i()}return O(()=>i()),(s,l)=>{const w=H,x=r("el-option"),z=r("el-select"),y=r("el-form-item"),I=r("el-button"),L=r("el-form"),S=F,Y=r("el-avatar"),o=r("el-table-column"),v=r("el-tag"),E=r("el-table"),j=r("el-pagination"),N=r("el-row"),$=K("loading");return u(),h("div",null,[a(w,null,{title:t(()=>[oe]),_:1}),a(S,null,{default:t(()=>[a(L,{ref_key:"formRef",ref:T,inline:!0,model:n},{default:t(()=>[a(y,{label:"用户名称",prop:"userId"},{default:t(()=>[a(z,{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,style:{width:"200px"}},{default:t(()=>[(u(!0),h(R,null,V(U.value,e=>(u(),C(x,{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(z,{modelValue:n.rechargeType,"onUpdate:modelValue":l[1]||(l[1]=e=>n.rechargeType=e),placeholder:"请选择充值类型",clearable:"",style:{width:"160px"}},{default:t(()=>[(u(!0),h(R,null,V(m(X),e=>(u(),C(x,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(y,null,{default:t(()=>[a(I,{type:"primary",onClick:i},{default:t(()=>[d(" 查询 ")]),_:1}),a(I,{onClick:l[2]||(l[2]=e=>B(T.value))},{default:t(()=>[d(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),a(S,{style:{width:"100%"}},{default:t(()=>[J((u(),C(E,{border:"",data:k.value,style:{width:"100%"},size:"large"},{default:t(()=>[a(o,{prop:"avatar",label:"用户头像",width:"120",fixed:""},{default:t(e=>[a(Y,{src:e.row.avatar},null,8,["src"])]),_:1}),a(o,{prop:"username",label:"用户名称",width:"150",fixed:""}),a(o,{prop:"userId",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(b((c=e.row)!=null&&c.rechargeType?m(Z)[(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(b(((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(ee)[e.status]},{default:t(()=>[d(b(m(ae)[e.status]),1)]),_:2},1032,["type"])]),_:1}),a(o,{prop:"createdAt",label:"充值时间",width:"200",align:"center"},{default:t(e=>[d(b(m(te)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[$,f.value]]),a(N,{class:"mt-5 flex justify-end"},{default:t(()=>[a(j,{"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(re);export{re as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as h}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{d as B,m as I,r as C,p as R,a as U,n,g as D,c as N,b as e,w as l,h as p,i as m,e as f,E as y,j,_ as q,k as V}from"./index-DEc4xym2.js";import{a as x}from"./config-BQ9gBCXa.js";const E=f("div",{class:"flex items-center gap-4"},"阿里云OSS参数设置",-1),$=f("div",{class:"text-sm/6"},[f("div",null,[p(" 需前往阿里云申请对象存储服务,更多配置及申请详见"),f("a",{href:"https://oss.console.aliyun.com",target:"_blank"},"阿里云OSS"),p(" 。如果同时开启多个存储服务,腾讯云优先级高于阿里云。 ")])],-1),H=B({__name:"ali",setup(M){const a=I({aliOssStatus:"",aliOssAccessKeyId:"",aliOssAccessKeySecret:"",aliOssRegion:"",aliOssBucket:"",aliOssAcceleratedDomain:""}),_=C();async function O(){const o=await x.queryConfig({keys:["aliOssAccessKeySecret","aliOssRegion","aliOssBucket","aliOssAccessKeyId","aliOssStatus","aliOssAcceleratedDomain"]});Object.assign(a,o.data)}function S(){var o;(o=_.value)==null||o.validate(async s=>{if(s){try{await x.setConfig({settings:b(a)}),y.success("变更配置信息成功")}catch{}O()}else y.error("请填写完整信息")})}function b(o){return Object.keys(o).map(s=>({configKey:s,configVal:o[s]}))}const d=R(()=>[{required:Number(a.aliOssStatus)===1,message:"开启配置后请填写此项",trigger:"change"}]);return U(()=>{O()}),(o,s)=>{const g=j,A=q,w=h,k=n("el-switch"),c=n("el-form-item"),r=n("el-col"),u=n("el-row"),i=n("el-input"),v=n("el-form"),K=n("el-card");return D(),N("div",null,[e(w,null,{title:l(()=>[E]),content:l(()=>[$]),default:l(()=>[e(A,{outline:"",onClick:S},{default:l(()=>[e(g,{name:"i-ri:file-text-line"}),p(" 保存设置 ")]),_:1})]),_:1}),e(K,{style:{margin:"20px"}},{default:l(()=>[e(v,{ref_key:"formRef",ref:_,model:a,"label-width":"120px"},{default:l(()=>[e(u,null,{default:l(()=>[e(r,{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(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"accessKeyId",prop:"aliOssAccessKeyId",rules:m(d)},{default:l(()=>[e(i,{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(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"keySecret",prop:"aliOssAccessKeySecret",rules:m(d)},{default:l(()=>[e(i,{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(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"存储桶名称",prop:"aliOssBucket",rules:m(d)},{default:l(()=>[e(i,{modelValue:a.aliOssBucket,"onUpdate:modelValue":s[3]||(s[3]=t=>a.aliOssBucket=t),placeholder:"请填写存储桶名称",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"所属地域",prop:"aliOssRegion",rules:m(d)},{default:l(()=>[e(i,{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}),e(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"全球加速域名",prop:"aliOssAcceleratedDomain"},{default:l(()=>[e(i,{modelValue:a.aliOssAcceleratedDomain,"onUpdate:modelValue":s[5]||(s[5]=t=>a.aliOssAcceleratedDomain=t),placeholder:"如您是国外服务器可开启全球加速域名得到更快响应速度、同理也会更高计费!",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})])}}});typeof V=="function"&&V(H);export{H as default}; import{_ as h}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{d as B,m as I,r as C,p as R,a as U,n,g as D,c as N,b as e,w as l,h as p,i as m,e as f,E as y,j,_ as q,k as V}from"./index-CAe0BuuW.js";import{a as x}from"./config-CwtVyG0K.js";const E=f("div",{class:"flex items-center gap-4"},"阿里云OSS参数设置",-1),$=f("div",{class:"text-sm/6"},[f("div",null,[p(" 需前往阿里云申请对象存储服务,更多配置及申请详见"),f("a",{href:"https://oss.console.aliyun.com",target:"_blank"},"阿里云OSS"),p(" 。如果同时开启多个存储服务,腾讯云优先级高于阿里云。 ")])],-1),H=B({__name:"ali",setup(M){const a=I({aliOssStatus:"",aliOssAccessKeyId:"",aliOssAccessKeySecret:"",aliOssRegion:"",aliOssBucket:"",aliOssAcceleratedDomain:""}),_=C();async function O(){const o=await x.queryConfig({keys:["aliOssAccessKeySecret","aliOssRegion","aliOssBucket","aliOssAccessKeyId","aliOssStatus","aliOssAcceleratedDomain"]});Object.assign(a,o.data)}function S(){var o;(o=_.value)==null||o.validate(async s=>{if(s){try{await x.setConfig({settings:b(a)}),y.success("变更配置信息成功")}catch{}O()}else y.error("请填写完整信息")})}function b(o){return Object.keys(o).map(s=>({configKey:s,configVal:o[s]}))}const d=R(()=>[{required:Number(a.aliOssStatus)===1,message:"开启配置后请填写此项",trigger:"change"}]);return U(()=>{O()}),(o,s)=>{const g=j,A=q,w=h,k=n("el-switch"),c=n("el-form-item"),r=n("el-col"),u=n("el-row"),i=n("el-input"),v=n("el-form"),K=n("el-card");return D(),N("div",null,[e(w,null,{title:l(()=>[E]),content:l(()=>[$]),default:l(()=>[e(A,{outline:"",onClick:S},{default:l(()=>[e(g,{name:"i-ri:file-text-line"}),p(" 保存设置 ")]),_:1})]),_:1}),e(K,{style:{margin:"20px"}},{default:l(()=>[e(v,{ref_key:"formRef",ref:_,model:a,"label-width":"120px"},{default:l(()=>[e(u,null,{default:l(()=>[e(r,{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(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"accessKeyId",prop:"aliOssAccessKeyId",rules:m(d)},{default:l(()=>[e(i,{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(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"keySecret",prop:"aliOssAccessKeySecret",rules:m(d)},{default:l(()=>[e(i,{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(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"存储桶名称",prop:"aliOssBucket",rules:m(d)},{default:l(()=>[e(i,{modelValue:a.aliOssBucket,"onUpdate:modelValue":s[3]||(s[3]=t=>a.aliOssBucket=t),placeholder:"请填写存储桶名称",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"所属地域",prop:"aliOssRegion",rules:m(d)},{default:l(()=>[e(i,{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}),e(u,null,{default:l(()=>[e(r,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(c,{label:"全球加速域名",prop:"aliOssAcceleratedDomain"},{default:l(()=>[e(i,{modelValue:a.aliOssAcceleratedDomain,"onUpdate:modelValue":s[5]||(s[5]=t=>a.aliOssAcceleratedDomain=t),placeholder:"如您是国外服务器可开启全球加速域名得到更快响应速度、同理也会更高计费!",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})])}}});typeof V=="function"&&V(H);export{H as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{I as t}from"./index-DEc4xym2.js";const e={queryCats:p=>t.get("app/queryAppCats",{params:p}),deleteCats:p=>t.post("app/delAppCats",p),createCats:p=>t.post("app/createAppCats",p),updateCats:p=>t.post("app/updateAppCats",p),queryApp:p=>t.get("app/queryApp",{params:p}),querySystemApp:p=>t.get("app/querySystemApp"),deleteApp:p=>t.post("app/delApp",p),createApp:p=>t.post("app/createApp",p),updateApp:p=>t.post("app/updateApp",p),updateSystemApp:p=>t.post("app/updateSystemApp",p),auditPassApp:p=>t.post("app/auditPass",p),auditFailApp:p=>t.post("app/auditFail",p)};export{e as A}; import{I as t}from"./index-CAe0BuuW.js";const e={queryCats:p=>t.get("app/queryAppCats",{params:p}),deleteCats:p=>t.post("app/delAppCats",p),createCats:p=>t.post("app/createAppCats",p),updateCats:p=>t.post("app/updateAppCats",p),queryApp:p=>t.get("app/queryApp",{params:p}),querySystemApp:p=>t.get("app/querySystemApp"),deleteApp:p=>t.post("app/delApp",p),createApp:p=>t.post("app/createApp",p),updateApp:p=>t.post("app/updateApp",p),updateSystemApp:p=>t.post("app/updateSystemApp",p),auditPassApp:p=>t.post("app/auditPass",p),auditFailApp:p=>t.post("app/auditFail",p)};export{e as A};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{I as o}from"./index-DEc4xym2.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{I as o}from"./index-CAe0BuuW.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

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

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as C}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{d as k,m as M,r as p,a as T,n,g as A,c as q,b as e,w as l,h as D,e as U,E as g,j,_ as E,k as y}from"./index-DEc4xym2.js";import{a as x}from"./config-BQ9gBCXa.js";const N=U("div",{class:"flex items-center gap-4"},"分销系统基础设置",-1),$=k({__name:"base",setup(H){const t=M({salesBaseRatio:10,salesSeniorRatio:30,salesAllowDrawMoney:10,salesBaseTitle:"新秀分销商"}),b=p({salesBaseRatio:[{required:!0,trigger:"blur",message:"请填写默认佣金比例"}],salesSeniorRatio:[{required:!0,trigger:"blur",message:"请填写高级代理默认比例"}],salesBaseTitle:[{required:!0,trigger:"blur",message:"请填写默认用户推介等级名称"}]}),m=p();async function d(){const s=await x.queryConfig({keys:["salesBaseRatio","salesSeniorRatio","salesAllowDrawMoney","salesBaseTitle"]});Object.assign(t,s.data)}function w(){var s;(s=m.value)==null||s.validate(async a=>{if(a){try{await x.setConfig({settings:B(t)}),g.success("变更配置信息成功")}catch{}d()}else g.error("请填写完整信息")})}function B(s){return Object.keys(s).map(a=>({configKey:a,configVal:s[a]}))}return T(()=>{d()}),(s,a)=>{const _=j,V=E,R=C,c=n("el-input-number"),r=n("el-form-item"),i=n("el-col"),u=n("el-row"),f=n("el-input"),S=n("el-form"),v=n("el-card");return A(),q("div",null,[e(R,null,{title:l(()=>[N]),default:l(()=>[e(V,{outline:"",onClick:w},{default:l(()=>[e(_,{name:"i-ri:file-text-line"}),D(" 保存设置 ")]),_:1})]),_:1}),e(v,{style:{margin:"20px"}},{default:l(()=>[e(S,{ref_key:"formRef",ref:m,model:t,"label-width":"140px",rules:b.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(c,{modelValue:t.salesBaseRatio,"onUpdate:modelValue":a[0]||(a[0]=o=>t.salesBaseRatio=o),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(c,{modelValue:t.salesSeniorRatio,"onUpdate:modelValue":a[1]||(a[1]=o=>t.salesSeniorRatio=o),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(f,{modelValue:t.salesAllowDrawMoney,"onUpdate:modelValue":a[2]||(a[2]=o=>t.salesAllowDrawMoney=o),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(f,{modelValue:t.salesBaseTitle,"onUpdate:modelValue":a[3]||(a[3]=o=>t.salesBaseTitle=o),placeholder:"请填写SecretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1})])}}});typeof y=="function"&&y($);export{$ as default}; import{_ as C}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{d as k,m as M,r as p,a as T,n,g as A,c as q,b as e,w as l,h as D,e as U,E as g,j,_ as E,k as y}from"./index-CAe0BuuW.js";import{a as x}from"./config-CwtVyG0K.js";const N=U("div",{class:"flex items-center gap-4"},"分销系统基础设置",-1),$=k({__name:"base",setup(H){const t=M({salesBaseRatio:10,salesSeniorRatio:30,salesAllowDrawMoney:10,salesBaseTitle:"新秀分销商"}),b=p({salesBaseRatio:[{required:!0,trigger:"blur",message:"请填写默认佣金比例"}],salesSeniorRatio:[{required:!0,trigger:"blur",message:"请填写高级代理默认比例"}],salesBaseTitle:[{required:!0,trigger:"blur",message:"请填写默认用户推介等级名称"}]}),m=p();async function d(){const s=await x.queryConfig({keys:["salesBaseRatio","salesSeniorRatio","salesAllowDrawMoney","salesBaseTitle"]});Object.assign(t,s.data)}function w(){var s;(s=m.value)==null||s.validate(async a=>{if(a){try{await x.setConfig({settings:B(t)}),g.success("变更配置信息成功")}catch{}d()}else g.error("请填写完整信息")})}function B(s){return Object.keys(s).map(a=>({configKey:a,configVal:s[a]}))}return T(()=>{d()}),(s,a)=>{const _=j,V=E,R=C,c=n("el-input-number"),r=n("el-form-item"),i=n("el-col"),u=n("el-row"),f=n("el-input"),S=n("el-form"),v=n("el-card");return A(),q("div",null,[e(R,null,{title:l(()=>[N]),default:l(()=>[e(V,{outline:"",onClick:w},{default:l(()=>[e(_,{name:"i-ri:file-text-line"}),D(" 保存设置 ")]),_:1})]),_:1}),e(v,{style:{margin:"20px"}},{default:l(()=>[e(S,{ref_key:"formRef",ref:m,model:t,"label-width":"140px",rules:b.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(c,{modelValue:t.salesBaseRatio,"onUpdate:modelValue":a[0]||(a[0]=o=>t.salesBaseRatio=o),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(c,{modelValue:t.salesSeniorRatio,"onUpdate:modelValue":a[1]||(a[1]=o=>t.salesSeniorRatio=o),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(f,{modelValue:t.salesAllowDrawMoney,"onUpdate:modelValue":a[2]||(a[2]=o=>t.salesAllowDrawMoney=o),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(f,{modelValue:t.salesBaseTitle,"onUpdate:modelValue":a[3]||(a[3]=o=>t.salesBaseTitle=o),placeholder:"请填写SecretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1})])}}});typeof y=="function"&&y($);export{$ as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as v}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{d as I,m as w,r as b,a as A,n as s,g as R,c as U,b as e,w as l,h as m,e as f,E as y,j,_ as B,k}from"./index-DEc4xym2.js";import{a as g}from"./config-BQ9gBCXa.js";const E=f("div",{class:"flex items-center gap-4"},"百度统计设置",-1),N=f("div",{class:"text-sm/6"},[f("div",null,"百度统计主要用于展示,实际的统计数据将在网站首页显示。"),f("div",null,[m(" 为获取更精确的数据分析,请参考"),f("a",{href:"https://tongji.baidu.com/api/manual/Chapter2/openapi.html",target:"_blank"},"百度统计接口说明"),m(",申请专属于您网站的 siteId 、key 以及 token 等信息。 ")]),f("div",null," 百度统计提供的是一项免费服务,如果您选择不使用这项服务,只需将相关设置项留空即可。 ")],-1),$=I({__name:"base",setup(q){const o=w({baiduCode:"",baiduSiteId:"",baiduToken:"",baiduApiKey:"",baiduSecretKey:"",baiduRefreshToken:""}),x=b({}),c=b();async function p(){const n=await g.queryConfig({keys:["baiduCode","baiduSiteId","baiduToken","baiduApiKey","baiduSecretKey","baiduRefreshToken"]});Object.assign(o,n.data)}function V(){var n;(n=c.value)==null||n.validate(async a=>{if(a){try{await g.setConfig({settings:K(o)}),y.success("变更配置信息成功")}catch{}p()}else y.error("请填写完整信息")})}function K(n){return Object.keys(n).map(a=>({configKey:a,configVal:n[a]}))}return A(()=>{p()}),(n,a)=>{const _=j,C=B,h=v,d=s("el-input"),u=s("el-form-item"),i=s("el-col"),r=s("el-row"),S=s("el-form"),T=s("el-card");return R(),U("div",null,[e(h,null,{title:l(()=>[E]),content:l(()=>[N]),default:l(()=>[e(C,{outline:"",onClick:V},{default:l(()=>[e(_,{name:"i-ri:file-text-line"}),m(" 保存设置 ")]),_:1})]),_:1}),e(T,{style:{margin:"20px"}},{default:l(()=>[e(S,{ref_key:"formRef",ref:c,rules:x.value,model:o,"label-width":"120px"},{default:l(()=>[e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"siteId",prop:"baiduSiteId"},{default:l(()=>[e(d,{modelValue:o.baiduSiteId,"onUpdate:modelValue":a[0]||(a[0]=t=>o.baiduSiteId=t),placeholder:"请填写百度site_id",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"ApiKey",prop:"baiduApiKey"},{default:l(()=>[e(d,{modelValue:o.baiduApiKey,"onUpdate:modelValue":a[1]||(a[1]=t=>o.baiduApiKey=t),placeholder:"请填写百度apiKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"SecretKey",prop:"baiduSecretKey"},{default:l(()=>[e(d,{modelValue:o.baiduSecretKey,"onUpdate:modelValue":a[2]||(a[2]=t=>o.baiduSecretKey=t),placeholder:"请填写百度 secretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"AccessToken",prop:"baiduToken"},{default:l(()=>[e(d,{modelValue:o.baiduToken,"onUpdate:modelValue":a[3]||(a[3]=t=>o.baiduToken=t),placeholder:"请填写百度 access_token",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"RefreshToken",prop:"baiduRefreshToken"},{default:l(()=>[e(d,{modelValue:o.baiduRefreshToken,"onUpdate:modelValue":a[4]||(a[4]=t=>o.baiduRefreshToken=t),placeholder:"请填写百度 refresh_token",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"统计代码",prop:"baiduCode"},{default:l(()=>[e(d,{modelValue:o.baiduCode,"onUpdate:modelValue":a[5]||(a[5]=t=>o.baiduCode=t),placeholder:"填写百度统计代码可统计每日访问量详情,如果没有使用用请查看详细文档!",type:"textarea",rows:12,clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof k=="function"&&k($);export{$ as default}; import{_ as v}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{d as I,m as w,r as b,a as A,n as s,g as R,c as U,b as e,w as l,h as m,e as f,E as y,j,_ as B,k}from"./index-CAe0BuuW.js";import{a as g}from"./config-CwtVyG0K.js";const E=f("div",{class:"flex items-center gap-4"},"百度统计设置",-1),N=f("div",{class:"text-sm/6"},[f("div",null,"百度统计主要用于展示,实际的统计数据将在网站首页显示。"),f("div",null,[m(" 为获取更精确的数据分析,请参考"),f("a",{href:"https://tongji.baidu.com/api/manual/Chapter2/openapi.html",target:"_blank"},"百度统计接口说明"),m(",申请专属于您网站的 siteId 、key 以及 token 等信息。 ")]),f("div",null," 百度统计提供的是一项免费服务,如果您选择不使用这项服务,只需将相关设置项留空即可。 ")],-1),$=I({__name:"base",setup(q){const o=w({baiduCode:"",baiduSiteId:"",baiduToken:"",baiduApiKey:"",baiduSecretKey:"",baiduRefreshToken:""}),x=b({}),c=b();async function p(){const n=await g.queryConfig({keys:["baiduCode","baiduSiteId","baiduToken","baiduApiKey","baiduSecretKey","baiduRefreshToken"]});Object.assign(o,n.data)}function V(){var n;(n=c.value)==null||n.validate(async a=>{if(a){try{await g.setConfig({settings:K(o)}),y.success("变更配置信息成功")}catch{}p()}else y.error("请填写完整信息")})}function K(n){return Object.keys(n).map(a=>({configKey:a,configVal:n[a]}))}return A(()=>{p()}),(n,a)=>{const _=j,C=B,h=v,d=s("el-input"),u=s("el-form-item"),i=s("el-col"),r=s("el-row"),S=s("el-form"),T=s("el-card");return R(),U("div",null,[e(h,null,{title:l(()=>[E]),content:l(()=>[N]),default:l(()=>[e(C,{outline:"",onClick:V},{default:l(()=>[e(_,{name:"i-ri:file-text-line"}),m(" 保存设置 ")]),_:1})]),_:1}),e(T,{style:{margin:"20px"}},{default:l(()=>[e(S,{ref_key:"formRef",ref:c,rules:x.value,model:o,"label-width":"120px"},{default:l(()=>[e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"siteId",prop:"baiduSiteId"},{default:l(()=>[e(d,{modelValue:o.baiduSiteId,"onUpdate:modelValue":a[0]||(a[0]=t=>o.baiduSiteId=t),placeholder:"请填写百度site_id",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"ApiKey",prop:"baiduApiKey"},{default:l(()=>[e(d,{modelValue:o.baiduApiKey,"onUpdate:modelValue":a[1]||(a[1]=t=>o.baiduApiKey=t),placeholder:"请填写百度apiKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"SecretKey",prop:"baiduSecretKey"},{default:l(()=>[e(d,{modelValue:o.baiduSecretKey,"onUpdate:modelValue":a[2]||(a[2]=t=>o.baiduSecretKey=t),placeholder:"请填写百度 secretKey",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"AccessToken",prop:"baiduToken"},{default:l(()=>[e(d,{modelValue:o.baiduToken,"onUpdate:modelValue":a[3]||(a[3]=t=>o.baiduToken=t),placeholder:"请填写百度 access_token",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"RefreshToken",prop:"baiduRefreshToken"},{default:l(()=>[e(d,{modelValue:o.baiduRefreshToken,"onUpdate:modelValue":a[4]||(a[4]=t=>o.baiduRefreshToken=t),placeholder:"请填写百度 refresh_token",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(r,null,{default:l(()=>[e(i,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"统计代码",prop:"baiduCode"},{default:l(()=>[e(d,{modelValue:o.baiduCode,"onUpdate:modelValue":a[5]||(a[5]=t=>o.baiduCode=t),placeholder:"填写百度统计代码可统计每日访问量详情,如果没有使用用请查看详细文档!",type:"textarea",rows:12,clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof k=="function"&&k($);export{$ 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

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{I as t}from"./index-DEc4xym2.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{I as t}from"./index-CAe0BuuW.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

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as F}from"./index.vue_vue_type_script_setup_true_lang-DKdjIYRj.js";import{_ as H}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{d as N,r as d,m as $,a as j,n as a,q as P,g as c,c as C,b as t,w as o,F as O,s as G,i,v as J,x as Q,h as u,y as W,z as T,t as _,e as h,K as X,k as A}from"./index-DEc4xym2.js";import{A as Z}from"./chat-CNvkcurJ.js";import{u as E}from"./utcformatTime-Bq4gDWNx.js";import{m as g}from"./marked.esm-8ZxQ78w7.js";const ee=h("div",{class:"flex items-center gap-4"},"对话记录",-1),te={class:"answer"},oe=["innerHTML"],ne=N({__name:"chat",setup(ae){const V=new g.Renderer;g.setOptions({renderer:V,gfm:!0,pedantic:!1});const m=d(!1),v=d(),b=d(),y=d(0),l=$({userId:"",prompt:"",page:1,size:10}),k=d([]);async function p(){m.value=!0;try{const r=await Z.queryChatAll(l);m.value=!1;const{rows:n,count:f}=r.data;y.value=f,k.value=n}catch{m.value=!1}}async function U(r){const n=await X.queryAllUser({size:30,username:r});v.value=n.data.rows}function D(r){r==null||r.resetFields(),p()}return j(()=>{p()}),(r,n)=>{const f=H,I=a("el-option"),M=a("el-select"),w=a("el-form-item"),L=a("el-input"),z=a("el-button"),S=a("el-form"),x=F,s=a("el-table-column"),q=a("el-popover"),B=a("el-table"),K=a("el-pagination"),R=a("el-row"),Y=P("loading");return c(),C("div",null,[t(f,null,{title:o(()=>[ee]),_:1}),t(x,null,{default:o(()=>[t(S,{ref_key:"formRef",ref:b,inline:!0,model:l},{default:o(()=>[t(w,{label:"用户名称",prop:"userId"},{default:o(()=>[t(M,{modelValue:l.userId,"onUpdate:modelValue":n[0]||(n[0]=e=>l.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"用户姓名[模糊搜索]","remote-show-suffix":"","remote-method":U,style:{width:"160px"}},{default:o(()=>[(c(!0),C(O,null,G(i(v),e=>(c(),T(I,{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(L,{modelValue:l.prompt,"onUpdate:modelValue":n[1]||(n[1]=e=>l.prompt=e),placeholder:"提问问题[模糊搜索]",onKeydown:J(Q(p,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1}),t(w,null,{default:o(()=>[t(z,{type:"primary",onClick:p},{default:o(()=>[u(" 查询 ")]),_:1}),t(z,{onClick:n[2]||(n[2]=e=>D(i(b)))},{default:o(()=>[u(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),t(x,{style:{width:"100%"}},{default:o(()=>[W((c(),T(B,{border:"",data:i(k),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=>[u(_(e.row.role==="user"?"用户":"电脑"),1)]),_:1}),t(s,{prop:"email",label:"用户邮箱",width:"200"}),t(s,{prop:"answer",label:"用户询问/AI回复"},{default:o(e=>[t(q,{placement:"top",width:400,trigger:"click"},{reference:o(()=>[h("div",te,_(e.row.role==="user"?e.row.prompt:e.row.answer),1)]),default:o(()=>[h("div",{class:"answer_container",innerHTML:i(g)(e.row.role==="user"?e.row.prompt:e.row.answer||"")},null,8,oe)]),_:2},1024)]),_:1}),t(s,{prop:"completionTokens",label:"提问/回答Token",width:"140",align:"center"},{default:o(e=>[u(_(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=>[u(_(i(E)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[Y,i(m)]]),t(R,{class:"mt-5 flex justify-end"},{default:o(()=>[t(K,{"current-page":l.page,"onUpdate:currentPage":n[3]||(n[3]=e=>l.page=e),"page-size":l.size,"onUpdate:pageSize":n[4]||(n[4]=e=>l.size=e),class:"mr-5","page-sizes":[10,20,30,50],layout:"total, sizes, prev, pager, next, jumper",total:i(y),onSizeChange:p,onCurrentChange:p},null,8,["current-page","page-size","total"])]),_:1})]),_:1})])}}});typeof A=="function"&&A(ne);export{ne as default}; import{_ as F}from"./index.vue_vue_type_script_setup_true_lang-CHWp65cL.js";import{_ as H}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{d as N,r as d,m as $,a as j,n as a,q as P,g as c,c as C,b as t,w as o,F as O,s as G,i,v as J,x as Q,h as u,y as W,z as T,t as _,e as h,K as X,k as A}from"./index-CAe0BuuW.js";import{A as Z}from"./chat-BAyuGdeQ.js";import{u as E}from"./utcformatTime-Bq4gDWNx.js";import{m as g}from"./marked.esm-8ZxQ78w7.js";const ee=h("div",{class:"flex items-center gap-4"},"对话记录",-1),te={class:"answer"},oe=["innerHTML"],ne=N({__name:"chat",setup(ae){const V=new g.Renderer;g.setOptions({renderer:V,gfm:!0,pedantic:!1});const m=d(!1),v=d(),b=d(),y=d(0),l=$({userId:"",prompt:"",page:1,size:10}),k=d([]);async function p(){m.value=!0;try{const r=await Z.queryChatAll(l);m.value=!1;const{rows:n,count:f}=r.data;y.value=f,k.value=n}catch{m.value=!1}}async function U(r){const n=await X.queryAllUser({size:30,username:r});v.value=n.data.rows}function D(r){r==null||r.resetFields(),p()}return j(()=>{p()}),(r,n)=>{const f=H,I=a("el-option"),M=a("el-select"),w=a("el-form-item"),L=a("el-input"),z=a("el-button"),S=a("el-form"),x=F,s=a("el-table-column"),q=a("el-popover"),B=a("el-table"),K=a("el-pagination"),R=a("el-row"),Y=P("loading");return c(),C("div",null,[t(f,null,{title:o(()=>[ee]),_:1}),t(x,null,{default:o(()=>[t(S,{ref_key:"formRef",ref:b,inline:!0,model:l},{default:o(()=>[t(w,{label:"用户名称",prop:"userId"},{default:o(()=>[t(M,{modelValue:l.userId,"onUpdate:modelValue":n[0]||(n[0]=e=>l.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"用户姓名[模糊搜索]","remote-show-suffix":"","remote-method":U,style:{width:"160px"}},{default:o(()=>[(c(!0),C(O,null,G(i(v),e=>(c(),T(I,{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(L,{modelValue:l.prompt,"onUpdate:modelValue":n[1]||(n[1]=e=>l.prompt=e),placeholder:"提问问题[模糊搜索]",onKeydown:J(Q(p,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1}),t(w,null,{default:o(()=>[t(z,{type:"primary",onClick:p},{default:o(()=>[u(" 查询 ")]),_:1}),t(z,{onClick:n[2]||(n[2]=e=>D(i(b)))},{default:o(()=>[u(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),t(x,{style:{width:"100%"}},{default:o(()=>[W((c(),T(B,{border:"",data:i(k),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=>[u(_(e.row.role==="user"?"用户":"电脑"),1)]),_:1}),t(s,{prop:"email",label:"用户邮箱",width:"200"}),t(s,{prop:"answer",label:"用户询问/AI回复"},{default:o(e=>[t(q,{placement:"top",width:400,trigger:"click"},{reference:o(()=>[h("div",te,_(e.row.role==="user"?e.row.prompt:e.row.answer),1)]),default:o(()=>[h("div",{class:"answer_container",innerHTML:i(g)(e.row.role==="user"?e.row.prompt:e.row.answer||"")},null,8,oe)]),_:2},1024)]),_:1}),t(s,{prop:"completionTokens",label:"提问/回答Token",width:"140",align:"center"},{default:o(e=>[u(_(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=>[u(_(i(E)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[Y,i(m)]]),t(R,{class:"mt-5 flex justify-end"},{default:o(()=>[t(K,{"current-page":l.page,"onUpdate:currentPage":n[3]||(n[3]=e=>l.page=e),"page-size":l.size,"onUpdate:pageSize":n[4]||(n[4]=e=>l.size=e),class:"mr-5","page-sizes":[10,20,30,50],layout:"total, sizes, prev, pager, next, jumper",total:i(y),onSizeChange:p,onCurrentChange:p},null,8,["current-page","page-size","total"])]),_:1})]),_:1})])}}});typeof A=="function"&&A(ne);export{ne as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as P}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{d as j,m as B,r as N,p as q,a as A,n,g as E,c as R,b as e,w as t,h as c,e as s,i as g,E as y,j as $,_ as H,k as b}from"./index-DEc4xym2.js";import{a as x}from"./config-BQ9gBCXa.js";const I=s("div",{class:"flex items-center gap-4"},"Chevereto图床设置",-1),M=s("div",{class:"text-sm/6"},[s("div",null,[c(" 详细搭建及配置请参考 "),s("a",{href:"https://v4-docs.chevereto.com/developer/api/api-v1.html",target:"_blank"},"Chevereto图床文档"),c(" 。如果同时开启多个存储服务,腾讯云、阿里云优先级高于 Chevereto 图床。 ")])],-1),O={class:"flex justify-between"},T=s("b",null,"chevereto图床参数设置",-1),z=j({__name:"chevereto",setup(D){const l=B({cheveretoStatus:"",cheveretoUploadPath:"",cheveretoKey:""}),_=N();async function m(){const a=await x.queryConfig({keys:["cheveretoKey","cheveretoUploadPath","cheveretoStatus"]});Object.assign(l,a.data)}function p(){var a;(a=_.value)==null||a.validate(async o=>{if(o){try{await x.setConfig({settings:w(l)}),y.success("变更配置信息成功")}catch{}m()}else y.error("请填写完整信息")})}function w(a){return Object.keys(a).map(o=>({configKey:o,configVal:a[o]}))}const f=q(()=>[{required:Number(l.cheveretoStatus)===1,message:"开启配置后请填写此项",trigger:"change"}]);return A(()=>{m()}),(a,o)=>{const h=$,V=H,C=P,k=n("el-button"),U=n("el-switch"),u=n("el-form-item"),d=n("el-col"),i=n("el-row"),v=n("el-input"),K=n("el-form"),S=n("el-card");return E(),R("div",null,[e(C,null,{title:t(()=>[I]),content:t(()=>[M]),default:t(()=>[e(V,{outline:"",onClick:p},{default:t(()=>[e(h,{name:"i-ri:file-text-line"}),c(" 保存设置 ")]),_:1})]),_:1}),e(S,{style:{margin:"20px"}},{header:t(()=>[s("div",O,[T,e(k,{class:"button",text:"",onClick:p},{default:t(()=>[c(" 保存设置 ")]),_:1})])]),default:t(()=>[e(K,{ref_key:"formRef",ref:_,model:l,"label-width":"100px"},{default:t(()=>[e(i,null,{default:t(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(u,{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(i,null,{default:t(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(u,{label:"上传地址",prop:"cheveretoUploadPath",rules:g(f)},{default:t(()=>[e(v,{modelValue:l.cheveretoUploadPath,"onUpdate:modelValue":o[1]||(o[1]=r=>l.cheveretoUploadPath=r),placeholder:"请填写您的图床上传地址",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(i,null,{default:t(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(u,{label:"ApiKey",prop:"cheveretoKey",rules:g(f)},{default:t(()=>[e(v,{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 b=="function"&&b(z);export{z as default}; import{_ as P}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{d as j,m as B,r as N,p as q,a as A,n,g as E,c as R,b as e,w as t,h as c,e as s,i as g,E as y,j as $,_ as H,k as b}from"./index-CAe0BuuW.js";import{a as x}from"./config-CwtVyG0K.js";const I=s("div",{class:"flex items-center gap-4"},"Chevereto图床设置",-1),M=s("div",{class:"text-sm/6"},[s("div",null,[c(" 详细搭建及配置请参考 "),s("a",{href:"https://v4-docs.chevereto.com/developer/api/api-v1.html",target:"_blank"},"Chevereto图床文档"),c(" 。如果同时开启多个存储服务,腾讯云、阿里云优先级高于 Chevereto 图床。 ")])],-1),O={class:"flex justify-between"},T=s("b",null,"chevereto图床参数设置",-1),z=j({__name:"chevereto",setup(D){const l=B({cheveretoStatus:"",cheveretoUploadPath:"",cheveretoKey:""}),_=N();async function m(){const a=await x.queryConfig({keys:["cheveretoKey","cheveretoUploadPath","cheveretoStatus"]});Object.assign(l,a.data)}function p(){var a;(a=_.value)==null||a.validate(async o=>{if(o){try{await x.setConfig({settings:w(l)}),y.success("变更配置信息成功")}catch{}m()}else y.error("请填写完整信息")})}function w(a){return Object.keys(a).map(o=>({configKey:o,configVal:a[o]}))}const f=q(()=>[{required:Number(l.cheveretoStatus)===1,message:"开启配置后请填写此项",trigger:"change"}]);return A(()=>{m()}),(a,o)=>{const h=$,V=H,C=P,k=n("el-button"),U=n("el-switch"),u=n("el-form-item"),d=n("el-col"),i=n("el-row"),v=n("el-input"),K=n("el-form"),S=n("el-card");return E(),R("div",null,[e(C,null,{title:t(()=>[I]),content:t(()=>[M]),default:t(()=>[e(V,{outline:"",onClick:p},{default:t(()=>[e(h,{name:"i-ri:file-text-line"}),c(" 保存设置 ")]),_:1})]),_:1}),e(S,{style:{margin:"20px"}},{header:t(()=>[s("div",O,[T,e(k,{class:"button",text:"",onClick:p},{default:t(()=>[c(" 保存设置 ")]),_:1})])]),default:t(()=>[e(K,{ref_key:"formRef",ref:_,model:l,"label-width":"100px"},{default:t(()=>[e(i,null,{default:t(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(u,{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(i,null,{default:t(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(u,{label:"上传地址",prop:"cheveretoUploadPath",rules:g(f)},{default:t(()=>[e(v,{modelValue:l.cheveretoUploadPath,"onUpdate:modelValue":o[1]||(o[1]=r=>l.cheveretoUploadPath=r),placeholder:"请填写您的图床上传地址",clearable:""},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1})]),_:1}),e(i,null,{default:t(()=>[e(d,{xs:24,md:20,lg:15,xl:12},{default:t(()=>[e(u,{label:"ApiKey",prop:"cheveretoKey",rules:g(f)},{default:t(()=>[e(v,{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 b=="function"&&b(z);export{z as default};

File diff suppressed because one or more lines are too long

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{I as o}from"./index-DEc4xym2.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{I as o}from"./index-CAe0BuuW.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

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

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as E}from"./index.vue_vue_type_script_setup_true_lang-DKdjIYRj.js";import{_ as F}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{d as M,u as O,r as u,m as P,a as G,n as c,q as H,g as s,c as b,b as l,w as t,i as n,V as C,v as I,x as j,F as W,s as N,h as m,y as J,z as f,D as Q,e as X,G as Y,E as R,t as Z,k as S}from"./index-DEc4xym2.js";import{A as g}from"./badWords-CQd8mmw9.js";import{E as ee}from"./index-J5zVJPyL.js";const te=X("div",{class:"flex items-center gap-4"},"自定义敏感词",-1),ae=M({__name:"custom",setup(le){O();const k=u(),D=u(0),p=u(!1),r=P({word:"",status:"",page:1,size:500}),V=u();async function i(){try{p.value=!0;const o=await g.queryBadWords(r),{rows:a,count:v}=o.data;p.value=!1,D.value=v,V.value=a}catch{p.value=!1}}function T(o){o==null||o.resetFields(),i()}G(()=>{i()});const d=u(""),_=u(!1),B=u();async function z(o){await g.delBadWords({id:o}),R.success("删除敏感词成功"),await i()}function A(){_.value=!0,Y(()=>{B.value.input.focus()})}async function h(){d.value&&(await g.addBadWords({word:d.value}),R.success("添加敏感词成功"),r.status="",await i()),_.value=!1,d.value=""}return(o,a)=>{const v=F,w=c("el-form-item"),K=c("el-option"),L=c("el-select"),y=c("el-button"),U=c("el-form"),x=E,$=c("el-tag"),q=H("loading");return s(),b("div",null,[l(v,null,{title:t(()=>[te]),_:1}),l(x,null,{default:t(()=>[l(U,{ref_key:"formRef",ref:k,inline:!0,model:r},{default:t(()=>[l(w,{label:"敏感词",prop:"word"},{default:t(()=>[l(n(C),{modelValue:r.word,"onUpdate:modelValue":a[0]||(a[0]=e=>r.word=e),placeholder:"敏感词[模糊搜索]",onKeydown:I(j(i,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1}),l(w,{label:"敏感词状态",prop:"status"},{default:t(()=>[l(L,{modelValue:r.status,"onUpdate:modelValue":a[1]||(a[1]=e=>r.status=e),placeholder:"请选择敏感词状态",clearable:"",style:{width:"160px"}},{default:t(()=>[(s(!0),b(W,null,N(n(ee),e=>(s(),f(K,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(w,null,{default:t(()=>[l(y,{type:"primary",onClick:i},{default:t(()=>[m(" 查询 ")]),_:1}),l(y,{onClick:a[2]||(a[2]=e=>T(n(k)))},{default:t(()=>[m(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),J((s(),f(x,{style:{width:"100%"}},{default:t(()=>[(s(!0),b(W,null,N(n(V),e=>(s(),f($,{key:e.id,type:"warning",class:"mb-3 mr-3",closable:"",hit:"","disable-transitions":!0,onClose:oe=>z(e.id)},{default:t(()=>[m(Z(e.word),1)]),_:2},1032,["onClose"]))),128)),n(_)?(s(),f(n(C),{key:0,ref_key:"InputRef",ref:B,modelValue:n(d),"onUpdate:modelValue":a[3]||(a[3]=e=>Q(d)?d.value=e:null),class:"ml-1",style:{width:"80px"},size:"small",onKeyup:I(h,["enter"]),onBlur:h},null,8,["modelValue"])):(s(),f(y,{key:1,class:"ml-1",size:"small",onClick:A},{default:t(()=>[m(" + New Word ")]),_:1}))]),_:1})),[[q,n(p)]])])}}});typeof S=="function"&&S(ae);export{ae as default}; import{_ as E}from"./index.vue_vue_type_script_setup_true_lang-CHWp65cL.js";import{_ as F}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{d as M,u as O,r as u,m as P,a as G,n as c,q as H,g as s,c as b,b as l,w as t,i as n,V as C,v as I,x as j,F as W,s as N,h as m,y as J,z as f,D as Q,e as X,G as Y,E as R,t as Z,k as S}from"./index-CAe0BuuW.js";import{A as g}from"./badWords-Jbq96Z0c.js";import{E as ee}from"./index-DfBvkKrB.js";const te=X("div",{class:"flex items-center gap-4"},"自定义敏感词",-1),ae=M({__name:"custom",setup(le){O();const k=u(),D=u(0),p=u(!1),r=P({word:"",status:"",page:1,size:500}),V=u();async function i(){try{p.value=!0;const o=await g.queryBadWords(r),{rows:a,count:v}=o.data;p.value=!1,D.value=v,V.value=a}catch{p.value=!1}}function T(o){o==null||o.resetFields(),i()}G(()=>{i()});const d=u(""),_=u(!1),B=u();async function z(o){await g.delBadWords({id:o}),R.success("删除敏感词成功"),await i()}function A(){_.value=!0,Y(()=>{B.value.input.focus()})}async function h(){d.value&&(await g.addBadWords({word:d.value}),R.success("添加敏感词成功"),r.status="",await i()),_.value=!1,d.value=""}return(o,a)=>{const v=F,w=c("el-form-item"),K=c("el-option"),L=c("el-select"),y=c("el-button"),U=c("el-form"),x=E,$=c("el-tag"),q=H("loading");return s(),b("div",null,[l(v,null,{title:t(()=>[te]),_:1}),l(x,null,{default:t(()=>[l(U,{ref_key:"formRef",ref:k,inline:!0,model:r},{default:t(()=>[l(w,{label:"敏感词",prop:"word"},{default:t(()=>[l(n(C),{modelValue:r.word,"onUpdate:modelValue":a[0]||(a[0]=e=>r.word=e),placeholder:"敏感词[模糊搜索]",onKeydown:I(j(i,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1}),l(w,{label:"敏感词状态",prop:"status"},{default:t(()=>[l(L,{modelValue:r.status,"onUpdate:modelValue":a[1]||(a[1]=e=>r.status=e),placeholder:"请选择敏感词状态",clearable:"",style:{width:"160px"}},{default:t(()=>[(s(!0),b(W,null,N(n(ee),e=>(s(),f(K,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(w,null,{default:t(()=>[l(y,{type:"primary",onClick:i},{default:t(()=>[m(" 查询 ")]),_:1}),l(y,{onClick:a[2]||(a[2]=e=>T(n(k)))},{default:t(()=>[m(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),J((s(),f(x,{style:{width:"100%"}},{default:t(()=>[(s(!0),b(W,null,N(n(V),e=>(s(),f($,{key:e.id,type:"warning",class:"mb-3 mr-3",closable:"",hit:"","disable-transitions":!0,onClose:oe=>z(e.id)},{default:t(()=>[m(Z(e.word),1)]),_:2},1032,["onClose"]))),128)),n(_)?(s(),f(n(C),{key:0,ref_key:"InputRef",ref:B,modelValue:n(d),"onUpdate:modelValue":a[3]||(a[3]=e=>Q(d)?d.value=e:null),class:"ml-1",style:{width:"80px"},size:"small",onKeyup:I(h,["enter"]),onBlur:h},null,8,["modelValue"])):(s(),f(y,{key:1,class:"ml-1",size:"small",onClick:A},{default:t(()=>[m(" + New Word ")]),_:1}))]),_:1})),[[q,n(p)]])])}}});typeof S=="function"&&S(ae);export{ae as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as P}from"./index.vue_vue_type_script_setup_true_lang-DKdjIYRj.js";import{_ as H}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{A as K}from"./chat-CNvkcurJ.js";import{d as O,r as p,m as W,a as G,n as o,q as J,g as i,c as g,b as t,w as l,F as U,s as V,i as S,h as c,y as Q,z as w,t as _,e as v,K as X,k as L}from"./index-DEc4xym2.js";import{D as Z}from"./index-J5zVJPyL.js";import{u as E}from"./utcformatTime-Bq4gDWNx.js";const ee=v("div",{class:"flex items-center gap-4"},"绘画记录",-1),te={class:"answer"},le={class:"answer_container"},ae=O({__name:"draw",setup(oe){const u=p(!1),b=p(),h=p(0),y=p(),n=W({userId:"",rec:"",model:"",page:1,size:14}),k=p([]);async function d(){u.value=!0;try{const r=await K.queryDrawAll(n),{rows:a,count:m}=r.data;u.value=!1,h.value=m,k.value=a}catch{u.value=!1}}async function q(r){const a=await X.queryAllUser({size:30,username:r});y.value=a.data.rows}function B(r){r==null||r.resetFields(),d()}return G(()=>{d()}),(r,a)=>{const m=H,z=o("el-option"),D=o("el-select"),f=o("el-form-item"),x=o("el-button"),M=o("el-form"),I=P,s=o("el-table-column"),R=o("el-image"),T=o("el-tag"),Y=o("el-popover"),F=o("el-table"),N=o("el-pagination"),$=o("el-row"),j=J("loading");return i(),g("div",null,[t(m,null,{title:l(()=>[ee]),_:1}),t(I,null,{default:l(()=>[t(M,{ref_key:"formRef",ref:b,inline:!0,model:n},{default:l(()=>[t(f,{label:"用户名称",prop:"userId"},{default:l(()=>[t(D,{modelValue:n.userId,"onUpdate:modelValue":a[0]||(a[0]=e=>n.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"用户姓名[模糊搜索]","remote-show-suffix":"","remote-method":q,style:{width:"160px"}},{default:l(()=>[(i(!0),g(U,null,V(y.value,e=>(i(),w(z,{key:e.id,label:e.username,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(f,{label:"绘画模型",prop:"model"},{default:l(()=>[t(D,{modelValue:n.model,"onUpdate:modelValue":a[1]||(a[1]=e=>n.model=e),placeholder:"请选择绘画模型",clearable:"",style:{width:"160px"}},{default:l(()=>[(i(!0),g(U,null,V(S(Z),e=>(i(),w(z,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(f,null,{default:l(()=>[t(x,{type:"primary",onClick:d},{default:l(()=>[c(" 查询 ")]),_:1}),t(x,{onClick:a[2]||(a[2]=e=>B(b.value))},{default:l(()=>[c(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),t(I,{style:{width:"100%"}},{default:l(()=>[Q((i(),w(F,{border:"",data:k.value,style:{width:"100%"},size:"large"},{default:l(()=>[t(s,{prop:"id",align:"center",label:"ID",width:"70"}),t(s,{prop:"userInfo.username",align:"center",label:"用户名",width:"120"}),t(s,{prop:"userInfo.email",align:"center",label:"用户邮箱",width:"200"}),t(s,{prop:"drawUrl",align:"center",label:"绘图结果",width:"200"},{default:l(e=>{var A,C;return[t(R,{style:{height:"50px"},"preview-teleported":"",fit:"contain","preview-src-list":[(A=e.row)==null?void 0:A.drawUrl],src:(C=e.row)==null?void 0:C.fileInfo,lazy:"","hide-on-click-modal":""},null,8,["preview-src-list","src"])]}),_:1}),t(s,{prop:"model",label:"种类",width:"180",align:"center"},{default:l(e=>[t(T,{type:"success"},{default:l(()=>[c(_(e.row.model),1)]),_:2},1024)]),_:1}),t(s,{prop:"prompt",label:"绘图指令",align:"center",width:"250"},{default:l(e=>[t(Y,{placement:"top",width:400,trigger:"click"},{reference:l(()=>[v("div",te,_(e.row.prompt),1)]),default:l(()=>[v("div",le,_(e.row.prompt),1)]),_:2},1024)]),_:1}),t(s,{prop:"progress",align:"center",label:"绘图进度",width:"90"}),t(s,{prop:"createdAt",label:"绘图时间",align:"center",width:"200"},{default:l(e=>[c(_(S(E)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[j,u.value]]),t($,{class:"mt-5 flex justify-end"},{default:l(()=>[t(N,{"current-page":n.page,"onUpdate:currentPage":a[3]||(a[3]=e=>n.page=e),"page-size":n.size,"onUpdate:pageSize":a[4]||(a[4]=e=>n.size=e),class:"mr-5","page-sizes":[10,20,30,50],layout:"total, sizes, prev, pager, next, jumper",total:h.value,onSizeChange:d,onCurrentChange:d},null,8,["current-page","page-size","total"])]),_:1})]),_:1})])}}});typeof L=="function"&&L(ae);export{ae as default}; import{_ as P}from"./index.vue_vue_type_script_setup_true_lang-CHWp65cL.js";import{_ as H}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{A as K}from"./chat-BAyuGdeQ.js";import{d as O,r as p,m as W,a as G,n as o,q as J,g as i,c as g,b as t,w as l,F as V,s as U,i as S,h as c,y as Q,z as w,t as _,e as v,K as X,k as L}from"./index-CAe0BuuW.js";import{D as Z}from"./index-DfBvkKrB.js";import{u as E}from"./utcformatTime-Bq4gDWNx.js";const ee=v("div",{class:"flex items-center gap-4"},"绘画记录",-1),te={class:"answer"},le={class:"answer_container"},ae=O({__name:"draw",setup(oe){const u=p(!1),b=p(),h=p(0),y=p(),n=W({userId:"",rec:"",model:"",page:1,size:14}),k=p([]);async function d(){u.value=!0;try{const r=await K.queryDrawAll(n),{rows:a,count:m}=r.data;u.value=!1,h.value=m,k.value=a}catch{u.value=!1}}async function q(r){const a=await X.queryAllUser({size:30,username:r});y.value=a.data.rows}function B(r){r==null||r.resetFields(),d()}return G(()=>{d()}),(r,a)=>{const m=H,z=o("el-option"),D=o("el-select"),f=o("el-form-item"),x=o("el-button"),M=o("el-form"),I=P,s=o("el-table-column"),R=o("el-image"),T=o("el-tag"),Y=o("el-popover"),F=o("el-table"),N=o("el-pagination"),$=o("el-row"),j=J("loading");return i(),g("div",null,[t(m,null,{title:l(()=>[ee]),_:1}),t(I,null,{default:l(()=>[t(M,{ref_key:"formRef",ref:b,inline:!0,model:n},{default:l(()=>[t(f,{label:"用户名称",prop:"userId"},{default:l(()=>[t(D,{modelValue:n.userId,"onUpdate:modelValue":a[0]||(a[0]=e=>n.userId=e),filterable:"",clearable:"",remote:"","reserve-keyword":"",placeholder:"用户姓名[模糊搜索]","remote-show-suffix":"","remote-method":q,style:{width:"160px"}},{default:l(()=>[(i(!0),g(V,null,U(y.value,e=>(i(),w(z,{key:e.id,label:e.username,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(f,{label:"绘画模型",prop:"model"},{default:l(()=>[t(D,{modelValue:n.model,"onUpdate:modelValue":a[1]||(a[1]=e=>n.model=e),placeholder:"请选择绘画模型",clearable:"",style:{width:"160px"}},{default:l(()=>[(i(!0),g(V,null,U(S(Z),e=>(i(),w(z,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(f,null,{default:l(()=>[t(x,{type:"primary",onClick:d},{default:l(()=>[c(" 查询 ")]),_:1}),t(x,{onClick:a[2]||(a[2]=e=>B(b.value))},{default:l(()=>[c(" 重置 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),t(I,{style:{width:"100%"}},{default:l(()=>[Q((i(),w(F,{border:"",data:k.value,style:{width:"100%"},size:"large"},{default:l(()=>[t(s,{prop:"id",align:"center",label:"ID",width:"70"}),t(s,{prop:"userInfo.username",align:"center",label:"用户名",width:"120"}),t(s,{prop:"userInfo.email",align:"center",label:"用户邮箱",width:"200"}),t(s,{prop:"drawUrl",align:"center",label:"绘图结果",width:"200"},{default:l(e=>{var A,C;return[t(R,{style:{height:"50px"},"preview-teleported":"",fit:"contain","preview-src-list":[(A=e.row)==null?void 0:A.fileInfo],src:(C=e.row)==null?void 0:C.fileInfo,lazy:"","hide-on-click-modal":""},null,8,["preview-src-list","src"])]}),_:1}),t(s,{prop:"model",label:"种类",width:"180",align:"center"},{default:l(e=>[t(T,{type:"success"},{default:l(()=>[c(_(e.row.model),1)]),_:2},1024)]),_:1}),t(s,{prop:"prompt",label:"绘图指令",align:"center",width:"250"},{default:l(e=>[t(Y,{placement:"top",width:400,trigger:"click"},{reference:l(()=>[v("div",te,_(e.row.prompt),1)]),default:l(()=>[v("div",le,_(e.row.prompt),1)]),_:2},1024)]),_:1}),t(s,{prop:"progress",align:"center",label:"绘图进度",width:"90"}),t(s,{prop:"createdAt",label:"绘图时间",align:"center",width:"200"},{default:l(e=>[c(_(S(E)(e.row.createdAt,"YYYY-MM-DD hh:mm:ss")),1)]),_:1})]),_:1},8,["data"])),[[j,u.value]]),t($,{class:"mt-5 flex justify-end"},{default:l(()=>[t(N,{"current-page":n.page,"onUpdate:currentPage":a[3]||(a[3]=e=>n.page=e),"page-size":n.size,"onUpdate:pageSize":a[4]||(a[4]=e=>n.size=e),class:"mr-5","page-sizes":[10,20,30,50],layout:"total, sizes, prev, pager, next, jumper",total:h.value,onSizeChange:d,onCurrentChange:d},null,8,["current-page","page-size","total"])]),_:1})]),_:1})])}}});typeof L=="function"&&L(ae);export{ae as default};

File diff suppressed because one or more lines are too long

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as b,r as i,a as z,S as B,g as v,c as x,P as M,Q as R,i as n,l as T,N as $,f as L,L as N,n as l,b as e,w as t,h as g,K as A,E as F,k as h}from"./index-DEc4xym2.js";import{_ as I}from"./index.vue_vue_type_script_setup_true_lang-DKdjIYRj.js";import{_ as K}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{u as Q}from"./useMainPage-qAU7S-kt.js";const j=b({name:"FixedActionBar",__name:"index",setup(y){const p=i(!1);z(()=>{d(),window.addEventListener("scroll",d)}),B(()=>{window.removeEventListener("scroll",d)});function d(){const u=document.documentElement.scrollTop||document.body.scrollTop,r=document.documentElement.clientHeight||document.body.clientHeight,o=document.documentElement.scrollHeight||document.body.scrollHeight;p.value=Math.ceil(u+r)>=o}return(u,r)=>(v(),x("div",{class:R(["fixed-action-bar bottom-0 z-4 bg-[var(--g-container-bg)] p-5 text-center transition",{shadow:!n(p)}]),"data-fixed-calc-width":""},[M(u.$slots,"default",{},void 0,!0)],2))}}),D=T(j,[["__scopeId","data-v-9af45002"]]),G=b({__name:"edit.password",setup(y){const p=$(),d=L(),u=N(),r=i(),o=i({password:"",newpassword:"",checkpassword:""}),k=Q(),V=i({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:(m,s,a)=>{s!==o.value.newpassword?a(new Error("两次密码不一致!")):a()}}]});function E(){r.value&&r.value.validate(m=>{if(m){const{password:s,newpassword:a}=o.value;A.passwordEdit({oldPassword:s,password:a}).then(()=>{F({type:"success",message:"修改密码成功,请重新登录"}),u.logout().then(()=>{d.push({name:"login",query:{redirect:p.fullPath}})})})}})}function C(){k.reload()}return(m,s)=>{const a=K,_=l("el-input"),w=l("el-form-item"),H=l("el-form"),S=l("el-col"),U=l("el-row"),P=I,f=l("el-button"),q=D;return v(),x("div",null,[e(a,{title:"修改密码",content:"定期修改密码可以提高帐号安全性噢~"}),e(P,null,{default:t(()=>[e(U,null,{default:t(()=>[e(S,{md:24,lg:12},{default:t(()=>[e(H,{ref_key:"formRef",ref:r,model:n(o),rules:n(V),"label-width":"120px"},{default:t(()=>[e(w,{label:"原密码",prop:"password"},{default:t(()=>[e(_,{modelValue:n(o).password,"onUpdate:modelValue":s[0]||(s[0]=c=>n(o).password=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(w,{label:"新密码",prop:"newpassword"},{default:t(()=>[e(_,{modelValue:n(o).newpassword,"onUpdate:modelValue":s[1]||(s[1]=c=>n(o).newpassword=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(w,{label:"确认新密码",prop:"checkpassword"},{default:t(()=>[e(_,{modelValue:n(o).checkpassword,"onUpdate:modelValue":s[2]||(s[2]=c=>n(o).checkpassword=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1})]),_:1})]),_:1}),e(q,null,{default:t(()=>[e(f,{type:"primary",size:"large",onClick:E},{default:t(()=>[g(" 提交 ")]),_:1}),e(f,{type:"default",size:"large",onClick:C},{default:t(()=>[g(" 取消 ")]),_:1})]),_:1})])}}});typeof h=="function"&&h(G);export{G as default}; import{d as b,r as i,a as z,S as B,g as v,c as x,P as M,Q as R,i as n,l as T,N as $,f as L,L as N,n as l,b as e,w as t,h as g,K as A,E as F,k as h}from"./index-CAe0BuuW.js";import{_ as I}from"./index.vue_vue_type_script_setup_true_lang-CHWp65cL.js";import{_ as K}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{u as Q}from"./useMainPage-PJO-ub0s.js";const j=b({name:"FixedActionBar",__name:"index",setup(y){const p=i(!1);z(()=>{d(),window.addEventListener("scroll",d)}),B(()=>{window.removeEventListener("scroll",d)});function d(){const u=document.documentElement.scrollTop||document.body.scrollTop,r=document.documentElement.clientHeight||document.body.clientHeight,o=document.documentElement.scrollHeight||document.body.scrollHeight;p.value=Math.ceil(u+r)>=o}return(u,r)=>(v(),x("div",{class:R(["fixed-action-bar bottom-0 z-4 bg-[var(--g-container-bg)] p-5 text-center transition",{shadow:!n(p)}]),"data-fixed-calc-width":""},[M(u.$slots,"default",{},void 0,!0)],2))}}),D=T(j,[["__scopeId","data-v-9af45002"]]),G=b({__name:"edit.password",setup(y){const p=$(),d=L(),u=N(),r=i(),o=i({password:"",newpassword:"",checkpassword:""}),k=Q(),V=i({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:(m,s,a)=>{s!==o.value.newpassword?a(new Error("两次密码不一致!")):a()}}]});function E(){r.value&&r.value.validate(m=>{if(m){const{password:s,newpassword:a}=o.value;A.passwordEdit({oldPassword:s,password:a}).then(()=>{F({type:"success",message:"修改密码成功,请重新登录"}),u.logout().then(()=>{d.push({name:"login",query:{redirect:p.fullPath}})})})}})}function C(){k.reload()}return(m,s)=>{const a=K,_=l("el-input"),w=l("el-form-item"),H=l("el-form"),S=l("el-col"),U=l("el-row"),P=I,f=l("el-button"),q=D;return v(),x("div",null,[e(a,{title:"修改密码",content:"定期修改密码可以提高帐号安全性噢~"}),e(P,null,{default:t(()=>[e(U,null,{default:t(()=>[e(S,{md:24,lg:12},{default:t(()=>[e(H,{ref_key:"formRef",ref:r,model:n(o),rules:n(V),"label-width":"120px"},{default:t(()=>[e(w,{label:"原密码",prop:"password"},{default:t(()=>[e(_,{modelValue:n(o).password,"onUpdate:modelValue":s[0]||(s[0]=c=>n(o).password=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(w,{label:"新密码",prop:"newpassword"},{default:t(()=>[e(_,{modelValue:n(o).newpassword,"onUpdate:modelValue":s[1]||(s[1]=c=>n(o).newpassword=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1}),e(w,{label:"确认新密码",prop:"checkpassword"},{default:t(()=>[e(_,{modelValue:n(o).checkpassword,"onUpdate:modelValue":s[2]||(s[2]=c=>n(o).checkpassword=c),type:"password",placeholder:"请输入原密码","show-password":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1})]),_:1})]),_:1}),e(q,null,{default:t(()=>[e(f,{type:"primary",size:"large",onClick:E},{default:t(()=>[g(" 提交 ")]),_:1}),e(f,{type:"default",size:"large",onClick:C},{default:t(()=>[g(" 取消 ")]),_:1})]),_:1})])}}});typeof h=="function"&&h(G);export{G 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

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{l as o,g as c,c as n}from"./index-DEc4xym2.js";const s={mounted(){const e=this.decrypt("Z2l0aHViLmNvbS92YXN0eGllLzk5QUk=");if(e){const t=`https://${e}`;window.open(t,"_blank"),this.$router.go(-1)}else console.error("解密失败或无效的地址")},methods:{decrypt(r){try{return atob(r)}catch(e){return console.error("解密失败",e),""}}}};function l(r,e,t,d,p,a){return c(),n("div")}const u=o(s,[["render",l]]);export{u as default}; import{l as o,g as c,c as n}from"./index-CAe0BuuW.js";const s={mounted(){const e=this.decrypt("Z2l0aHViLmNvbS92YXN0eGllLzk5QUk=");if(e){const t=`https://${e}`;window.open(t,"_blank"),this.$router.go(-1)}else console.error("解密失败或无效的地址")},methods:{decrypt(r){try{return atob(r)}catch(e){return console.error("解密失败",e),""}}}};function l(r,e,t,d,p,a){return c(),n("div")}const u=o(s,[["render",l]]);export{u as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as v}from"./index.vue_vue_type_script_setup_true_lang-DKdjIYRj.js";import{a as _}from"./config-BQ9gBCXa.js";import{d as V,m as j,r as m,a as q,n as o,g as B,c as E,b as e,w as s,e as u,h as N,E as i,k as f}from"./index-DEc4xym2.js";const A={class:"flex justify-between"},O=u("b",null,"模型系统消息预设",-1),R=V({__name:"globalPre",setup(U){const a=j({systemPreMessage:""}),d=m({systemPreMessage:[{required:!0,trigger:"blur",message:"请填写全局预设信息、用于模型预设词"}]}),l=m();async function r(){const t=await _.queryConfig({keys:["systemPreMessage"]});Object.assign(a,t.data)}function p(){var t;(t=l.value)==null||t.validate(async n=>{if(n){try{await _.setConfig({settings:g(a)}),i.success("变更配置信息成功")}catch{}r()}else i.error("请填写完整信息")})}function g(t){return Object.keys(t).map(n=>({configKey:n,configVal:t[n]}))}return q(()=>{r()}),(t,n)=>{const c=o("el-alert"),y=v,b=o("el-button"),x=o("el-input"),w=o("el-form-item"),h=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(()=>[u("div",A,[O,e(b,{class:"button",text:"",onClick:p},{default:s(()=>[N(" 保存设置 ")]),_:1})])]),default:s(()=>[e(C,{ref_key:"formRef",ref:l,rules:d.value,model:a,"label-width":"140px"},{default:s(()=>[e(P,null,{default:s(()=>[e(h,{xs:24,md:20,lg:15,xl:12},{default:s(()=>[e(w,{label:"模型全局头部预设",prop:"systemPreMessage"},{default:s(()=>[e(x,{modelValue:a.systemPreMessage,"onUpdate:modelValue":n[0]||(n[0]=k=>a.systemPreMessage=k),type:"textarea",rows:5,placeholder:"请填写模型全局头部预设信息!",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof f=="function"&&f(R);export{R as default}; import{_ as v}from"./index.vue_vue_type_script_setup_true_lang-CHWp65cL.js";import{a as _}from"./config-CwtVyG0K.js";import{d as V,m as j,r as m,a as q,n as o,g as B,c as E,b as e,w as s,e as u,h as N,E as i,k as f}from"./index-CAe0BuuW.js";const A={class:"flex justify-between"},O=u("b",null,"模型系统消息预设",-1),R=V({__name:"globalPre",setup(U){const a=j({systemPreMessage:""}),d=m({systemPreMessage:[{required:!0,trigger:"blur",message:"请填写全局预设信息、用于模型预设词"}]}),l=m();async function r(){const t=await _.queryConfig({keys:["systemPreMessage"]});Object.assign(a,t.data)}function p(){var t;(t=l.value)==null||t.validate(async n=>{if(n){try{await _.setConfig({settings:g(a)}),i.success("变更配置信息成功")}catch{}r()}else i.error("请填写完整信息")})}function g(t){return Object.keys(t).map(n=>({configKey:n,configVal:t[n]}))}return q(()=>{r()}),(t,n)=>{const c=o("el-alert"),y=v,b=o("el-button"),x=o("el-input"),w=o("el-form-item"),h=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(()=>[u("div",A,[O,e(b,{class:"button",text:"",onClick:p},{default:s(()=>[N(" 保存设置 ")]),_:1})])]),default:s(()=>[e(C,{ref_key:"formRef",ref:l,rules:d.value,model:a,"label-width":"140px"},{default:s(()=>[e(P,null,{default:s(()=>[e(h,{xs:24,md:20,lg:15,xl:12},{default:s(()=>[e(w,{label:"模型全局头部预设",prop:"systemPreMessage"},{default:s(()=>[e(x,{modelValue:a.systemPreMessage,"onUpdate:modelValue":n[0]||(n[0]=k=>a.systemPreMessage=k),type:"textarea",rows:5,placeholder:"请填写模型全局头部预设信息!",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof f=="function"&&f(R);export{R as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as h}from"./index.vue_vue_type_script_setup_true_lang-CiyjFa2H.js";import{d as k,m as C,r as _,a as N,n as o,g as q,c as G,b as e,w as l,h as x,e as s,E as y,j as R,_ as j,k as g}from"./index-DEc4xym2.js";import{a as H}from"./config-BQ9gBCXa.js";const B=s("div",{class:"flex items-center gap-4"},"虎皮椒支付设置",-1),E=s("div",{class:"text-sm/6"},[s("div",null,[s("a",{href:"https://www.xunhupay.com/",target:"_blank"},"虎皮椒支付"),x(" 为第三方支付,接入请购买微信渠道。 ")]),s("div",null,"支付通知地址为: https://您的域名/api/pay/notify。")],-1),$=k({__name:"hupijiao",setup(M){const t=C({payHupiStatus:"",payHupiAppId:"",payHupiSecret:"",payHupiGatewayUrl:"",payHupiNotifyUrl:"",payHupiReturnUrl:""}),U=_({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:"请填写支付通知地址"}]}),m=_();async function c(){const u=await H.queryConfig({keys:["payHupiSecret","payHupiNotifyUrl","payHupiGatewayUrl","payHupiReturnUrl","payHupiAppId","payHupiStatus"]});Object.assign(t,u.data)}function V(){var u;(u=m.value)==null||u.validate(async a=>{if(a){try{await H.setConfig({settings:b(t)}),y.success("变更配置信息成功")}catch{}c()}else y.error("请填写完整信息")})}function b(u){return Object.keys(u).map(a=>({configKey:a,configVal:u[a]}))}return N(()=>{c()}),(u,a)=>{const f=R,w=j,S=h,v=o("el-switch"),r=o("el-form-item"),n=o("el-col"),i=o("el-row"),d=o("el-input"),A=o("el-form"),I=o("el-card");return q(),G("div",null,[e(S,null,{title:l(()=>[B]),content:l(()=>[E]),default:l(()=>[e(w,{outline:"",onClick:V},{default:l(()=>[e(f,{name:"i-ri:file-text-line"}),x(" 保存设置 ")]),_:1})]),_:1}),e(I,{style:{margin:"20px"}},{default:l(()=>[e(A,{ref_key:"formRef",ref:m,rules:U.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(v,{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(d,{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(d,{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(d,{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(d,{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(d,{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($);export{$ as default}; import{_ as h}from"./index.vue_vue_type_script_setup_true_lang-D6-4wUAO.js";import{d as k,m as C,r as _,a as N,n as o,g as q,c as G,b as e,w as l,h as x,e as s,E as y,j as R,_ as j,k as g}from"./index-CAe0BuuW.js";import{a as H}from"./config-CwtVyG0K.js";const B=s("div",{class:"flex items-center gap-4"},"虎皮椒支付设置",-1),E=s("div",{class:"text-sm/6"},[s("div",null,[s("a",{href:"https://www.xunhupay.com/",target:"_blank"},"虎皮椒支付"),x(" 为第三方支付,接入请购买微信渠道。 ")]),s("div",null,"支付通知地址为: https://您的域名/api/pay/notify。")],-1),$=k({__name:"hupijiao",setup(M){const t=C({payHupiStatus:"",payHupiAppId:"",payHupiSecret:"",payHupiGatewayUrl:"",payHupiNotifyUrl:"",payHupiReturnUrl:""}),U=_({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:"请填写支付通知地址"}]}),m=_();async function c(){const u=await H.queryConfig({keys:["payHupiSecret","payHupiNotifyUrl","payHupiGatewayUrl","payHupiReturnUrl","payHupiAppId","payHupiStatus"]});Object.assign(t,u.data)}function V(){var u;(u=m.value)==null||u.validate(async a=>{if(a){try{await H.setConfig({settings:b(t)}),y.success("变更配置信息成功")}catch{}c()}else y.error("请填写完整信息")})}function b(u){return Object.keys(u).map(a=>({configKey:a,configVal:u[a]}))}return N(()=>{c()}),(u,a)=>{const f=R,w=j,S=h,v=o("el-switch"),r=o("el-form-item"),n=o("el-col"),i=o("el-row"),d=o("el-input"),A=o("el-form"),I=o("el-card");return q(),G("div",null,[e(S,null,{title:l(()=>[B]),content:l(()=>[E]),default:l(()=>[e(w,{outline:"",onClick:V},{default:l(()=>[e(f,{name:"i-ri:file-text-line"}),x(" 保存设置 ")]),_:1})]),_:1}),e(I,{style:{margin:"20px"}},{default:l(()=>[e(A,{ref_key:"formRef",ref:m,rules:U.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(v,{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(d,{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(d,{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(d,{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(d,{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(d,{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($);export{$ 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

@ -0,0 +1,8 @@
/**
* Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* https://fantastic-admin.github.io
*/
import{_ as o}from"./index.vue_vue_type_script_setup_true_lang-CCcZv4nB.js";import"./HDropdown-BtjElhzu.js";import"./index-CAe0BuuW.js";import"./HTabList.vue_vue_type_script_setup_true_lang-DVNTO8pP.js";import"./use-resolve-button-type-CIWo_h_W.js";export{o as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/**
* Fantastic-admin 提供技术支持
* Powered by Fantastic-admin
* https://fantastic-admin.github.io
*/
import{d as o,u as i,g as r,c as a,e,b as t,y as n,M as m,i as c,l as p}from"./index-CAe0BuuW.js";import{_ as l}from"./leftSide.vue_vue_type_script_setup_true_lang-DsSivonS.js";import{_}from"./rightSide.vue_vue_type_script_setup_true_lang-BwNK92Zl.js";import"./index-CprVCdi5.js";import"./index-BhXahEts.js";import"./item.vue_vue_type_script_setup_true_lang-BhPHmnZX.js";import"./HDropdownMenu.vue_vue_type_script_setup_true_lang-DvGMfvHr.js";import"./index.vue_vue_type_script_setup_true_lang-CCcZv4nB.js";import"./HDropdown-BtjElhzu.js";import"./HTabList.vue_vue_type_script_setup_true_lang-DVNTO8pP.js";import"./use-resolve-button-type-CIWo_h_W.js";import"./index.vue_vue_type_script_setup_true_lang-CKDXN_8I.js";import"./index-Dp-A2VeR.js";import"./index.vue_vue_type_script_setup_true_lang-B135yVzK.js";import"./HKbd-ajmXhnhP.js";import"./index.vue_vue_type_script_setup_true_lang-Cz7MHHaT.js";import"./useMainPage-PJO-ub0s.js";const d={class:"toolbar-container flex items-center justify-between"},f={class:"h-full flex items-center of-hidden pl-2 pr-16",style:{"mask-image":"linear-gradient(90deg, #000 0%, #000 calc(100% - 50px), transparent)"}},u={class:"h-full flex items-center px-2"},h=o({name:"Toolbar",__name:"index",setup(x){const s=i();return(g,b)=>(r(),a("div",d,[e("div",f,[t(l)]),n(e("div",u,[t(_)],512),[[m,["side","single"].includes(c(s).settings.menu.menuMode)]])]))}}),z=p(h,[["__scopeId","data-v-6a8fd0ab"]]);export{z as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{_ as o}from"./index.vue_vue_type_script_setup_true_lang-BIwcUHb8.js";import"./HKbd-Dkpr3OfM.js";import"./index-DEc4xym2.js";export{o as default}; import{_ as o}from"./index.vue_vue_type_script_setup_true_lang-B135yVzK.js";import"./HKbd-ajmXhnhP.js";import"./index-CAe0BuuW.js";export{o as default};

View File

@ -5,4 +5,4 @@
* https://fantastic-admin.github.io * https://fantastic-admin.github.io
*/ */
import{d as y,u as k,ab as w,g as a,z as v,w as S,i as t,c as s,b as M,e as r,F as C,s as B,A as c,ad as j,Q as h,t as z,j as N,l as V}from"./index-DEc4xym2.js";import{_ as $}from"./index.vue_vue_type_script_setup_true_lang-BstFZRfU.js";import{u as F}from"./useMenu-C9VPEhUW.js";const I={key:0,class:"main-sidebar-container"},T={class:"menu flex flex-col of-hidden transition-all"},A=["title","onClick"],D={class:"w-full inline-flex flex-1 flex-col items-center justify-center gap-[2px]"},E={class:"w-full flex-1 truncate text-center text-sm transition-height transition-opacity transition-width"},L=y({name:"MainSidebar",__name:"index",setup(Q){const i=k(),o=w(),{switchTo:b}=F();return(q,G)=>{const x=N;return a(),v(j,{name:"main-sidebar"},{default:S(()=>[t(i).settings.menu.menuMode==="side"||t(i).mode==="mobile"&&t(i).settings.menu.menuMode!=="single"?(a(),s("div",I,[M($,{"show-title":!1,class:"sidebar-logo"}),r("div",T,[(a(!0),s(C,null,B(t(o).allMenus,(e,n)=>{var l,m,u,d,f,_,g,p;return a(),s("div",{key:n,class:h(["menu-item relative transition-all",{active:n===t(o).actived}])},[e.children&&e.children.length!==0?(a(),s("div",{key:0,class:h(["group menu-item-container h-full w-full flex cursor-pointer items-center justify-between gap-1 py-4 text-[var(--g-main-sidebar-menu-color)] transition-all hover-bg-[var(--g-main-sidebar-menu-hover-bg)] hover-text-[var(--g-main-sidebar-menu-hover-color)] px-2!",{"text-[var(--g-main-sidebar-menu-active-color)]! bg-[var(--g-main-sidebar-menu-active-bg)]!":n===t(o).actived}]),title:typeof((l=e.meta)==null?void 0:l.title)=="function"?(m=e.meta)==null?void 0:m.title():(u=e.meta)==null?void 0:u.title,onClick:H=>t(b)(n)},[r("div",D,[(d=e.meta)!=null&&d.icon?(a(),v(x,{key:0,name:(f=e.meta)==null?void 0:f.icon,size:20,class:"menu-item-container-icon transition-transform group-hover-scale-120",async:""},null,8,["name"])):c("",!0),r("span",E,z(typeof((_=e.meta)==null?void 0:_.title)=="function"?(g=e.meta)==null?void 0:g.title():(p=e.meta)==null?void 0:p.title),1)])],10,A)):c("",!0)],2)}),128))])])):c("",!0)]),_:1})}}}),P=V(L,[["__scopeId","data-v-74880cce"]]);export{P as default}; import{d as y,u as k,ab as w,g as a,z as v,w as S,i as t,c as s,b as M,e as r,F as C,s as B,A as c,ad as j,Q as h,t as z,j as N,l as V}from"./index-CAe0BuuW.js";import{_ as $}from"./index.vue_vue_type_script_setup_true_lang-DW_XyWLU.js";import{u as F}from"./useMenu-BBkTa_-z.js";const I={key:0,class:"main-sidebar-container"},T={class:"menu flex flex-col of-hidden transition-all"},A=["title","onClick"],D={class:"w-full inline-flex flex-1 flex-col items-center justify-center gap-[2px]"},E={class:"w-full flex-1 truncate text-center text-sm transition-height transition-opacity transition-width"},L=y({name:"MainSidebar",__name:"index",setup(Q){const i=k(),o=w(),{switchTo:b}=F();return(q,G)=>{const x=N;return a(),v(j,{name:"main-sidebar"},{default:S(()=>[t(i).settings.menu.menuMode==="side"||t(i).mode==="mobile"&&t(i).settings.menu.menuMode!=="single"?(a(),s("div",I,[M($,{"show-title":!1,class:"sidebar-logo"}),r("div",T,[(a(!0),s(C,null,B(t(o).allMenus,(e,n)=>{var l,m,u,d,f,_,g,p;return a(),s("div",{key:n,class:h(["menu-item relative transition-all",{active:n===t(o).actived}])},[e.children&&e.children.length!==0?(a(),s("div",{key:0,class:h(["group menu-item-container h-full w-full flex cursor-pointer items-center justify-between gap-1 py-4 text-[var(--g-main-sidebar-menu-color)] transition-all hover-bg-[var(--g-main-sidebar-menu-hover-bg)] hover-text-[var(--g-main-sidebar-menu-hover-color)] px-2!",{"text-[var(--g-main-sidebar-menu-active-color)]! bg-[var(--g-main-sidebar-menu-active-bg)]!":n===t(o).actived}]),title:typeof((l=e.meta)==null?void 0:l.title)=="function"?(m=e.meta)==null?void 0:m.title():(u=e.meta)==null?void 0:u.title,onClick:H=>t(b)(n)},[r("div",D,[(d=e.meta)!=null&&d.icon?(a(),v(x,{key:0,name:(f=e.meta)==null?void 0:f.icon,size:20,class:"menu-item-container-icon transition-transform group-hover-scale-120",async:""},null,8,["name"])):c("",!0),r("span",E,z(typeof((_=e.meta)==null?void 0:_.title)=="function"?(g=e.meta)==null?void 0:g.title():(p=e.meta)==null?void 0:p.title),1)])],10,A)):c("",!0)],2)}),128))])])):c("",!0)]),_:1})}}}),P=V(L,[["__scopeId","data-v-74880cce"]]);export{P as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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