Files
ST-Amily2-Chat-Optimisation/ui/hanlinyuan-bindings.js
2025-07-19 17:18:33 +08:00

2 lines
20 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const _0x4f60a9=_0x49a7;(function(_0x46b21c,_0x3ceab1){const _0x365f4b=_0x49a7,_0x16969d=_0x46b21c();while(!![]){try{const _0x2dd828=-parseInt(_0x365f4b(0x14c))/0x1*(-parseInt(_0x365f4b(0xc3))/0x2)+parseInt(_0x365f4b(0x159))/0x3+parseInt(_0x365f4b(0x117))/0x4+parseInt(_0x365f4b(0x145))/0x5+-parseInt(_0x365f4b(0xc1))/0x6*(-parseInt(_0x365f4b(0x141))/0x7)+-parseInt(_0x365f4b(0x13f))/0x8*(parseInt(_0x365f4b(0xdd))/0x9)+-parseInt(_0x365f4b(0x15d))/0xa*(parseInt(_0x365f4b(0x110))/0xb);if(_0x2dd828===_0x3ceab1)break;else _0x16969d['push'](_0x16969d['shift']());}catch(_0x184cd4){_0x16969d['push'](_0x16969d['shift']());}}}(_0x5b2d,0x8d1d6));import{getContext}from'/scripts/extensions.js';import*as _0x307795 from'../core/rag-processor.js';import*as _0x38d560 from'../core/utils/context-utils.js';_0x4f60a9(0x105);function _0x5b2d(){const _0x79c88f=['查看宝库状态成功集合ID=','appendChild','position','36rWPDtp','processCondensation','73442tQejRM','文书录入失败:\x20','fa-circle-info','hly-match-threshold','fa-exclamation-triangle','已采集\x20','hly-retrieval-enabled','apiKey','\x20个嵌入模型。','fa-check-circle','hly-log-output','ingestHLYManualText','display','hly-injection-template','[翰林院-枢纽]\x20未能获取SillyTavern上下文绑定失败。','hly-include-user','retrieval','depth','hly-api-key','hly-injection-role','.hly-nav-item','log-warn','正在处理您提交的文书...','advanced','hly-layer-start','resetHLYSettings','1740969JsYmRZ','翰林院启奏','获取模型失败:\x20','getCollectionId','<option>获取失败</option>','此操作将彻底清空当前角色的所有忆识(向量),且无法恢复。您确定要继续吗?','layerStart','selectedIndex','getMessagesForCondensation','condensation','saveSettings','\x22></i>\x20[','enabled','根据当前勾选条件,未找到符合的消息可供预览。','hly-retrieval-notify','trim','宝库状态','message','maxResults','warn','innerHTML','hly-condensation-enabled','querySelectorAll','hly-max-results','.hly-tab-pane','none','startHLYCondensation','未找到符合条件的消息可供凝识。','hlyLog','addEventListener','文书已成功录入宝库,新增\x20','getVectorCount','amily2_open_rag_palace','getCharacterName','用户尝试录入空文本。','hly-layer-end','用户请求查看宝库状态。','hidden','error','hly-current-vector-count','use\x20strict','预览失败:\x20','hly-current-character-name','\x0a--------------------\x0aAPI端点:\x20','fetchEmbeddingModels','hly-current-chat-id','checked','成功获取\x20','\x20条消息开始凝识...','hly-custom-endpoint-docket','value','33470008GhCeyA','click','join','神力连接通畅!','宝库已清空。','\x0a</pre>\x0a\x20\x20\x20\x20\x20\x20\x20\x20','azure','4372216nxuNKI','input[name=\x22hly-injection-position\x22]:checked','getElementById','block','batchSize','清空宝库失败。','add','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨','正在测试神力连接...','您确定要将所有设定恢复为出厂默认值吗?','大功告成','toLocaleTimeString','tab','user','hly-query-message-count','count','depth_role','input[name=\x22hly-injection-position\x22]','remove','change','将对以下\x20','凝识完成!新增\x20','disabled','录入内容不能为空。','hly-injection-depth','<i\x20class=\x22fa-solid\x20','hly-overlap-size','[翰林院-枢纽]\x20手动录入过程发生错误:','hly-batch-size','手动录入成功,新增\x20','hly-custom-api-url','正在采集消息...','warning','testApiConnection','saveHLYSettings','...','scrollHeight','未知错误','showHLYStats','正在清空宝库...','16DLyTbD','\x20条忆识。','771939SAQVgC','queryMessageCount','\x0a<pre>\x0a翰林院宝库状态\x0a--------------------\x0a集合ID:\x20','查询宝库状态失败:\x20','5754215EZOItc','embeddingModel','input[name=\x22hly-injection-position\x22][value=\x22','\x20条消息进行凝识\x0a\x0a','凝识失败:\x20','getSettings','ingestTextToHanlinyuan','1fQNGQm','overlap','[翰林院-枢纽]\x20查询宝库状态失败:','hly-','hly-embedding-model','querySelector','scrollTop','options','purgeHLYStorage','messageTypes','testHLYApi','layerEnd','apiEndpoint','3196008AvURIE','\x0a所用模型:\x20','翰林院设定已存档封印。','active','10yvmntH',']:\x20','customApiUrl','initialize','toggle','dataset','hly-api-endpoint','length','<option>未找到模型</option>','未能获取到任何嵌入模型。','hly-include-ai','classList','info','success','hly-chunk-size','template','.\x20[','[翰林院-枢纽]\x20已成功连接各部政令畅通。','injection','textContent','严重错误','matchThreshold','log','name','forEach','notify','map','fetchHLYEmbeddingModels','chunkSize'];_0x5b2d=function(){return _0x79c88f;};return _0x5b2d();}function setupGlobalEventHandlers(){const _0x3b272c=_0x4f60a9;window[_0x3b272c(0x139)]=saveSettingsFromUI,window[_0x3b272c(0xdc)]=resetSettingsToUI,window[_0x3b272c(0x156)]=testApi,window[_0x3b272c(0xbc)]=fetchHLYEmbeddingModels,window['updateHLYMemoryCount']=updatePanelStatus,window[_0x3b272c(0x154)]=purgeStorage,window[_0x3b272c(0xf7)]=startCondensation,window['previewHLYCondensation']=previewCondensation,window[_0x3b272c(0xce)]=ingestManualText,window[_0x3b272c(0xf9)]=log,window[_0x3b272c(0x13d)]=showStats;}export function bindHanlinyuanEvents(){const _0x3495d2=_0x4f60a9,_0x2184ff=getContext();if(!_0x2184ff){console['error'](_0x3495d2(0xd1));return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents();if(_0x307795[_0x3495d2(0x160)])_0x307795[_0x3495d2(0x160)]();else{console[_0x3495d2(0x103)](_0x3495d2(0x11e));return;}loadSettingsToUI(),console[_0x3495d2(0x173)](_0x3495d2(0x16e));}function bindPanelToggleEvents(){const _0x399974=_0x4f60a9,_0x58ca9d=document[_0x399974(0x119)](_0x399974(0xfd));if(_0x58ca9d){}}function bindInternalUIEvents(){const _0x3c9103=_0x4f60a9,_0x518107=document[_0x3c9103(0xf3)](_0x3c9103(0xd7));_0x518107[_0x3c9103(0xb9)](_0x19149d=>{const _0x1e3090=_0x3c9103;_0x19149d[_0x1e3090(0xfa)](_0x1e3090(0x111),()=>{const _0x5d7d55=_0x1e3090,_0x45b734=_0x19149d[_0x5d7d55(0x162)][_0x5d7d55(0x123)];document[_0x5d7d55(0xf3)](_0x5d7d55(0xf5))[_0x5d7d55(0xb9)](_0x32dd23=>{const _0x19714c=_0x5d7d55;_0x32dd23[_0x19714c(0x168)][_0x19714c(0x161)]('active',_0x32dd23['id']===_0x19714c(0x14f)+_0x45b734+'-tab');}),_0x518107['forEach'](_0x1cecf8=>_0x1cecf8['classList'][_0x5d7d55(0x161)](_0x5d7d55(0x15c),_0x1cecf8===_0x19149d));if(_0x45b734===_0x5d7d55(0x173)){const _0xfb66d4=document[_0x5d7d55(0x119)](_0x5d7d55(0xcd));_0xfb66d4&&(_0xfb66d4[_0x5d7d55(0x152)]=_0xfb66d4[_0x5d7d55(0x13b)]);}});});const _0x4c445a=document[_0x3c9103(0x119)](_0x3c9103(0x163));_0x4c445a&&_0x4c445a['addEventListener'](_0x3c9103(0x12a),toggleCustomEndpointDocket);const _0x278f8b=document[_0x3c9103(0xf3)](_0x3c9103(0x128));_0x278f8b['forEach'](_0x166a40=>{const _0xb62062=_0x3c9103;_0x166a40[_0xb62062(0xfa)](_0xb62062(0x12a),toggleInjectionDetails);});}function toggleInjectionDetails(){const _0x16d85c=_0x4f60a9,_0x1c67db=document[_0x16d85c(0x151)](_0x16d85c(0x118))[_0x16d85c(0x10f)],_0x56c9a7=document[_0x16d85c(0x119)]('hly-injection-depth'),_0xe9866d=document[_0x16d85c(0x119)](_0x16d85c(0xd6)),_0x541fd0=_0x1c67db==='1';_0x56c9a7['disabled']=!_0x541fd0,_0xe9866d[_0x16d85c(0x12d)]=!_0x541fd0;}function toggleCustomEndpointDocket(){const _0x165b52=_0x4f60a9,_0x4fc37b=document[_0x165b52(0x119)]('hly-api-endpoint')[_0x165b52(0x10f)],_0x58149c=document[_0x165b52(0x119)](_0x165b52(0x10e));_0x58149c&&(_0x58149c['style'][_0x165b52(0xcf)]=_0x4fc37b==='custom'||_0x4fc37b===_0x165b52(0x116)?_0x165b52(0x11a):_0x165b52(0xf6));}function loadSettingsToUI(){const _0x1fc4b5=_0x4f60a9,_0x3e9c65=_0x307795[_0x1fc4b5(0x14a)]();if(!_0x3e9c65)return;document['getElementById'](_0x1fc4b5(0xc9))[_0x1fc4b5(0x10b)]=_0x3e9c65[_0x1fc4b5(0xd3)][_0x1fc4b5(0xe9)],document[_0x1fc4b5(0x119)]('hly-api-endpoint')[_0x1fc4b5(0x10f)]=_0x3e9c65[_0x1fc4b5(0xd3)]['apiEndpoint'],document[_0x1fc4b5(0x119)](_0x1fc4b5(0x135))['value']=_0x3e9c65[_0x1fc4b5(0xd3)][_0x1fc4b5(0x15f)],document[_0x1fc4b5(0x119)](_0x1fc4b5(0xd5))['value']=_0x3e9c65['retrieval']['apiKey'];const _0x3bffd9=document['getElementById'](_0x1fc4b5(0x150));if(_0x3bffd9[_0x1fc4b5(0x153)]['length']===0x0){const _0x3203d=_0x3e9c65['retrieval'][_0x1fc4b5(0x146)],_0x1f6045=new Option(_0x3203d,_0x3203d,!![],!![]);_0x3bffd9[_0x1fc4b5(0x11d)](_0x1f6045);}_0x3bffd9[_0x1fc4b5(0x10f)]=_0x3e9c65['retrieval']['embeddingModel'],document[_0x1fc4b5(0x119)](_0x1fc4b5(0xeb))[_0x1fc4b5(0x10b)]=_0x3e9c65[_0x1fc4b5(0xd3)][_0x1fc4b5(0xba)],document[_0x1fc4b5(0x119)](_0x1fc4b5(0x16b))[_0x1fc4b5(0x10f)]=_0x3e9c65[_0x1fc4b5(0xda)][_0x1fc4b5(0xbd)],document[_0x1fc4b5(0x119)](_0x1fc4b5(0x131))['value']=_0x3e9c65[_0x1fc4b5(0xda)][_0x1fc4b5(0x14d)],document['getElementById']('hly-match-threshold')[_0x1fc4b5(0x10f)]=_0x3e9c65[_0x1fc4b5(0xda)][_0x1fc4b5(0x172)],document[_0x1fc4b5(0x119)]('hly-query-message-count')['value']=_0x3e9c65[_0x1fc4b5(0xda)]['queryMessageCount'],document[_0x1fc4b5(0x119)](_0x1fc4b5(0xf4))['value']=_0x3e9c65['advanced'][_0x1fc4b5(0xef)],document['getElementById'](_0x1fc4b5(0x133))[_0x1fc4b5(0x10f)]=_0x3e9c65['retrieval']['batchSize'],document['getElementById'](_0x1fc4b5(0xd0))[_0x1fc4b5(0x10f)]=_0x3e9c65['injection'][_0x1fc4b5(0x16c)];const _0x3e9180=document[_0x1fc4b5(0x151)](_0x1fc4b5(0x147)+_0x3e9c65[_0x1fc4b5(0x16f)][_0x1fc4b5(0xc0)]+'\x22]');_0x3e9180&&(_0x3e9180[_0x1fc4b5(0x10b)]=!![]),document[_0x1fc4b5(0x119)](_0x1fc4b5(0x12f))['value']=_0x3e9c65['injection'][_0x1fc4b5(0xd4)],document[_0x1fc4b5(0x119)]('hly-injection-role')['value']=_0x3e9c65['injection'][_0x1fc4b5(0x127)],toggleInjectionDetails(),document[_0x1fc4b5(0x119)]('hly-condensation-enabled')[_0x1fc4b5(0x10b)]=_0x3e9c65['condensation']['enabled'],document[_0x1fc4b5(0x119)]('hly-layer-start')['value']=_0x3e9c65[_0x1fc4b5(0xe6)]['layerStart'],document[_0x1fc4b5(0x119)](_0x1fc4b5(0x100))[_0x1fc4b5(0x10f)]=_0x3e9c65[_0x1fc4b5(0xe6)]['layerEnd'],document[_0x1fc4b5(0x119)]('hly-include-user')[_0x1fc4b5(0x10b)]=_0x3e9c65[_0x1fc4b5(0xe6)][_0x1fc4b5(0x155)][_0x1fc4b5(0x124)],document[_0x1fc4b5(0x119)](_0x1fc4b5(0x167))[_0x1fc4b5(0x10b)]=_0x3e9c65[_0x1fc4b5(0xe6)][_0x1fc4b5(0x155)]['ai'],toggleCustomEndpointDocket();}function _0x49a7(_0x4a5791,_0x56ca9d){const _0x5b2d5d=_0x5b2d();return _0x49a7=function(_0x49a72e,_0x3ddf93){_0x49a72e=_0x49a72e-0xb9;let _0x120511=_0x5b2d5d[_0x49a72e];return _0x120511;},_0x49a7(_0x4a5791,_0x56ca9d);}function saveSettingsFromUI(){const _0x122c3e=_0x4f60a9,_0x400a36=_0x307795['getSettings']();if(!_0x400a36)return;_0x400a36[_0x122c3e(0xd3)][_0x122c3e(0xe9)]=document['getElementById']('hly-retrieval-enabled')[_0x122c3e(0x10b)],_0x400a36[_0x122c3e(0xd3)][_0x122c3e(0x158)]=document[_0x122c3e(0x119)](_0x122c3e(0x163))[_0x122c3e(0x10f)],_0x400a36[_0x122c3e(0xd3)][_0x122c3e(0x15f)]=document['getElementById']('hly-custom-api-url')[_0x122c3e(0x10f)],_0x400a36[_0x122c3e(0xd3)][_0x122c3e(0xca)]=document[_0x122c3e(0x119)]('hly-api-key')[_0x122c3e(0x10f)],_0x400a36[_0x122c3e(0xd3)][_0x122c3e(0x146)]=document['getElementById']('hly-embedding-model')[_0x122c3e(0x10f)],_0x400a36[_0x122c3e(0xd3)][_0x122c3e(0xba)]=document['getElementById'](_0x122c3e(0xeb))[_0x122c3e(0x10b)],_0x400a36[_0x122c3e(0xda)][_0x122c3e(0xbd)]=parseInt(document[_0x122c3e(0x119)](_0x122c3e(0x16b))['value']),_0x400a36[_0x122c3e(0xda)][_0x122c3e(0x14d)]=parseInt(document[_0x122c3e(0x119)](_0x122c3e(0x131))[_0x122c3e(0x10f)]),_0x400a36[_0x122c3e(0xda)][_0x122c3e(0x172)]=parseFloat(document[_0x122c3e(0x119)](_0x122c3e(0xc6))[_0x122c3e(0x10f)]),_0x400a36['advanced'][_0x122c3e(0x142)]=parseInt(document[_0x122c3e(0x119)](_0x122c3e(0x125))[_0x122c3e(0x10f)]),_0x400a36[_0x122c3e(0xda)][_0x122c3e(0xef)]=parseInt(document[_0x122c3e(0x119)]('hly-max-results')['value']),_0x400a36[_0x122c3e(0xd3)][_0x122c3e(0x11b)]=parseInt(document['getElementById'](_0x122c3e(0x133))['value']),_0x400a36['injection']['template']=document[_0x122c3e(0x119)](_0x122c3e(0xd0))[_0x122c3e(0x10f)],_0x400a36[_0x122c3e(0x16f)][_0x122c3e(0xc0)]=parseInt(document[_0x122c3e(0x151)]('input[name=\x22hly-injection-position\x22]:checked')[_0x122c3e(0x10f)]),_0x400a36['injection'][_0x122c3e(0xd4)]=parseInt(document[_0x122c3e(0x119)](_0x122c3e(0x12f))[_0x122c3e(0x10f)])||0x1,_0x400a36[_0x122c3e(0x16f)][_0x122c3e(0x127)]=parseInt(document['getElementById'](_0x122c3e(0xd6))[_0x122c3e(0x10f)]),_0x400a36[_0x122c3e(0xe6)][_0x122c3e(0xe9)]=document['getElementById'](_0x122c3e(0xf2))[_0x122c3e(0x10b)],_0x400a36[_0x122c3e(0xe6)][_0x122c3e(0xe3)]=parseInt(document['getElementById'](_0x122c3e(0xdb))[_0x122c3e(0x10f)]),_0x400a36[_0x122c3e(0xe6)][_0x122c3e(0x157)]=parseInt(document[_0x122c3e(0x119)](_0x122c3e(0x100))['value']),_0x400a36[_0x122c3e(0xe6)]['messageTypes'][_0x122c3e(0x124)]=document[_0x122c3e(0x119)](_0x122c3e(0xd2))[_0x122c3e(0x10b)],_0x400a36[_0x122c3e(0xe6)][_0x122c3e(0x155)]['ai']=document[_0x122c3e(0x119)](_0x122c3e(0x167))[_0x122c3e(0x10b)],_0x400a36['condensation'][_0x122c3e(0x155)][_0x122c3e(0x102)]=![],_0x307795[_0x122c3e(0xe7)](),toastr[_0x122c3e(0x16a)](_0x122c3e(0x15b),'圣旨已达');}function resetSettingsToUI(){const _0x9cf82c=_0x4f60a9;confirm(_0x9cf82c(0x120))&&(_0x307795['resetSettings'](),loadSettingsToUI(),toastr[_0x9cf82c(0x169)]('翰林院设定已重置为初始状态。','诏曰'));}async function updatePanelStatus(){const _0xc4f8ac=_0x4f60a9;document[_0xc4f8ac(0x119)](_0xc4f8ac(0x107))['textContent']=_0x38d560[_0xc4f8ac(0xfe)](),document['getElementById'](_0xc4f8ac(0x10a))['textContent']=_0x38d560['getChatId']()||'无';const _0x113660=document[_0xc4f8ac(0x119)](_0xc4f8ac(0x104));_0x113660[_0xc4f8ac(0x170)]=_0xc4f8ac(0x13a);try{const _0x64fa5b=await _0x307795[_0xc4f8ac(0xfc)]();_0x113660[_0xc4f8ac(0x170)]=_0x64fa5b;}catch(_0xe45ca0){console[_0xc4f8ac(0x103)]('[翰林院-枢纽]\x20更新忆识数量失败:',_0xe45ca0),_0x113660['textContent']='错误';}}async function testApi(){const _0x1c97cc=_0x4f60a9;toastr[_0x1c97cc(0x169)](_0x1c97cc(0x11f),'圣旨');try{await _0x307795[_0x1c97cc(0x138)](),toastr['success'](_0x1c97cc(0x113),'圣意');}catch(_0x5cb29f){toastr[_0x1c97cc(0x103)]('神力连接失败:\x20'+_0x5cb29f[_0x1c97cc(0xee)],'警报');}}async function fetchHLYEmbeddingModels(){const _0x58af44=_0x4f60a9,_0x44f0f8=document[_0x58af44(0x119)](_0x58af44(0x150)),_0x17b4fb=_0x44f0f8['value'];_0x44f0f8[_0x58af44(0xf1)]='<option>正在获取...</option>',_0x44f0f8[_0x58af44(0x12d)]=!![];try{log('开始获取嵌入模型列表...',_0x58af44(0x169));const _0x8114c5=await _0x307795[_0x58af44(0x109)]();_0x44f0f8[_0x58af44(0xf1)]='';if(_0x8114c5[_0x58af44(0x164)]===0x0){_0x44f0f8[_0x58af44(0xf1)]=_0x58af44(0x165),toastr['warn'](_0x58af44(0x166),_0x58af44(0xde)),log(_0x58af44(0x166),_0x58af44(0xf0));return;}_0x8114c5[_0x58af44(0xb9)](_0x30c051=>{const _0x54acba=_0x58af44,_0x4dc451=new Option(_0x30c051,_0x30c051);_0x44f0f8[_0x54acba(0x11d)](_0x4dc451);}),_0x8114c5['includes'](_0x17b4fb)?_0x44f0f8[_0x58af44(0x10f)]=_0x17b4fb:_0x44f0f8[_0x58af44(0xe4)]=0x0,toastr[_0x58af44(0x16a)](_0x58af44(0x10c)+_0x8114c5['length']+_0x58af44(0xcb),'圣意'),log('成功获取\x20'+_0x8114c5[_0x58af44(0x164)]+_0x58af44(0xcb),_0x58af44(0x16a));}catch(_0x36f85f){console[_0x58af44(0x103)]('[翰林院-枢纽]\x20获取模型列表失败:',_0x36f85f),toastr[_0x58af44(0x103)](_0x58af44(0xdf)+_0x36f85f[_0x58af44(0xee)],_0x58af44(0x171)),log('获取模型失败:\x20'+_0x36f85f[_0x58af44(0xee)],_0x58af44(0x103)),_0x44f0f8['innerHTML']=_0x58af44(0xe1);}finally{_0x44f0f8[_0x58af44(0x12d)]=![];}}async function purgeStorage(){const _0xa36d20=_0x4f60a9;if(confirm(_0xa36d20(0xe2))){toastr[_0xa36d20(0x169)](_0xa36d20(0x13e),'圣旨');const _0x183b31=await _0x307795['purgeStorage']();_0x183b31?toastr[_0xa36d20(0x16a)](_0xa36d20(0x114),'圣意'):toastr['error'](_0xa36d20(0x11c),'警报'),await updatePanelStatus();}}async function startCondensation(){const _0x268932=_0x4f60a9,_0x51cfeb=document[_0x268932(0x119)]('hly-condensation-results');_0x51cfeb[_0x268932(0x170)]=_0x268932(0x136),toastr['info']('正在准备凝识...','圣旨');try{const _0x3177b7=_0x307795[_0x268932(0xe5)]();if(!_0x3177b7||_0x3177b7[_0x268932(0x164)]===0x0){toastr['warning'](_0x268932(0xf8),_0x268932(0xde)),_0x51cfeb[_0x268932(0x170)]='未找到符合条件的消息。';return;}_0x51cfeb[_0x268932(0x170)]=_0x268932(0xc8)+_0x3177b7[_0x268932(0x164)]+_0x268932(0x10d),toastr['info']('已采集\x20'+_0x3177b7['length']+_0x268932(0x10d),_0x268932(0xde));const _0x11c36f=await _0x307795[_0x268932(0xc2)](_0x3177b7);if(_0x11c36f[_0x268932(0x16a)])toastr[_0x268932(0x16a)]('凝识完成!新增\x20'+_0x11c36f[_0x268932(0x126)]+_0x268932(0x140),_0x268932(0x121)),_0x51cfeb[_0x268932(0x170)]=_0x268932(0x12c)+_0x11c36f['count']+'\x20条忆识。';else throw new Error(_0x11c36f[_0x268932(0x103)]||_0x268932(0x13c));}catch(_0x26f7f5){console[_0x268932(0x103)]('[翰林院-枢纽]\x20凝识过程发生错误:',_0x26f7f5),toastr[_0x268932(0x103)]('凝识失败:\x20'+_0x26f7f5['message'],_0x268932(0x171)),_0x51cfeb[_0x268932(0x170)]=_0x268932(0x149)+_0x26f7f5[_0x268932(0xee)];}finally{await updatePanelStatus();}}async function showStats(){const _0x17e82d=_0x4f60a9;try{log(_0x17e82d(0x101),_0x17e82d(0x169)),toastr[_0x17e82d(0x169)]('正在查询宝库状态...','圣旨');const _0x38240e=await _0x307795[_0x17e82d(0xfc)](),_0x4d1519=_0x307795[_0x17e82d(0xe0)](),_0x27bcda=_0x307795[_0x17e82d(0x14a)](),_0x4914ee=_0x17e82d(0x143)+_0x4d1519+'\x0a忆识总数:\x20'+_0x38240e+_0x17e82d(0x108)+_0x27bcda[_0x17e82d(0xd3)][_0x17e82d(0x158)]+_0x17e82d(0x15a)+_0x27bcda[_0x17e82d(0xd3)][_0x17e82d(0x146)]+_0x17e82d(0x115);toastr[_0x17e82d(0x169)](_0x4914ee,_0x17e82d(0xed),{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log(_0x17e82d(0xbe)+_0x4d1519+',\x20忆识总数='+_0x38240e,_0x17e82d(0x16a));}catch(_0x510c3b){console[_0x17e82d(0x103)](_0x17e82d(0x14e),_0x510c3b),toastr[_0x17e82d(0x103)]('查询宝库状态失败:\x20'+_0x510c3b[_0x17e82d(0xee)],'严重错误'),log(_0x17e82d(0x144)+_0x510c3b[_0x17e82d(0xee)],_0x17e82d(0x103));}}function previewCondensation(){const _0x5203ab=_0x4f60a9,_0x21ce86=document['getElementById']('hly-condensation-results');try{const _0x1bce5a={'user':document['getElementById'](_0x5203ab(0xd2))[_0x5203ab(0x10b)],'ai':document['getElementById'](_0x5203ab(0x167))[_0x5203ab(0x10b)],'hidden':![]},_0x18d4b5=_0x307795['getMessagesForCondensation'](_0x1bce5a);if(!_0x18d4b5||_0x18d4b5[_0x5203ab(0x164)]===0x0){_0x21ce86[_0x5203ab(0x170)]=_0x5203ab(0xea);return;}const _0x8f08c7=_0x18d4b5[_0x5203ab(0xbb)]((_0x57b249,_0x2ae48c)=>_0x2ae48c+0x1+_0x5203ab(0x16d)+_0x57b249[_0x5203ab(0x174)]+_0x5203ab(0x15e)+_0x57b249['mes'])[_0x5203ab(0x112)]('\x0a\x0a');_0x21ce86[_0x5203ab(0x170)]=_0x5203ab(0x12b)+_0x18d4b5[_0x5203ab(0x164)]+_0x5203ab(0x148)+_0x8f08c7;}catch(_0x211b0e){_0x21ce86[_0x5203ab(0x170)]=_0x5203ab(0x106)+_0x211b0e['message'];}}function log(_0x58f844,_0x2ca290=_0x4f60a9(0x169)){const _0xc85658=_0x4f60a9,_0x29feac=document['getElementById'](_0xc85658(0xcd));if(!_0x29feac)return;const _0x848143=document['createElement']('p'),_0x297b67=new Date()[_0xc85658(0x122)]();let _0x4a34ad=_0xc85658(0xc5),_0x14770d='log-info';switch(_0x2ca290){case'success':_0x4a34ad=_0xc85658(0xcc),_0x14770d='log-success';break;case'error':_0x4a34ad='fa-times-circle',_0x14770d='log-error';break;case _0xc85658(0xf0):_0x4a34ad=_0xc85658(0xc7),_0x14770d=_0xc85658(0xd8);break;}_0x848143['className']='hly-log-entry\x20'+_0x14770d,_0x848143[_0xc85658(0xf1)]=_0xc85658(0x130)+_0x4a34ad+_0xc85658(0xe8)+_0x297b67+']\x20'+_0x58f844;const _0x1ab575=_0x29feac[_0xc85658(0x151)]('.hly-log-placeholder');_0x1ab575&&_0x1ab575[_0xc85658(0x129)](),_0x29feac[_0xc85658(0xbf)](_0x848143),_0x29feac['scrollTop']=_0x29feac[_0xc85658(0x13b)];}async function ingestManualText(){const _0x234acf=_0x4f60a9,_0x13fea6=document[_0x234acf(0x119)]('hly-manual-text'),_0x46aaad=_0x13fea6[_0x234acf(0x10f)][_0x234acf(0xec)]();if(!_0x46aaad){toastr[_0x234acf(0x137)](_0x234acf(0x12e),_0x234acf(0xde)),log(_0x234acf(0xff),_0x234acf(0xf0));return;}log('收到手动录入请求,文本长度:\x20'+_0x46aaad[_0x234acf(0x164)],'info'),toastr['info'](_0x234acf(0xd9),'圣旨');try{const _0x11a532=await _0x307795[_0x234acf(0x14b)](_0x46aaad);if(_0x11a532['success'])toastr['success'](_0x234acf(0xfb)+_0x11a532[_0x234acf(0x126)]+_0x234acf(0x140),'大功告成'),log(_0x234acf(0x134)+_0x11a532[_0x234acf(0x126)]+_0x234acf(0x140),_0x234acf(0x16a)),_0x13fea6['value']='';else throw new Error(_0x11a532[_0x234acf(0x103)]||_0x234acf(0x13c));}catch(_0x41b3a8){console[_0x234acf(0x103)](_0x234acf(0x132),_0x41b3a8),toastr['error'](_0x234acf(0xc4)+_0x41b3a8[_0x234acf(0xee)],'严重错误'),log('手动录入失败:\x20'+_0x41b3a8[_0x234acf(0xee)],_0x234acf(0x103));}finally{await updatePanelStatus();}}