mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-11-15 21:53:44 +08:00
整合包
This commit is contained in:
1
YiAiQuickDeploy/dist/modules/chatgpt/zhipu.js
vendored
Normal file
1
YiAiQuickDeploy/dist/modules/chatgpt/zhipu.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
'use strict';const _0x3397e1=_0x3edb;(function(_0x18327d,_0x47e667){const _0x215f2c=_0x3edb,_0x292ccd=_0x18327d();while(!![]){try{const _0x134690=parseInt(_0x215f2c(0x17a))/0x1*(-parseInt(_0x215f2c(0x15a))/0x2)+parseInt(_0x215f2c(0x17e))/0x3*(-parseInt(_0x215f2c(0x17b))/0x4)+-parseInt(_0x215f2c(0x16c))/0x5*(-parseInt(_0x215f2c(0x172))/0x6)+-parseInt(_0x215f2c(0x16b))/0x7+-parseInt(_0x215f2c(0x176))/0x8*(-parseInt(_0x215f2c(0x17f))/0x9)+-parseInt(_0x215f2c(0x162))/0xa+-parseInt(_0x215f2c(0x178))/0xb*(-parseInt(_0x215f2c(0x16a))/0xc);if(_0x134690===_0x47e667)break;else _0x292ccd['push'](_0x292ccd['shift']());}catch(_0x50bd5b){_0x292ccd['push'](_0x292ccd['shift']());}}}(_0x4331,0x968ee));Object[_0x3397e1(0x165)](exports,'__esModule',{'value':!![]}),exports['sendMessageFromZhipu']=exports[_0x3397e1(0x159)]=exports[_0x3397e1(0x180)]=exports['generateToken']=void 0x0;const axios=require(_0x3397e1(0x188)),jwt=require(_0x3397e1(0x160));function generateToken(_0x2e8de9,_0x134209=0x3e8*0x3c*0x3c*0x18*0x168){const _0xcc22d7=_0x3397e1,[_0x5d2259,_0x247ec7]=_0x2e8de9[_0xcc22d7(0x167)]('.'),_0x2b63dc={'api_key':_0x5d2259,'exp':Math[_0xcc22d7(0x15c)](Date[_0xcc22d7(0x170)]())+_0x134209*0x3e8,'timestamp':Math[_0xcc22d7(0x15c)](Date['now']())};return jwt[_0xcc22d7(0x186)](_0x2b63dc,_0x247ec7,{'algorithm':_0xcc22d7(0x179),'header':{'alg':_0xcc22d7(0x179),'sign_type':_0xcc22d7(0x15b)}});}function _0x3edb(_0x5bb419,_0x369455){const _0x433139=_0x4331();return _0x3edb=function(_0x3edbf9,_0x2ae4e4){_0x3edbf9=_0x3edbf9-0x159;let _0x1cce02=_0x433139[_0x3edbf9];return _0x1cce02;},_0x3edb(_0x5bb419,_0x369455);}function _0x4331(){const _0x41af66=['6736328CUWlWO','filter','27519811PBQwCo','HS256','5vsVlTq','4xDZFHK','application/json','length','958788ginVAu','9kwIXpD','compilerMetaJsonStr','https://open.bigmodel.cn/api/paas/v3/model-api/','replace','error','toString','stream','sign','event:','axios','compilerStream','489798BgtgCL','SIGN','round','data:','error:\x20','usage','jsonwebtoken','then','6880920MJKeDb','id:','is_end','defineProperty','text','split','log','catch','12ZAFuml','7140693nfAAZF','105HIwvhm','meta:','json\x20parse\x20error\x20from\x20zhipu!','parse','now','end','150036kEonPu','trim','sendMessageFromZhipu','data'];_0x4331=function(){return _0x41af66;};return _0x4331();}exports['generateToken']=generateToken;function compilerMetaJsonStr(_0x115e67){const _0x430e85=_0x3397e1;let _0x46b460={};try{_0x46b460=JSON[_0x430e85(0x16f)](_0x115e67);}catch(_0x4e14f1){_0x46b460={'usage':{'completion_tokens':0x31,'prompt_tokens':0x14d,'total_tokens':0x18f}},console[_0x430e85(0x183)](_0x430e85(0x16e),_0x115e67);}return _0x46b460;}exports['compilerMetaJsonStr']=compilerMetaJsonStr;function compilerStream(_0x55286a){const _0x13d1be=_0x3397e1;var _0x42ee90;if(_0x55286a[_0x13d1be(0x17d)]===0x3)return{'event':_0x55286a[0x0]['replace'](_0x13d1be(0x187),''),'id':_0x55286a[0x1]['replace'](_0x13d1be(0x163),''),'is_end':![],'result':_0x55286a[0x2]['replace'](_0x13d1be(0x15d),'')[_0x13d1be(0x173)]()};if(_0x55286a[_0x13d1be(0x17d)]===0x4)return{'event':_0x55286a[0x0]['replace'](_0x13d1be(0x187),''),'id':_0x55286a[0x1][_0x13d1be(0x182)](_0x13d1be(0x163),''),'result':_0x55286a[0x2][_0x13d1be(0x182)](_0x13d1be(0x15d),'')[_0x13d1be(0x173)](),'is_end':!![],'usage':(_0x42ee90=compilerMetaJsonStr(_0x55286a[0x3][_0x13d1be(0x182)](_0x13d1be(0x16d),'')))===null||_0x42ee90===void 0x0?void 0x0:_0x42ee90[_0x13d1be(0x15f)]};}exports[_0x3397e1(0x159)]=compilerStream;async function sendMessageFromZhipu(_0x4f579a,{onProgress:_0x41f339,key:_0x5954db,model:_0x54b5f5,temperature:temperature=0.95}){const _0x48d2c4=await generateToken(_0x5954db);return new Promise((_0x59e3d8,_0x460eae)=>{const _0x54c420=_0x3edb,_0x2a6033=_0x54c420(0x181)+_0x54b5f5+'/sse-invoke',_0x43dfad={'method':'POST','url':_0x2a6033,'responseType':_0x54c420(0x185),'headers':{'Content-Type':_0x54c420(0x17c),'Authorization':_0x48d2c4},'data':{'prompt':_0x4f579a,'temperature':temperature}};axios(_0x43dfad)[_0x54c420(0x161)](_0x3e1a4e=>{const _0x36e32d=_0x54c420,_0x5bba43=_0x3e1a4e[_0x36e32d(0x175)];let _0x27de9a,_0xe446f7='';_0x5bba43['on'](_0x36e32d(0x175),_0x3296e7=>{const _0x41f208=_0x36e32d,_0x3b2f9b=_0x3296e7[_0x41f208(0x184)]()[_0x41f208(0x167)]('\x0a')[_0x41f208(0x177)](_0xa14004=>_0xa14004[_0x41f208(0x173)]()!==''),_0x36b404=compilerStream(_0x3b2f9b);if(!_0x36b404)return;const {id:_0x384cf5,result:_0x2a0861,is_end:_0x41d886}=_0x36b404;_0x2a0861&&(_0xe446f7+=_0x2a0861[_0x41f208(0x173)]()),_0x41d886&&(_0x36b404[_0x41f208(0x164)]=![],_0x27de9a=_0x36b404,_0x27de9a[_0x41f208(0x166)]=_0xe446f7),_0x41f339(_0x36b404);}),_0x5bba43['on'](_0x36e32d(0x171),()=>{_0x59e3d8(_0x27de9a),_0xe446f7='';});})[_0x54c420(0x169)](_0xbe7111=>{const _0x79126=_0x54c420;console[_0x79126(0x168)](_0x79126(0x15e),_0xbe7111);});});}exports[_0x3397e1(0x174)]=sendMessageFromZhipu;
|
||||
Reference in New Issue
Block a user