mirror of
https://github.com/SilenceLurker/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 10:05:50 +00:00
2 lines
21 KiB
JavaScript
2 lines
21 KiB
JavaScript
(function(_0x1553dd,_0x2220e3){const _0x34714e=_0x1cae,_0x39cd5d=_0x1553dd();while(!![]){try{const _0x5a9226=parseInt(_0x34714e(0x275))/0x1*(-parseInt(_0x34714e(0x1fd))/0x2)+parseInt(_0x34714e(0x268))/0x3+parseInt(_0x34714e(0x253))/0x4*(-parseInt(_0x34714e(0x26a))/0x5)+-parseInt(_0x34714e(0x227))/0x6*(-parseInt(_0x34714e(0x20f))/0x7)+parseInt(_0x34714e(0x24a))/0x8*(-parseInt(_0x34714e(0x244))/0x9)+-parseInt(_0x34714e(0x21f))/0xa*(-parseInt(_0x34714e(0x215))/0xb)+parseInt(_0x34714e(0x28f))/0xc*(-parseInt(_0x34714e(0x1f9))/0xd);if(_0x5a9226===_0x2220e3)break;else _0x39cd5d['push'](_0x39cd5d['shift']());}catch(_0xd0ee2d){_0x39cd5d['push'](_0x39cd5d['shift']());}}}(_0x877e,0x77358));import{getContext}from'/scripts/extensions.js';import*as _0x1007d5 from'../core/rag-processor.js';import*as _0x59db5b from'../core/utils/context-utils.js';'use\x20strict';function setupGlobalEventHandlers(){const _0x5cef71=_0x1cae;window[_0x5cef71(0x231)]=saveSettingsFromUI,window[_0x5cef71(0x24f)]=resetSettingsToUI,window[_0x5cef71(0x20d)]=testApi,window[_0x5cef71(0x273)]=fetchHLYEmbeddingModels,window[_0x5cef71(0x29c)]=updatePanelStatus,window[_0x5cef71(0x243)]=purgeStorage,window['startHLYCondensation']=startCondensation,window[_0x5cef71(0x2a4)]=previewCondensation,window['ingestHLYManualText']=ingestManualText,window[_0x5cef71(0x23d)]=log,window[_0x5cef71(0x220)]=showStats;}export function bindHanlinyuanEvents(){const _0x426f0d=_0x1cae,_0x1061bb=getContext();if(!_0x1061bb){console[_0x426f0d(0x252)](_0x426f0d(0x291));return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents();if(_0x1007d5['initialize'])_0x1007d5[_0x426f0d(0x241)]();else{console['error'](_0x426f0d(0x20e));return;}loadSettingsToUI(),console['log']('[翰林院-枢纽]\x20已成功连接各部,政令畅通。');}function bindPanelToggleEvents(){const _0x29eda5=_0x1cae,_0x375458=document[_0x29eda5(0x285)](_0x29eda5(0x27e));if(_0x375458){}}function bindInternalUIEvents(){const _0x340534=_0x1cae,_0x124913=document[_0x340534(0x20c)](_0x340534(0x29d));_0x124913[_0x340534(0x27c)](_0x354974=>{const _0x42585f=_0x340534;_0x354974[_0x42585f(0x264)]('click',()=>{const _0x5656eb=_0x42585f,_0x4ee17a=_0x354974[_0x5656eb(0x1f2)][_0x5656eb(0x235)];document[_0x5656eb(0x20c)](_0x5656eb(0x25a))[_0x5656eb(0x27c)](_0x286c20=>{const _0x369cbf=_0x5656eb;_0x286c20[_0x369cbf(0x26e)][_0x369cbf(0x1ea)](_0x369cbf(0x24c),_0x286c20['id']===_0x369cbf(0x201)+_0x4ee17a+_0x369cbf(0x28c));}),_0x124913['forEach'](_0x4b9e92=>_0x4b9e92[_0x5656eb(0x26e)][_0x5656eb(0x1ea)](_0x5656eb(0x24c),_0x4b9e92===_0x354974));if(_0x4ee17a===_0x5656eb(0x259)){const _0x475c66=document[_0x5656eb(0x285)]('hly-log-output');_0x475c66&&(_0x475c66[_0x5656eb(0x239)]=_0x475c66['scrollHeight']);}});});const _0x25faff=document['getElementById'](_0x340534(0x251));_0x25faff&&_0x25faff['addEventListener'](_0x340534(0x299),toggleCustomEndpointDocket);const _0x36c3e8=document[_0x340534(0x20c)]('input[name=\x22hly-injection-position\x22]');_0x36c3e8[_0x340534(0x27c)](_0x4f5f66=>{const _0x66a030=_0x340534;_0x4f5f66[_0x66a030(0x264)](_0x66a030(0x299),toggleInjectionDetails);});}function toggleInjectionDetails(){const _0x414e9b=_0x1cae,_0x5cbb7d=document['querySelector'](_0x414e9b(0x1ed))[_0x414e9b(0x29f)],_0x235cb3=document['getElementById'](_0x414e9b(0x1ef)),_0x473b33=document['getElementById'](_0x414e9b(0x223)),_0xb71c19=_0x5cbb7d==='1';_0x235cb3[_0x414e9b(0x258)]=!_0xb71c19,_0x473b33['disabled']=!_0xb71c19;}function toggleCustomEndpointDocket(){const _0x2c7594=_0x1cae,_0x12ef93=document[_0x2c7594(0x285)](_0x2c7594(0x251))['value'],_0xdc7fb4=document[_0x2c7594(0x285)](_0x2c7594(0x28b));_0xdc7fb4&&(_0xdc7fb4[_0x2c7594(0x267)][_0x2c7594(0x210)]=_0x12ef93==='custom'||_0x12ef93===_0x2c7594(0x255)?'block':_0x2c7594(0x23c));}function loadSettingsToUI(){const _0xb8a328=_0x1cae,_0x5f47b2=_0x1007d5[_0xb8a328(0x26b)]();if(!_0x5f47b2)return;document[_0xb8a328(0x285)]('hly-retrieval-enabled')[_0xb8a328(0x1f8)]=_0x5f47b2[_0xb8a328(0x200)]['enabled'],document[_0xb8a328(0x285)]('hly-api-endpoint')['value']=_0x5f47b2[_0xb8a328(0x200)][_0xb8a328(0x24e)],document[_0xb8a328(0x285)](_0xb8a328(0x274))[_0xb8a328(0x29f)]=_0x5f47b2['retrieval'][_0xb8a328(0x2a2)],document[_0xb8a328(0x285)](_0xb8a328(0x1ec))['value']=_0x5f47b2[_0xb8a328(0x200)][_0xb8a328(0x29b)];const _0x382006=document[_0xb8a328(0x285)](_0xb8a328(0x22b));if(_0x382006[_0xb8a328(0x217)][_0xb8a328(0x289)]===0x0){const _0x56306a=_0x5f47b2[_0xb8a328(0x200)][_0xb8a328(0x206)],_0x53eb0a=new Option(_0x56306a,_0x56306a,!![],!![]);_0x382006['add'](_0x53eb0a);}_0x382006[_0xb8a328(0x29f)]=_0x5f47b2[_0xb8a328(0x200)][_0xb8a328(0x206)],document[_0xb8a328(0x285)](_0xb8a328(0x271))[_0xb8a328(0x1f8)]=_0x5f47b2[_0xb8a328(0x200)][_0xb8a328(0x228)],document[_0xb8a328(0x285)](_0xb8a328(0x2a3))[_0xb8a328(0x29f)]=_0x5f47b2['advanced']['chunkSize'],document[_0xb8a328(0x285)]('hly-overlap-size')[_0xb8a328(0x29f)]=_0x5f47b2['advanced']['overlap'],document[_0xb8a328(0x285)]('hly-match-threshold')['value']=_0x5f47b2[_0xb8a328(0x23e)][_0xb8a328(0x1fc)],document[_0xb8a328(0x285)]('hly-query-message-count')[_0xb8a328(0x29f)]=_0x5f47b2[_0xb8a328(0x23e)][_0xb8a328(0x294)],document[_0xb8a328(0x285)](_0xb8a328(0x1fa))[_0xb8a328(0x29f)]=_0x5f47b2[_0xb8a328(0x23e)][_0xb8a328(0x232)],document['getElementById'](_0xb8a328(0x246))['value']=_0x5f47b2[_0xb8a328(0x200)][_0xb8a328(0x212)],document[_0xb8a328(0x285)](_0xb8a328(0x208))['value']=_0x5f47b2[_0xb8a328(0x224)][_0xb8a328(0x207)];const _0x3fe04c=document['querySelector']('input[name=\x22hly-injection-position\x22][value=\x22'+_0x5f47b2[_0xb8a328(0x224)]['position']+'\x22]');_0x3fe04c&&(_0x3fe04c[_0xb8a328(0x1f8)]=!![]),document[_0xb8a328(0x285)](_0xb8a328(0x1ef))[_0xb8a328(0x29f)]=_0x5f47b2[_0xb8a328(0x224)]['depth'],document[_0xb8a328(0x285)](_0xb8a328(0x223))[_0xb8a328(0x29f)]=_0x5f47b2[_0xb8a328(0x224)][_0xb8a328(0x22c)],toggleInjectionDetails(),document[_0xb8a328(0x285)](_0xb8a328(0x280))[_0xb8a328(0x1f8)]=_0x5f47b2[_0xb8a328(0x27f)][_0xb8a328(0x25d)],document['getElementById'](_0xb8a328(0x298))[_0xb8a328(0x29f)]=_0x5f47b2['condensation'][_0xb8a328(0x1f0)],document[_0xb8a328(0x285)](_0xb8a328(0x20b))[_0xb8a328(0x29f)]=_0x5f47b2['condensation'][_0xb8a328(0x237)],document['getElementById'](_0xb8a328(0x281))['checked']=_0x5f47b2['condensation'][_0xb8a328(0x248)][_0xb8a328(0x2a8)],document['getElementById']('hly-include-ai')[_0xb8a328(0x1f8)]=_0x5f47b2[_0xb8a328(0x27f)][_0xb8a328(0x248)]['ai'],toggleCustomEndpointDocket();}function saveSettingsFromUI(){const _0x1818b3=_0x1cae,_0x56541f=_0x1007d5[_0x1818b3(0x26b)]();if(!_0x56541f)return;_0x56541f[_0x1818b3(0x200)][_0x1818b3(0x25d)]=document[_0x1818b3(0x285)](_0x1818b3(0x293))[_0x1818b3(0x1f8)],_0x56541f[_0x1818b3(0x200)][_0x1818b3(0x24e)]=document[_0x1818b3(0x285)](_0x1818b3(0x251))['value'],_0x56541f[_0x1818b3(0x200)][_0x1818b3(0x2a2)]=document[_0x1818b3(0x285)](_0x1818b3(0x274))[_0x1818b3(0x29f)],_0x56541f[_0x1818b3(0x200)]['apiKey']=document[_0x1818b3(0x285)](_0x1818b3(0x1ec))[_0x1818b3(0x29f)],_0x56541f[_0x1818b3(0x200)][_0x1818b3(0x206)]=document[_0x1818b3(0x285)](_0x1818b3(0x22b))['value'],_0x56541f[_0x1818b3(0x200)]['notify']=document[_0x1818b3(0x285)](_0x1818b3(0x271))[_0x1818b3(0x1f8)],_0x56541f[_0x1818b3(0x23e)][_0x1818b3(0x1eb)]=parseInt(document[_0x1818b3(0x285)](_0x1818b3(0x2a3))[_0x1818b3(0x29f)]),_0x56541f[_0x1818b3(0x23e)][_0x1818b3(0x21d)]=parseInt(document['getElementById'](_0x1818b3(0x2a5))[_0x1818b3(0x29f)]),_0x56541f[_0x1818b3(0x23e)]['matchThreshold']=parseFloat(document[_0x1818b3(0x285)](_0x1818b3(0x25f))[_0x1818b3(0x29f)]),_0x56541f[_0x1818b3(0x23e)][_0x1818b3(0x294)]=parseInt(document[_0x1818b3(0x285)](_0x1818b3(0x256))[_0x1818b3(0x29f)]),_0x56541f['advanced']['maxResults']=parseInt(document['getElementById']('hly-max-results')[_0x1818b3(0x29f)]),_0x56541f['retrieval']['batchSize']=parseInt(document[_0x1818b3(0x285)](_0x1818b3(0x246))[_0x1818b3(0x29f)]),_0x56541f[_0x1818b3(0x224)][_0x1818b3(0x207)]=document[_0x1818b3(0x285)](_0x1818b3(0x208))[_0x1818b3(0x29f)],_0x56541f[_0x1818b3(0x224)][_0x1818b3(0x261)]=parseInt(document[_0x1818b3(0x1f7)]('input[name=\x22hly-injection-position\x22]:checked')[_0x1818b3(0x29f)]),_0x56541f[_0x1818b3(0x224)][_0x1818b3(0x1f4)]=parseInt(document['getElementById'](_0x1818b3(0x1ef))[_0x1818b3(0x29f)])||0x1,_0x56541f['injection'][_0x1818b3(0x22c)]=parseInt(document[_0x1818b3(0x285)](_0x1818b3(0x223))['value']),_0x56541f[_0x1818b3(0x27f)][_0x1818b3(0x25d)]=document[_0x1818b3(0x285)]('hly-condensation-enabled')[_0x1818b3(0x1f8)],_0x56541f[_0x1818b3(0x27f)][_0x1818b3(0x1f0)]=parseInt(document[_0x1818b3(0x285)](_0x1818b3(0x298))[_0x1818b3(0x29f)]),_0x56541f['condensation'][_0x1818b3(0x237)]=parseInt(document[_0x1818b3(0x285)](_0x1818b3(0x20b))[_0x1818b3(0x29f)]),_0x56541f[_0x1818b3(0x27f)][_0x1818b3(0x248)]['user']=document[_0x1818b3(0x285)](_0x1818b3(0x281))[_0x1818b3(0x1f8)],_0x56541f[_0x1818b3(0x27f)][_0x1818b3(0x248)]['ai']=document[_0x1818b3(0x285)](_0x1818b3(0x238))[_0x1818b3(0x1f8)],_0x56541f[_0x1818b3(0x27f)]['messageTypes']['hidden']=![],_0x1007d5[_0x1818b3(0x297)](),toastr[_0x1818b3(0x1f5)](_0x1818b3(0x1fb),_0x1818b3(0x278));}function resetSettingsToUI(){const _0x34f6c1=_0x1cae;confirm('您确定要将所有设定恢复为出厂默认值吗?')&&(_0x1007d5[_0x34f6c1(0x209)](),loadSettingsToUI(),toastr[_0x34f6c1(0x23b)](_0x34f6c1(0x22f),'诏曰'));}async function updatePanelStatus(){const _0x17241e=_0x1cae;document['getElementById'](_0x17241e(0x21b))[_0x17241e(0x286)]=_0x59db5b[_0x17241e(0x28a)](),document['getElementById'](_0x17241e(0x25e))[_0x17241e(0x286)]=_0x59db5b['getChatId']()||'无';const _0x20945e=document['getElementById'](_0x17241e(0x202));_0x20945e[_0x17241e(0x286)]='...';try{const _0x4214bd=await _0x1007d5['getVectorCount']();_0x20945e[_0x17241e(0x286)]=_0x4214bd;}catch(_0x208e99){console['error'](_0x17241e(0x250),_0x208e99),_0x20945e[_0x17241e(0x286)]='错误';}}async function testApi(){const _0x3cbd73=_0x1cae;toastr[_0x3cbd73(0x23b)]('正在测试神力连接...','圣旨');try{await _0x1007d5['testApiConnection'](),toastr[_0x3cbd73(0x1f5)](_0x3cbd73(0x295),'圣意');}catch(_0x258d7a){toastr[_0x3cbd73(0x252)]('神力连接失败:\x20'+_0x258d7a['message'],'警报');}}async function fetchHLYEmbeddingModels(){const _0x165949=_0x1cae,_0x469a53=document[_0x165949(0x285)](_0x165949(0x22b)),_0x593785=_0x469a53[_0x165949(0x29f)];_0x469a53[_0x165949(0x216)]=_0x165949(0x265),_0x469a53['disabled']=!![];try{log(_0x165949(0x26c),_0x165949(0x23b));const _0x2cff89=await _0x1007d5['fetchEmbeddingModels']();_0x469a53[_0x165949(0x216)]='';if(_0x2cff89[_0x165949(0x289)]===0x0){_0x469a53[_0x165949(0x216)]=_0x165949(0x28e),toastr[_0x165949(0x236)](_0x165949(0x2a7),_0x165949(0x26f)),log(_0x165949(0x2a7),_0x165949(0x236));return;}_0x2cff89['forEach'](_0x1a5e6d=>{const _0xb9b9b1=new Option(_0x1a5e6d,_0x1a5e6d);_0x469a53['add'](_0xb9b9b1);}),_0x2cff89[_0x165949(0x279)](_0x593785)?_0x469a53[_0x165949(0x29f)]=_0x593785:_0x469a53[_0x165949(0x27d)]=0x0,toastr[_0x165949(0x1f5)](_0x165949(0x240)+_0x2cff89[_0x165949(0x289)]+_0x165949(0x234),'圣意'),log(_0x165949(0x240)+_0x2cff89[_0x165949(0x289)]+'\x20个嵌入模型。',_0x165949(0x1f5));}catch(_0x1c7fc7){console[_0x165949(0x252)](_0x165949(0x230),_0x1c7fc7),toastr[_0x165949(0x252)](_0x165949(0x27a)+_0x1c7fc7[_0x165949(0x21e)],_0x165949(0x1ff)),log('获取模型失败:\x20'+_0x1c7fc7['message'],_0x165949(0x252)),_0x469a53[_0x165949(0x216)]=_0x165949(0x203);}finally{_0x469a53['disabled']=![];}}async function purgeStorage(){const _0x4910f8=_0x1cae;if(confirm(_0x4910f8(0x213))){toastr[_0x4910f8(0x23b)](_0x4910f8(0x1f3),'圣旨');const _0x551d5d=await _0x1007d5[_0x4910f8(0x282)]();_0x551d5d?toastr[_0x4910f8(0x1f5)](_0x4910f8(0x260),'圣意'):toastr[_0x4910f8(0x252)](_0x4910f8(0x28d),'警报'),await updatePanelStatus();}}async function startCondensation(){const _0xae8a39=_0x1cae,_0x40cbb3=document[_0xae8a39(0x285)](_0xae8a39(0x1ee));_0x40cbb3[_0xae8a39(0x286)]=_0xae8a39(0x270),toastr[_0xae8a39(0x23b)]('正在准备凝识...','圣旨');try{const _0x5de16e=_0x1007d5['getMessagesForCondensation']();if(!_0x5de16e||_0x5de16e[_0xae8a39(0x289)]===0x0){toastr[_0xae8a39(0x1f6)](_0xae8a39(0x233),_0xae8a39(0x26f)),_0x40cbb3[_0xae8a39(0x286)]=_0xae8a39(0x287);return;}_0x40cbb3[_0xae8a39(0x286)]=_0xae8a39(0x2a9)+_0x5de16e[_0xae8a39(0x289)]+_0xae8a39(0x214),toastr['info'](_0xae8a39(0x2a9)+_0x5de16e[_0xae8a39(0x289)]+_0xae8a39(0x214),'翰林院启奏');const _0x300da1=await _0x1007d5[_0xae8a39(0x25b)](_0x5de16e);if(_0x300da1[_0xae8a39(0x1f5)])toastr[_0xae8a39(0x1f5)](_0xae8a39(0x1fe)+_0x300da1[_0xae8a39(0x29e)]+_0xae8a39(0x24d),_0xae8a39(0x2a6)),_0x40cbb3[_0xae8a39(0x286)]=_0xae8a39(0x1fe)+_0x300da1['count']+_0xae8a39(0x24d);else throw new Error(_0x300da1[_0xae8a39(0x252)]||_0xae8a39(0x20a));}catch(_0x226195){console[_0xae8a39(0x252)](_0xae8a39(0x269),_0x226195),toastr[_0xae8a39(0x252)]('凝识失败:\x20'+_0x226195['message'],_0xae8a39(0x1ff)),_0x40cbb3['textContent']=_0xae8a39(0x249)+_0x226195[_0xae8a39(0x21e)];}finally{await updatePanelStatus();}}async function showStats(){const _0x5355a1=_0x1cae;try{log(_0x5355a1(0x218),_0x5355a1(0x23b)),toastr['info'](_0x5355a1(0x22a),'圣旨');const _0x2afd7e=await _0x1007d5[_0x5355a1(0x262)](),_0x377bdd=_0x1007d5[_0x5355a1(0x21a)](),_0x5b49f4=_0x1007d5[_0x5355a1(0x26b)](),_0x4c6c92=_0x5355a1(0x245)+_0x377bdd+_0x5355a1(0x21c)+_0x2afd7e+_0x5355a1(0x24b)+_0x5b49f4[_0x5355a1(0x200)][_0x5355a1(0x24e)]+_0x5355a1(0x292)+_0x5b49f4['retrieval'][_0x5355a1(0x206)]+'\x0a</pre>\x0a\x20\x20\x20\x20\x20\x20\x20\x20';toastr[_0x5355a1(0x23b)](_0x4c6c92,_0x5355a1(0x29a),{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log('查看宝库状态成功:集合ID='+_0x377bdd+_0x5355a1(0x26d)+_0x2afd7e,'success');}catch(_0x5c495e){console[_0x5355a1(0x252)](_0x5355a1(0x263),_0x5c495e),toastr['error'](_0x5355a1(0x2a0)+_0x5c495e['message'],_0x5355a1(0x1ff)),log(_0x5355a1(0x2a0)+_0x5c495e[_0x5355a1(0x21e)],_0x5355a1(0x252));}}function previewCondensation(){const _0x32a25f=_0x1cae,_0x262bf7=document[_0x32a25f(0x285)](_0x32a25f(0x1ee));try{const _0x5902bc={'user':document[_0x32a25f(0x285)](_0x32a25f(0x281))['checked'],'ai':document[_0x32a25f(0x285)]('hly-include-ai')[_0x32a25f(0x1f8)],'hidden':![]},_0x38d4f3=_0x1007d5[_0x32a25f(0x277)](_0x5902bc);if(!_0x38d4f3||_0x38d4f3[_0x32a25f(0x289)]===0x0){_0x262bf7[_0x32a25f(0x286)]=_0x32a25f(0x283);return;}const _0x3d8bf9=_0x38d4f3[_0x32a25f(0x272)]((_0x264df5,_0x56e91b)=>_0x56e91b+0x1+_0x32a25f(0x229)+_0x264df5[_0x32a25f(0x205)]+']:\x20'+_0x264df5[_0x32a25f(0x257)])['join']('\x0a\x0a');_0x262bf7[_0x32a25f(0x286)]=_0x32a25f(0x22e)+_0x38d4f3[_0x32a25f(0x289)]+_0x32a25f(0x1e8)+_0x3d8bf9;}catch(_0x3de895){_0x262bf7[_0x32a25f(0x286)]='预览失败:\x20'+_0x3de895[_0x32a25f(0x21e)];}}function _0x877e(){const _0x4e3e99=['injection','log-info','文书已成功录入宝库,新增\x20','17070daXBDt','notify','.\x20[','正在查询宝库状态...','hly-embedding-model','depth_role','用户尝试录入空文本。','将对以下\x20','翰林院设定已重置为初始状态。','[翰林院-枢纽]\x20获取模型列表失败:','saveHLYSettings','maxResults','未找到符合条件的消息可供凝识。','\x20个嵌入模型。','tab','warn','layerEnd','hly-include-ai','scrollTop','log-warn','info','none','hlyLog','advanced','className','成功获取\x20','initialize','.hly-log-placeholder','purgeHLYStorage','2217438KHnCSS','\x0a<pre>\x0a翰林院宝库状态\x0a--------------------\x0a集合ID:\x20','hly-batch-size','log-error','messageTypes','凝识失败:\x20','16XEoHfO','\x0a--------------------\x0aAPI端点:\x20','active','\x20条忆识。','apiEndpoint','resetHLYSettings','[翰林院-枢纽]\x20更新忆识数量失败:','hly-api-endpoint','error','21476yPpSdy','hly-log-entry\x20','azure','hly-query-message-count','mes','disabled','log','.hly-tab-pane','processCondensation','[翰林院-枢纽]\x20手动录入过程发生错误:','enabled','hly-current-chat-id','hly-match-threshold','宝库已清空。','position','getVectorCount','[翰林院-枢纽]\x20查询宝库状态失败:','addEventListener','<option>正在获取...</option>','fa-circle-info','style','2388144dizNDX','[翰林院-枢纽]\x20凝识过程发生错误:','300HFwSZm','getSettings','开始获取嵌入模型列表...',',\x20忆识总数=','classList','翰林院启奏','正在采集消息...','hly-retrieval-notify','map','fetchHLYEmbeddingModels','hly-custom-api-url','54163ZULjvP','fa-check-circle','getMessagesForCondensation','圣旨已达','includes','获取模型失败:\x20','正在处理您提交的文书...','forEach','selectedIndex','amily2_open_rag_palace','condensation','hly-condensation-enabled','hly-include-user','purgeStorage','根据当前勾选条件,未找到符合的消息可供预览。','createElement','getElementById','textContent','未找到符合条件的消息。','log-success','length','getCharacterName','hly-custom-endpoint-docket','-tab','清空宝库失败。','<option>未找到模型</option>','3132UlcDnO','trim','[翰林院-枢纽]\x20未能获取SillyTavern上下文,绑定失败。','\x0a所用模型:\x20','hly-retrieval-enabled','queryMessageCount','神力连接通畅!','fa-times-circle','saveSettings','hly-layer-start','change','宝库状态','apiKey','updateHLYMemoryCount','.hly-nav-item','count','value','查询宝库状态失败:\x20','hly-log-output','customApiUrl','hly-chunk-size','previewHLYCondensation','hly-overlap-size','大功告成','未能获取到任何嵌入模型。','user','已采集\x20','\x20条消息进行凝识:\x0a\x0a','录入内容不能为空。','toggle','chunkSize','hly-api-key','input[name=\x22hly-injection-position\x22]:checked','hly-condensation-results','hly-injection-depth','layerStart','fa-exclamation-triangle','dataset','正在清空宝库...','depth','success','warning','querySelector','checked','5395SbNPHL','hly-max-results','翰林院设定已存档封印。','matchThreshold','14uneaUR','凝识完成!新增\x20','严重错误','retrieval','hly-','hly-current-vector-count','<option>获取失败</option>','\x22></i>\x20[','name','embeddingModel','template','hly-injection-template','resetSettings','未知错误','hly-layer-end','querySelectorAll','testHLYApi','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨!','1001YmQSbj','display','文书录入失败:\x20','batchSize','此操作将彻底清空当前角色的所有忆识(向量),且无法恢复。您确定要继续吗?','\x20条消息,开始凝识...','6465327avIyxq','innerHTML','options','用户请求查看宝库状态。','appendChild','getCollectionId','hly-current-character-name','\x0a忆识总数:\x20','overlap','message','10GQghEc','showHLYStats','收到手动录入请求,文本长度:\x20','toLocaleTimeString','hly-injection-role'];_0x877e=function(){return _0x4e3e99;};return _0x877e();}function log(_0x533963,_0x5106b2='info'){const _0x71d2f=_0x1cae,_0x314e99=document[_0x71d2f(0x285)](_0x71d2f(0x2a1));if(!_0x314e99)return;const _0xce7fa3=document[_0x71d2f(0x284)]('p'),_0x2659d4=new Date()[_0x71d2f(0x222)]();let _0x3295ec=_0x71d2f(0x266),_0x46e9e7=_0x71d2f(0x225);switch(_0x5106b2){case _0x71d2f(0x1f5):_0x3295ec=_0x71d2f(0x276),_0x46e9e7=_0x71d2f(0x288);break;case _0x71d2f(0x252):_0x3295ec=_0x71d2f(0x296),_0x46e9e7=_0x71d2f(0x247);break;case _0x71d2f(0x236):_0x3295ec=_0x71d2f(0x1f1),_0x46e9e7=_0x71d2f(0x23a);break;}_0xce7fa3[_0x71d2f(0x23f)]=_0x71d2f(0x254)+_0x46e9e7,_0xce7fa3[_0x71d2f(0x216)]='<i\x20class=\x22fa-solid\x20'+_0x3295ec+_0x71d2f(0x204)+_0x2659d4+']\x20'+_0x533963;const _0x16986b=_0x314e99[_0x71d2f(0x1f7)](_0x71d2f(0x242));_0x16986b&&_0x16986b['remove'](),_0x314e99[_0x71d2f(0x219)](_0xce7fa3),_0x314e99[_0x71d2f(0x239)]=_0x314e99['scrollHeight'];}function _0x1cae(_0x40816a,_0x465114){const _0x877e13=_0x877e();return _0x1cae=function(_0x1cae3d,_0x53ca82){_0x1cae3d=_0x1cae3d-0x1e8;let _0xb4441a=_0x877e13[_0x1cae3d];return _0xb4441a;},_0x1cae(_0x40816a,_0x465114);}async function ingestManualText(){const _0x13562=_0x1cae,_0x280778=document['getElementById']('hly-manual-text'),_0x4dfa79=_0x280778['value'][_0x13562(0x290)]();if(!_0x4dfa79){toastr[_0x13562(0x1f6)](_0x13562(0x1e9),_0x13562(0x26f)),log(_0x13562(0x22d),_0x13562(0x236));return;}log(_0x13562(0x221)+_0x4dfa79[_0x13562(0x289)],'info'),toastr[_0x13562(0x23b)](_0x13562(0x27b),'圣旨');try{const _0x41d857=await _0x1007d5['ingestTextToHanlinyuan'](_0x4dfa79);if(_0x41d857[_0x13562(0x1f5)])toastr[_0x13562(0x1f5)](_0x13562(0x226)+_0x41d857[_0x13562(0x29e)]+_0x13562(0x24d),'大功告成'),log('手动录入成功,新增\x20'+_0x41d857[_0x13562(0x29e)]+_0x13562(0x24d),_0x13562(0x1f5)),_0x280778[_0x13562(0x29f)]='';else throw new Error(_0x41d857['error']||'未知错误');}catch(_0x10f485){console[_0x13562(0x252)](_0x13562(0x25c),_0x10f485),toastr[_0x13562(0x252)](_0x13562(0x211)+_0x10f485[_0x13562(0x21e)],_0x13562(0x1ff)),log('手动录入失败:\x20'+_0x10f485[_0x13562(0x21e)],'error');}finally{await updatePanelStatus();}}
|