mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-26 13:16:39 +08:00
1 line
8.4 KiB
JavaScript
1 line
8.4 KiB
JavaScript
'use strict';const _0x29633c=_0x2581;function _0x2581(_0x24c1af,_0x28a32f){const _0x112c80=_0x112c();return _0x2581=function(_0x258124,_0x1be26c){_0x258124=_0x258124-0x7e;let _0x2f9440=_0x112c80[_0x258124];return _0x2f9440;},_0x2581(_0x24c1af,_0x28a32f);}(function(_0xd401f0,_0x55f695){const _0x20843d=_0x2581,_0x3b37c8=_0xd401f0();while(!![]){try{const _0x575958=parseInt(_0x20843d(0xab))/0x1+-parseInt(_0x20843d(0x9b))/0x2+-parseInt(_0x20843d(0x8a))/0x3+parseInt(_0x20843d(0x99))/0x4+-parseInt(_0x20843d(0xad))/0x5+parseInt(_0x20843d(0x89))/0x6*(-parseInt(_0x20843d(0x84))/0x7)+parseInt(_0x20843d(0x8e))/0x8*(parseInt(_0x20843d(0x91))/0x9);if(_0x575958===_0x55f695)break;else _0x3b37c8['push'](_0x3b37c8['shift']());}catch(_0x190977){_0x3b37c8['push'](_0x3b37c8['shift']());}}}(_0x112c,0x87e10));var __decorate=this&&this[_0x29633c(0xb2)]||function(_0x1ba615,_0x5d5be5,_0x415cd6,_0x2c869f){const _0x1a137a=_0x29633c;var _0x537e2d=arguments[_0x1a137a(0xa7)],_0xa49dd7=_0x537e2d<0x3?_0x5d5be5:_0x2c869f===null?_0x2c869f=Object[_0x1a137a(0x8f)](_0x5d5be5,_0x415cd6):_0x2c869f,_0x18027f;if(typeof Reflect===_0x1a137a(0xb4)&&typeof Reflect[_0x1a137a(0x93)]===_0x1a137a(0x88))_0xa49dd7=Reflect[_0x1a137a(0x93)](_0x1ba615,_0x5d5be5,_0x415cd6,_0x2c869f);else{for(var _0x5bd295=_0x1ba615[_0x1a137a(0xa7)]-0x1;_0x5bd295>=0x0;_0x5bd295--)if(_0x18027f=_0x1ba615[_0x5bd295])_0xa49dd7=(_0x537e2d<0x3?_0x18027f(_0xa49dd7):_0x537e2d>0x3?_0x18027f(_0x5d5be5,_0x415cd6,_0xa49dd7):_0x18027f(_0x5d5be5,_0x415cd6))||_0xa49dd7;}return _0x537e2d>0x3&&_0xa49dd7&&Object[_0x1a137a(0xa0)](_0x5d5be5,_0x415cd6,_0xa49dd7),_0xa49dd7;},__metadata=this&&this[_0x29633c(0xb0)]||function(_0x512946,_0x271ec0){const _0x215a29=_0x29633c;if(typeof Reflect===_0x215a29(0xb4)&&typeof Reflect[_0x215a29(0x87)]===_0x215a29(0x88))return Reflect[_0x215a29(0x87)](_0x512946,_0x271ec0);},__param=this&&this[_0x29633c(0x9c)]||function(_0xc0defd,_0x3749af){return function(_0x4371a9,_0x466f8a){_0x3749af(_0x4371a9,_0x466f8a,_0xc0defd);};};Object[_0x29633c(0xa0)](exports,_0x29633c(0xb9),{'value':!![]}),exports[_0x29633c(0xb3)]=void 0x0;function _0x112c(){const _0xef167d=['design:paramtypes','affected','keyType','ModelsService','删除失败!','7ogNqfc','BAD_REQUEST','非法操作、您在使用一个不存在的应用!','metadata','function','5310984QNoKai','2308722bkQDUA','title','Repository','error:\x20','552yfRDKu','getOwnPropertyDescriptor','AppEntity','393129FSkvzM','InjectRepository','decorate','findOne','../models/models.service','includes','HttpStatus','coverImg','1463812lfQyOf','管理员未配置任何AI模型、请先联系管理员开通聊天模型配置!','1511354vwNNtM','__param','getGroupInfoFromId','新对话','./chatGroup.entity','defineProperty','当前应用已经开启了一个对话无需新建了!','appId','删除成功','del','@nestjs/common','ChatGroupEntity','length','appEntity','../app/app.entity','请先选择一个对话或者新加一个对话再操作!','321078MOHJCU','appLogo','3670225aRiJHK','count','query','__metadata','delAll','__decorate','ChatGroupService','object','getBaseConfig','modelsService','DESC','map','__esModule','user','非法操作、您在删除一个非法资源!','assign','@nestjs/typeorm','update','undefined','find','非法操作、您在使用一个未启用的应用!','HttpException','更新对话失败!','chatGroupEntity'];_0x112c=function(){return _0xef167d;};return _0x112c();}const common_1=require(_0x29633c(0xa5)),chatGroup_entity_1=require(_0x29633c(0x9f)),typeorm_1=require(_0x29633c(0xbd)),typeorm_2=require('typeorm'),app_entity_1=require(_0x29633c(0xa9)),models_service_1=require(_0x29633c(0x95));let ChatGroupService=class ChatGroupService{constructor(_0x1429f8,_0x16601c,_0x11ee4c){const _0xa8bfa8=_0x29633c;this['chatGroupEntity']=_0x1429f8,this[_0xa8bfa8(0xa8)]=_0x16601c,this[_0xa8bfa8(0xb6)]=_0x11ee4c;}async['create'](_0x1d803b,_0x147d20){const _0x4d9210=_0x29633c,{id:_0x5560ea}=_0x147d20[_0x4d9210(0xba)],{appId:_0x4acb2f}=_0x1d803b,_0x2fa213={'title':_0x4d9210(0x9e),'userId':_0x5560ea};if(_0x4acb2f){const _0x35269d=await this[_0x4d9210(0xa8)][_0x4d9210(0x94)]({'where':{'id':_0x4acb2f}});if(!_0x35269d)throw new common_1[(_0x4d9210(0xc2))](_0x4d9210(0x86),common_1[_0x4d9210(0x97)]['BAD_REQUEST']);else{const {status:_0x14aaf7,name:_0x597353}=_0x35269d,_0x535ceb=await this[_0x4d9210(0x7e)][_0x4d9210(0xae)]({'where':{'userId':_0x5560ea,'appId':_0x4acb2f,'isDelete':![]}});if(_0x535ceb>0x0)throw new common_1[(_0x4d9210(0xc2))](_0x4d9210(0xa1),common_1[_0x4d9210(0x97)][_0x4d9210(0x85)]);if(![0x1,0x3,0x4,0x5][_0x4d9210(0x96)](_0x14aaf7))throw new common_1[(_0x4d9210(0xc2))](_0x4d9210(0xc1),common_1[_0x4d9210(0x97)]['BAD_REQUEST']);_0x597353&&(_0x2fa213[_0x4d9210(0x8b)]=_0x597353),_0x4acb2f&&(_0x2fa213[_0x4d9210(0xa2)]=_0x4acb2f);}}const _0x144f65=await this[_0x4d9210(0xb6)][_0x4d9210(0xb5)](_0x4acb2f);_0x4acb2f&&(_0x144f65[_0x4d9210(0xa2)]=_0x4acb2f);if(!_0x144f65)throw new common_1[(_0x4d9210(0xc2))](_0x4d9210(0x9a),common_1[_0x4d9210(0x97)]['BAD_REQUEST']);return await this[_0x4d9210(0x7e)]['save'](Object['assign'](Object[_0x4d9210(0xbc)]({},_0x2fa213),{'config':JSON['stringify'](_0x144f65)}));}async[_0x29633c(0xaf)](_0x3c96c0){const _0x27b6ff=_0x29633c;try{const {id:_0x449536}=_0x3c96c0[_0x27b6ff(0xba)],_0x57068c={'userId':_0x449536,'isDelete':![]},_0x1d54f9=await this[_0x27b6ff(0x7e)]['find']({'where':_0x57068c,'order':{'isSticky':_0x27b6ff(0xb7),'id':_0x27b6ff(0xb7)}}),_0x11cccf=_0x1d54f9['filter'](_0x438432=>_0x438432[_0x27b6ff(0xa2)])['map'](_0x38629b=>_0x38629b[_0x27b6ff(0xa2)]),_0x53e81b=await this[_0x27b6ff(0xa8)][_0x27b6ff(0xc0)]({'where':{'id':(0x0,typeorm_2['In'])(_0x11cccf)}});return _0x1d54f9[_0x27b6ff(0xb8)](_0x501374=>{const _0x1e59b5=_0x27b6ff;var _0x15c668;return _0x501374[_0x1e59b5(0xac)]=(_0x15c668=_0x53e81b['find'](_0x1b8cd0=>_0x1b8cd0['id']===_0x501374['appId']))===null||_0x15c668===void 0x0?void 0x0:_0x15c668[_0x1e59b5(0x98)],_0x501374;});}catch(_0x715445){console['log'](_0x27b6ff(0x8d),_0x715445);}}async[_0x29633c(0xbe)](_0x1f65a9,_0x2d7108){const _0x16ac14=_0x29633c,{title:_0x55f190,isSticky:_0x48218d,groupId:_0x4f1246,config:_0x50e3d4}=_0x1f65a9,{id:_0x49fdb2}=_0x2d7108[_0x16ac14(0xba)],_0x5c0d99=await this[_0x16ac14(0x7e)][_0x16ac14(0x94)]({'where':{'id':_0x4f1246,'userId':_0x49fdb2}});if(!_0x5c0d99)throw new common_1['HttpException'](_0x16ac14(0xaa),common_1[_0x16ac14(0x97)][_0x16ac14(0x85)]);const {appId:_0x33d7be}=_0x5c0d99;if(_0x33d7be&&!_0x55f190)try{const _0x2aff0f=JSON['parse'](_0x50e3d4);if(Number(_0x2aff0f[_0x16ac14(0x81)])!==0x1)throw new common_1[(_0x16ac14(0xc2))]('应用对话名称不能修改哟!',common_1[_0x16ac14(0x97)]['BAD_REQUEST']);}catch(_0x236170){}const _0x470c0e={};_0x55f190&&(_0x470c0e[_0x16ac14(0x8b)]=_0x55f190),typeof _0x48218d!==_0x16ac14(0xbf)&&(_0x470c0e['isSticky']=_0x48218d),_0x50e3d4&&(_0x470c0e['config']=_0x50e3d4);const _0x9e99b=await this[_0x16ac14(0x7e)]['update']({'id':_0x4f1246},_0x470c0e);if(_0x9e99b['affected'])return!![];else throw new common_1[(_0x16ac14(0xc2))](_0x16ac14(0xc3),common_1['HttpStatus'][_0x16ac14(0x85)]);}async[_0x29633c(0xa4)](_0x449b27,_0xd7ce94){const _0x488b25=_0x29633c,{groupId:_0x58d1b3}=_0x449b27,{id:_0x518632}=_0xd7ce94[_0x488b25(0xba)],_0x499378=await this[_0x488b25(0x7e)]['findOne']({'where':{'id':_0x58d1b3,'userId':_0x518632}});if(!_0x499378)throw new common_1['HttpException'](_0x488b25(0xbb),common_1[_0x488b25(0x97)][_0x488b25(0x85)]);const _0x275876=await this[_0x488b25(0x7e)][_0x488b25(0xbe)]({'id':_0x58d1b3},{'isDelete':!![]});if(_0x275876[_0x488b25(0x80)])return _0x488b25(0xa3);else throw new common_1[(_0x488b25(0xc2))]('删除失败!',common_1['HttpStatus'][_0x488b25(0x85)]);}async[_0x29633c(0xb1)](_0x2bd65f){const _0x44a952=_0x29633c,{id:_0x2569f5}=_0x2bd65f['user'],_0x3fea57=await this[_0x44a952(0x7e)][_0x44a952(0xbe)]({'userId':_0x2569f5,'isSticky':![],'isDelete':![]},{'isDelete':!![]});if(_0x3fea57[_0x44a952(0x80)])return'删除成功';else throw new common_1['HttpException'](_0x44a952(0x83),common_1[_0x44a952(0x97)][_0x44a952(0x85)]);}async[_0x29633c(0x9d)](_0x5d85f0){if(!_0x5d85f0)return;return await this['chatGroupEntity']['findOne']({'where':{'id':_0x5d85f0}});}};ChatGroupService=__decorate([(0x0,common_1['Injectable'])(),__param(0x0,(0x0,typeorm_1[_0x29633c(0x92)])(chatGroup_entity_1[_0x29633c(0xa6)])),__param(0x1,(0x0,typeorm_1[_0x29633c(0x92)])(app_entity_1[_0x29633c(0x90)])),__metadata(_0x29633c(0x7f),[typeorm_2[_0x29633c(0x8c)],typeorm_2[_0x29633c(0x8c)],models_service_1[_0x29633c(0x82)]])],ChatGroupService),exports[_0x29633c(0xb3)]=ChatGroupService; |