From 1d9baf22ee39780b4ff6f3c3e5b2e41c434a8376 Mon Sep 17 00:00:00 2001
From: Wx-2025 <351320169@qq.com>
Date: Wed, 1 Oct 2025 23:42:44 +0800
Subject: [PATCH] Update hanlinyuan-bindings.js
---
ui/hanlinyuan-bindings.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/hanlinyuan-bindings.js b/ui/hanlinyuan-bindings.js
index c80ef73..27d962f 100644
--- a/ui/hanlinyuan-bindings.js
+++ b/ui/hanlinyuan-bindings.js
@@ -1 +1 @@
-const _0x30c5e9=_0xe9ce;(function(_0x594cd1,_0x246ac1){const _0xd6bcdc=_0xe9ce,_0x105e1d=_0x594cd1();while(!![]){try{const _0x55c5e9=parseInt(_0xd6bcdc(0xbf))/0x1*(parseInt(_0xd6bcdc(0x16e))/0x2)+-parseInt(_0xd6bcdc(0x114))/0x3+parseInt(_0xd6bcdc(0x27b))/0x4*(parseInt(_0xd6bcdc(0xcb))/0x5)+parseInt(_0xd6bcdc(0x1f5))/0x6*(parseInt(_0xd6bcdc(0x243))/0x7)+-parseInt(_0xd6bcdc(0x120))/0x8+parseInt(_0xd6bcdc(0x17a))/0x9+parseInt(_0xd6bcdc(0x1c8))/0xa;if(_0x55c5e9===_0x246ac1)break;else _0x105e1d['push'](_0x105e1d['shift']());}catch(_0x54499a){_0x105e1d['push'](_0x105e1d['shift']());}}}(_0x1d12,0xd4239));import{getContext}from'/scripts/extensions.js';import*as _0x1d6382 from'../core/rag-processor.js';import*as _0x15d4ce from'../core/historiographer.js';import*as _0x7530ec from'../core/utils/context-utils.js';import*as _0x536e9e from'../core/ingestion-manager.js';import{showContentModal,showHtmlModal}from'./page-window.js';import{extractBlocksByTags,applyExclusionRules}from'../core/utils/rag-tag-extractor.js';import{filterWorldbooks,filterWorldbookEntries,highlightSearchMatch,debounce}from'../core/rag-processor.js';_0x30c5e9(0x211);function setupGlobalEventHandlers(){const _0x167668=_0x30c5e9;window[_0x167668(0x200)]=()=>saveSettingsFromUI(![]),window[_0x167668(0x19c)]=resetSettingsToUI,window[_0x167668(0x25b)]=testApi,window[_0x167668(0x1f8)]=fetchHLYEmbeddingModels,window[_0x167668(0x1b4)]=fetchHLYRerankModels,window['updateHLYMemoryCount']=updatePanelStatus,window[_0x167668(0x116)]=purgeStorage,window[_0x167668(0x1bd)]=startCondensation,window['previewHLYCondensation']=previewCondensation,window[_0x167668(0xf9)]=ingestManualText,window[_0x167668(0x207)]=log,window[_0x167668(0x271)]=showStats,window[_0x167668(0x155)]=startHistoriography;}function updateAndSaveSetting(_0x5854a4,_0xc3c4a9){const _0x1bb610=_0x30c5e9,_0x7035ec=_0x1d6382[_0x1bb610(0x108)]();if(!_0x7035ec)return;const _0x12be85=_0x5854a4['split']('.');let _0x241c4a=_0x7035ec;for(let _0x34f38c=0x0;_0x34f38c<_0x12be85['length']-0x1;_0x34f38c++){_0x241c4a=_0x241c4a[_0x12be85[_0x34f38c]]=_0x241c4a[_0x12be85[_0x34f38c]]||{};}_0x241c4a[_0x12be85[_0x12be85[_0x1bb610(0x174)]-0x1]]=_0xc3c4a9,_0x1d6382[_0x1bb610(0x1af)](),log(_0x1bb610(0x125)+_0x5854a4+'\x27\x20已更新为:\x20'+JSON['stringify'](_0xc3c4a9),_0x1bb610(0x140));}function bindAutoSaveEvents(){const _0x2ee5d2=_0x30c5e9,_0x33c679=document[_0x2ee5d2(0x14b)](_0x2ee5d2(0x1fd));if(!_0x33c679)return;_0x33c679[_0x2ee5d2(0xfc)](_0x2ee5d2(0x1ff),_0x46b375=>{const _0x4a1d2a=_0x2ee5d2,_0x15c35f=_0x46b375[_0x4a1d2a(0x17e)],_0x237228=_0x15c35f[_0x4a1d2a(0x111)][_0x4a1d2a(0x188)];if(!_0x237228)return;let _0x39faa3;const _0x192304=_0x15c35f['dataset'][_0x4a1d2a(0xa7)]||'string';if(_0x15c35f['type']===_0x4a1d2a(0x1f7))_0x39faa3=_0x15c35f[_0x4a1d2a(0x28c)];else{if(_0x15c35f[_0x4a1d2a(0xa7)]===_0x4a1d2a(0xf2)){if(_0x15c35f[_0x4a1d2a(0x28c)]){const _0x25b395=_0x33c679[_0x4a1d2a(0x1e1)]('input[name=\x22'+_0x15c35f[_0x4a1d2a(0x206)]+'\x22]'),_0x3ece3b=Array['from'](_0x25b395)[_0x4a1d2a(0x278)](_0x449a7d=>_0x449a7d['checked']);_0x39faa3=_0x3ece3b[_0x4a1d2a(0x1b2)];}else return;}else _0x39faa3=_0x15c35f['value'];}switch(_0x192304){case _0x4a1d2a(0x280):_0x39faa3=parseInt(_0x39faa3,0xa);break;case _0x4a1d2a(0xac):_0x39faa3=parseFloat(_0x39faa3);break;case _0x4a1d2a(0x237):typeof _0x39faa3!=='boolean'&&(_0x39faa3=_0x39faa3===_0x4a1d2a(0xb9));break;}if(_0x15c35f[_0x4a1d2a(0xa7)]==='radio'&&!_0x15c35f[_0x4a1d2a(0x28c)])return;updateAndSaveSetting(_0x237228,_0x39faa3);});}export function bindHanlinyuanEvents(){const _0x1ca1f2=_0x30c5e9,_0x143205=getContext();if(!_0x143205){console[_0x1ca1f2(0x277)]('[翰林院-枢纽]\x20未能获取SillyTavern上下文,绑定失败。');return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents(),bindTutorialEvents(),bindAutoSaveEvents(),bindSessionLockEvent(),initializeUnifiedInjectionEditor();if(_0x1d6382[_0x1ca1f2(0x1aa)])_0x1d6382[_0x1ca1f2(0x1aa)]();else{console['error'](_0x1ca1f2(0x23d));return;}loadSettingsToUI(),loadWorldbookList(),log('[翰林院-枢纽]\x20已成功连接各部,政令畅通。',_0x1ca1f2(0x185));const _0x298ac1=document[_0x1ca1f2(0x14b)](_0x1ca1f2(0x17c)),_0xb48dbe=document[_0x1ca1f2(0x14b)](_0x1ca1f2(0x18f)),_0x44be8b=document[_0x1ca1f2(0x14b)](_0x1ca1f2(0x168)),_0x204318=document['getElementById']('hanlinyuan-ingest-abort'),_0x16c21d=document['getElementById']('hanlinyuan-ingest-progress-container'),_0x57bb8c=document[_0x1ca1f2(0x14b)]('hanlinyuan-ingest-progress-bar'),_0x455685=document[_0x1ca1f2(0x14b)](_0x1ca1f2(0x28d)),_0x2fd3e2=document[_0x1ca1f2(0x14b)](_0x1ca1f2(0x28b));let _0x2c723d=null,_0x42c91a=null;_0x298ac1[_0x1ca1f2(0xfc)](_0x1ca1f2(0x1ff),_0x3a6e72=>{const _0x200552=_0x1ca1f2;_0x2c723d=_0x3a6e72[_0x200552(0x17e)][_0x200552(0x130)][0x0],_0x2c723d?(_0xb48dbe[_0x200552(0x24d)]=_0x2c723d['name'],_0xb48dbe[_0x200552(0x251)]=_0x2c723d[_0x200552(0x206)]):_0xb48dbe[_0x200552(0x24d)]=_0x200552(0x183);}),_0x44be8b['addEventListener'](_0x1ca1f2(0x10f),async()=>{const _0x3a3ab3=_0x1ca1f2;if(!_0x2c723d){toastr[_0x3a3ab3(0x146)](_0x3a3ab3(0x229));return;}let _0xb1533c=0x0;const _0x18fe2c=_0x536e9e[_0x3a3ab3(0x163)](_0x2c723d),_0x1944fc=_0x536e9e['loadProgress'](_0x18fe2c);if(_0x1944fc){const _0x16e95c=(_0x1944fc[_0x3a3ab3(0x21e)]/_0x1944fc['totalChunks']*0x64)[_0x3a3ab3(0xc4)](0x1),_0x13f0b7=confirm(_0x3a3ab3(0x1a8)+_0x16e95c+_0x3a3ab3(0x16c));_0x13f0b7?(_0xb1533c=_0x1944fc['processedChunks'],toastr[_0x3a3ab3(0x185)]('遵命,将从第\x20'+(_0xb1533c+0x1)+_0x3a3ab3(0x16b),_0x3a3ab3(0x1a9)),log(_0x3a3ab3(0x241)+_0x18fe2c+_0x3a3ab3(0x190)+_0xb1533c+_0x3a3ab3(0xbe),'info')):(_0x536e9e[_0x3a3ab3(0x15f)](_0x18fe2c),toastr[_0x3a3ab3(0x185)](_0x3a3ab3(0x1b5),_0x3a3ab3(0x1a9)),log(_0x3a3ab3(0xc5)+_0x18fe2c+',重新开始。',_0x3a3ab3(0x1b7)));}_0x42c91a=new AbortController();const _0x137dbe=_0x42c91a[_0x3a3ab3(0xe8)];_0x2fd3e2[_0x3a3ab3(0x109)][_0x3a3ab3(0x1b0)]=_0x3a3ab3(0x1be),_0x16c21d['style'][_0x3a3ab3(0x1b0)]='block',_0x455685['textContent']=_0x3a3ab3(0x147),_0x57bb8c[_0x3a3ab3(0x1b2)]=0x0;try{const _0x360904=await _0x2c723d[_0x3a3ab3(0xcc)](),_0x1ed705=_0x1aa988=>{const _0xf1c65d=_0x3a3ab3;_0x455685[_0xf1c65d(0x24d)]=_0xf1c65d(0x177)+_0x1aa988[_0xf1c65d(0x250)]+'\x20('+_0x1aa988['processed']+'/'+_0x1aa988[_0xf1c65d(0x221)]+')',_0x57bb8c['value']=_0x1aa988[_0xf1c65d(0xc9)]/_0x1aa988[_0xf1c65d(0x221)]*0x64;},_0x16aedc=()=>{const _0x8c33fd=_0x3a3ab3;updatePanelStatus(),log(_0x8c33fd(0x205),_0x8c33fd(0x185));},_0x4022d2=await _0x1d6382[_0x3a3ab3(0xa0)](_0x360904,_0x3a3ab3(0x172),{'sourceName':_0x2c723d[_0x3a3ab3(0x206)]},_0x1ed705,_0x137dbe,log,_0x16aedc,_0x18fe2c,_0xb1533c);if(_0x4022d2[_0x3a3ab3(0x140)])toastr['success']('成功录入\x20'+_0x4022d2[_0x3a3ab3(0x1db)]+'\x20个知识块'),_0x455685[_0x3a3ab3(0x24d)]='任务完成!成功录入\x20'+_0x4022d2[_0x3a3ab3(0x1db)]+_0x3a3ab3(0x121),_0x57bb8c[_0x3a3ab3(0x1b2)]=0x64,updatePanelStatus();else throw new Error(_0x4022d2[_0x3a3ab3(0x277)]||_0x3a3ab3(0x26b));}catch(_0x35bbae){_0x35bbae[_0x3a3ab3(0x206)]===_0x3a3ab3(0xf3)?(toastr[_0x3a3ab3(0x185)](_0x3a3ab3(0x1a7)),_0x455685[_0x3a3ab3(0x24d)]=_0x3a3ab3(0xc1)):(toastr['error'](_0x3a3ab3(0x18c)+_0x35bbae[_0x3a3ab3(0x250)]+'。进度已保存,可稍后重试。'),_0x455685[_0x3a3ab3(0x24d)]=_0x3a3ab3(0x139)+_0x35bbae[_0x3a3ab3(0x250)]);}finally{setTimeout(()=>{const _0x5496a4=_0x3a3ab3;_0x2fd3e2[_0x5496a4(0x109)][_0x5496a4(0x1b0)]=_0x5496a4(0x257),_0x16c21d[_0x5496a4(0x109)][_0x5496a4(0x1b0)]='none',_0x298ac1[_0x5496a4(0x1b2)]='',_0x2c723d=null,_0xb48dbe[_0x5496a4(0x24d)]=_0x5496a4(0x183);},0xbb8);}}),_0x204318[_0x1ca1f2(0xfc)]('click',()=>{const _0x35eaed=_0x1ca1f2;_0x42c91a&&_0x42c91a[_0x35eaed(0x10e)]();});}function bindSessionLockEvent(){const _0x4f578f=_0x30c5e9,_0xc9a714=document[_0x4f578f(0x14b)](_0x4f578f(0x179));if(!_0xc9a714)return;_0xc9a714[_0x4f578f(0xfc)]('click',async()=>{const _0x460227=_0x4f578f,_0x14adad=await _0x1d6382['toggleSessionLock']();updateSessionLockUI(_0x14adad);if(_0x14adad){const _0x52d3af=_0x1d6382['getLockedSessionInfo']();_0x52d3af&&(toastr[_0x460227(0x140)](_0x460227(0x256)+_0x52d3af['id'],_0x460227(0x187)),log('会话已锁定到宝库:\x20'+_0x52d3af['id'],_0x460227(0x140)));}else toastr[_0x460227(0x185)]('会话已解锁,将跟随当前角色。','诏曰'),log(_0x460227(0x19f),_0x460227(0x185));updatePanelStatus();}),updateSessionLockUI(_0x1d6382[_0x4f578f(0x23e)]());}function updateSessionLockUI(_0x41d3e3){const _0x14fdcb=_0x30c5e9,_0x308ddb=document['getElementById']('hly-session-lock-btn');if(!_0x308ddb)return;const _0x4f064c=_0x308ddb[_0x14fdcb(0x242)]('i'),_0x184033=_0x308ddb[_0x14fdcb(0x242)]('span');_0x41d3e3?(_0x308ddb[_0x14fdcb(0x167)][_0x14fdcb(0x152)]('active'),_0x4f064c[_0x14fdcb(0x1ab)]='fas\x20fa-lock',_0x184033['textContent']=_0x14fdcb(0x17f),_0x308ddb['title']=_0x14fdcb(0x261)):(_0x308ddb[_0x14fdcb(0x167)][_0x14fdcb(0x160)](_0x14fdcb(0x230)),_0x4f064c['className']=_0x14fdcb(0x124),_0x184033[_0x14fdcb(0x24d)]='锁定会话',_0x308ddb[_0x14fdcb(0x251)]=_0x14fdcb(0x212));}function bindPanelToggleEvents(){const _0x272b49=_0x30c5e9,_0x52f6fd=document[_0x272b49(0x14b)](_0x272b49(0x173));if(_0x52f6fd){}}function bindTutorialEvents(){const _0x550fad=_0x30c5e9,_0x32bfda=document[_0x550fad(0x14b)]('amily2_open_hanlin_tutorial');_0x32bfda&&_0x32bfda['addEventListener'](_0x550fad(0x10f),()=>{const _0x97d7a5=_0x550fad;showContentModal(_0x97d7a5(0xc7),'scripts/extensions/third-party/ST-Amily2-Chat-Optimisation/HanLin.md');});}function bindInternalUIEvents(){const _0x124c7d=_0x30c5e9,_0x5f0655=document['querySelectorAll']('.hly-nav-item');_0x5f0655['forEach'](_0x1df02b=>{const _0x40de3d=_0xe9ce;_0x1df02b[_0x40de3d(0xfc)](_0x40de3d(0x10f),()=>{const _0x5ea329=_0x40de3d,_0xc6d747=_0x1df02b[_0x5ea329(0x111)][_0x5ea329(0x27d)],_0x4c1af3='hly-'+_0xc6d747+_0x5ea329(0x113);document[_0x5ea329(0x1e1)](_0x5ea329(0x1c4))[_0x5ea329(0x1e5)](_0x13ec8d=>{const _0x13ce9a=_0x5ea329;_0x13ec8d[_0x13ce9a(0x167)][_0x13ce9a(0x1ea)](_0x13ce9a(0x230),_0x13ec8d['id']===_0x4c1af3);}),_0x5f0655[_0x5ea329(0x1e5)](_0x215319=>_0x215319[_0x5ea329(0x167)][_0x5ea329(0x1ea)]('active',_0x215319===_0x1df02b));});});const _0x348b99=document[_0x124c7d(0x14b)](_0x124c7d(0x228));_0x348b99&&_0x348b99['addEventListener']('change',handleApiModeChange);const _0x621561=document['getElementById'](_0x124c7d(0x13d)),_0x1ddf62=document[_0x124c7d(0x14b)](_0x124c7d(0x1f0));_0x621561&&_0x1ddf62&&_0x621561[_0x124c7d(0xfc)](_0x124c7d(0x1ff),()=>{const _0x469633=_0x124c7d;_0x1ddf62[_0x469633(0x109)]['display']=_0x621561['checked']?'block':_0x469633(0x1be);});const _0x30a5f5=document['getElementById'](_0x124c7d(0x1ec));_0x30a5f5&&_0x30a5f5[_0x124c7d(0xfc)](_0x124c7d(0x1ff),handleWorldbookSelectionChange);const _0x4da639=document[_0x124c7d(0x14b)]('hly-exclusion-rules-btn');_0x4da639&&_0x4da639['addEventListener']('click',showExclusionRulesModal);const _0xb57d01=document[_0x124c7d(0x14b)](_0x124c7d(0x269)),_0x52810d=document[_0x124c7d(0x14b)](_0x124c7d(0x253));_0xb57d01&&_0x52810d&&(_0xb57d01[_0x124c7d(0xfc)](_0x124c7d(0x10f),_0x2b49c4=>{const _0x13a3ca=_0x124c7d;_0x2b49c4[_0x13a3ca(0x1c9)]();const _0x2209ec=_0x52810d['style'][_0x13a3ca(0x1b0)]===_0x13a3ca(0xb4);_0x52810d[_0x13a3ca(0x109)][_0x13a3ca(0x1b0)]=_0x2209ec?_0x13a3ca(0x1be):_0x13a3ca(0xb4);}),_0x52810d[_0x124c7d(0xfc)](_0x124c7d(0x1ff),_0xbff031=>{const _0x27da60=_0x124c7d,_0x35e85d=_0xbff031[_0x27da60(0x17e)];if(_0x35e85d[_0x27da60(0xa7)]!=='checkbox')return;const _0x440158=_0x52810d['querySelectorAll'](_0x27da60(0xe3)),_0x502e4f=document[_0x27da60(0x14b)]('hly-hist-select-all-entries');if(_0x35e85d['id']===_0x27da60(0x255))_0x440158['forEach'](_0x5b6b2d=>_0x5b6b2d[_0x27da60(0x28c)]=_0x35e85d[_0x27da60(0x28c)]);else{const _0x1a2f64=Array[_0x27da60(0x25c)](_0x440158)['every'](_0x1009ea=>_0x1009ea[_0x27da60(0x28c)]);_0x502e4f[_0x27da60(0x28c)]=_0x1a2f64;}const _0x3a5280=_0x52810d[_0x27da60(0x1e1)]('.hly-hist-entry-checkbox:checked')['length'],_0x168cce=_0x440158[_0x27da60(0x174)];_0xb57d01['querySelector']('span')[_0x27da60(0x24d)]=_0x27da60(0x1a0)+_0x3a5280+_0x27da60(0x263)+_0x168cce+_0x27da60(0xdf);}),document[_0x124c7d(0xfc)](_0x124c7d(0x10f),_0x514576=>{const _0x58f492=_0x124c7d;!_0xb57d01[_0x58f492(0x1c6)](_0x514576[_0x58f492(0x17e)])&&!_0x52810d['contains'](_0x514576[_0x58f492(0x17e)])&&(_0x52810d[_0x58f492(0x109)]['display']=_0x58f492(0x1be));}));const _0x28f27e=document[_0x124c7d(0x14b)](_0x124c7d(0x182));_0x28f27e&&_0x28f27e[_0x124c7d(0xfc)](_0x124c7d(0x10f),deleteAllLocalKnowledgeBases);const _0x45eebc=document[_0x124c7d(0x14b)](_0x124c7d(0x16d));_0x45eebc&&_0x45eebc[_0x124c7d(0xfc)](_0x124c7d(0x10f),()=>moveAllKnowledgeBases(_0x124c7d(0x1ca)));const _0x2390e8=document[_0x124c7d(0x14b)](_0x124c7d(0x1e9));_0x2390e8&&_0x2390e8[_0x124c7d(0xfc)](_0x124c7d(0x10f),()=>moveAllKnowledgeBases(_0x124c7d(0x20a)));const _0x2ead3a=['hly-kb-list-local',_0x124c7d(0x11d)];_0x2ead3a['forEach'](_0x54c950=>{const _0x30619d=_0x124c7d,_0x516433=document[_0x30619d(0x14b)](_0x54c950);_0x516433&&(_0x516433[_0x30619d(0xfc)](_0x30619d(0x10f),handleKbAction),_0x516433[_0x30619d(0xfc)](_0x30619d(0x1ff),handleKbAction));}),document['getElementById'](_0x124c7d(0x279))[_0x124c7d(0xfc)](_0x124c7d(0x1ff),_0x5120cd=>handleSelectAll(_0x5120cd,'global')),document[_0x124c7d(0x14b)](_0x124c7d(0x184))[_0x124c7d(0xfc)](_0x124c7d(0x1ff),_0x12c0e9=>handleSelectAll(_0x12c0e9,'local')),document[_0x124c7d(0x14b)](_0x124c7d(0x274))[_0x124c7d(0xfc)]('click',_0x13eede=>handleBulkAction(_0x13eede,_0x124c7d(0x220))),document[_0x124c7d(0x14b)](_0x124c7d(0x166))[_0x124c7d(0xfc)]('click',_0x5e9eb9=>handleBulkAction(_0x5e9eb9,'local'));}function initializeUnifiedInjectionEditor(){const _0x3bae20=_0x30c5e9,_0x5d09f9=document[_0x3bae20(0x14b)](_0x3bae20(0x132)),_0x182885=document[_0x3bae20(0x14b)](_0x3bae20(0x218)),_0xac9c55=document[_0x3bae20(0x14b)](_0x3bae20(0x26c)),_0x503cb9=document[_0x3bae20(0x1e1)]('input[name=\x22hly-unified-injection-position\x22]'),_0x549f88=document['getElementById'](_0x3bae20(0xc0)),_0x48110a=document[_0x3bae20(0x14b)](_0x3bae20(0x194));if(!_0x5d09f9)return;const _0x9e0fac={'novel':'{{novel_text}}','chat':_0x3bae20(0x225),'lorebook':_0x3bae20(0x198),'manual':'{{manual_text}}'};function _0x25d0d6(){const _0xa82f80=_0x3bae20,_0x1d4f8d=_0x5d09f9[_0xa82f80(0x1b2)],_0x359b0c=_0x1d6382[_0xa82f80(0x108)](),_0x4a2dc2=_0x359b0c[_0xa82f80(0x12c)+_0x1d4f8d]||{};_0x182885[_0xa82f80(0x1b2)]=_0x4a2dc2['template']||'',_0xac9c55[_0xa82f80(0x24d)]='以\x20'+(_0x9e0fac[_0x1d4f8d]||_0xa82f80(0x178))+'\x20为占位符。';const _0x5c5668=_0x4a2dc2[_0xa82f80(0x10d)]!==undefined?String(_0x4a2dc2['position']):'2';_0x503cb9['forEach'](_0x41782b=>_0x41782b[_0xa82f80(0x28c)]=_0x41782b[_0xa82f80(0x1b2)]===_0x5c5668),_0x549f88['value']=_0x4a2dc2[_0xa82f80(0xe9)]||0x0,_0x48110a['value']=_0x4a2dc2[_0xa82f80(0x1d7)]!==undefined?String(_0x4a2dc2[_0xa82f80(0x1d7)]):'0';const _0x267a59=_0x5c5668==='1';_0x549f88[_0xa82f80(0xab)]=!_0x267a59,_0x48110a['disabled']=!_0x267a59;}function _0x5296bb(){const _0x1c2120=_0x3bae20,_0x69c9e1=_0x5d09f9['value'];updateAndSaveSetting('injection_'+_0x69c9e1+'.template',_0x182885[_0x1c2120(0x1b2)]);const _0x397b9b=document[_0x1c2120(0x242)](_0x1c2120(0x153));_0x397b9b&&updateAndSaveSetting(_0x1c2120(0x12c)+_0x69c9e1+_0x1c2120(0x180),parseInt(_0x397b9b[_0x1c2120(0x1b2)],0xa)),updateAndSaveSetting(_0x1c2120(0x12c)+_0x69c9e1+_0x1c2120(0xf8),parseInt(_0x549f88['value'],0xa)),updateAndSaveSetting(_0x1c2120(0x12c)+_0x69c9e1+_0x1c2120(0x1c7),parseInt(_0x48110a[_0x1c2120(0x1b2)],0xa));}_0x5d09f9[_0x3bae20(0xfc)](_0x3bae20(0x1ff),_0x25d0d6);const _0x318433=debounce(_0x5296bb,0x12c);_0x182885[_0x3bae20(0xfc)](_0x3bae20(0xb5),_0x318433),_0x549f88[_0x3bae20(0xfc)](_0x3bae20(0x1ff),_0x5296bb),_0x48110a[_0x3bae20(0xfc)](_0x3bae20(0x1ff),_0x5296bb),_0x503cb9[_0x3bae20(0x1e5)](_0x1e9dfd=>_0x1e9dfd[_0x3bae20(0xfc)](_0x3bae20(0x1ff),()=>{const _0x2172a4=_0x3bae20;_0x5296bb();const _0xc7dfd0=_0x1e9dfd[_0x2172a4(0x1b2)]==='1'&&_0x1e9dfd[_0x2172a4(0x28c)];_0x549f88['disabled']=!_0xc7dfd0,_0x48110a[_0x2172a4(0xab)]=!_0xc7dfd0;})),_0x25d0d6();}function handleApiModeChange(){const _0x533f64=_0x30c5e9,_0x170099=document[_0x533f64(0x14b)](_0x533f64(0x228))[_0x533f64(0x1b2)],_0x5a8b7e=document[_0x533f64(0x14b)]('hly-custom-endpoint-docket'),_0x2c3cc9=document[_0x533f64(0x14b)](_0x533f64(0x12a)),_0xa09168=document['getElementById']('hly-embedding-model'),_0x35a9ae=_0xa09168['previousElementSibling'];if(!_0x5a8b7e||!_0x2c3cc9)return;_0x5a8b7e['style'][_0x533f64(0x1b0)]=_0x533f64(0xb4),_0x2c3cc9[_0x533f64(0x109)]['display']=_0x533f64(0xb4);switch(_0x170099){case _0x533f64(0xbd):_0x5a8b7e[_0x533f64(0x109)]['display']=_0x533f64(0x1be),_0x2c3cc9['querySelector'](_0x533f64(0x176))[_0x533f64(0x24d)]='Google\x20API\x20Key:',_0x2c3cc9[_0x533f64(0x242)]('input')['placeholder']='请输入您的Google\x20API\x20Key';break;case _0x533f64(0x1cb):_0x5a8b7e[_0x533f64(0x242)]('label')[_0x533f64(0x24d)]=_0x533f64(0xf6),_0x5a8b7e[_0x533f64(0x242)]('input')['placeholder']=_0x533f64(0x21f),_0x2c3cc9[_0x533f64(0x109)]['display']=_0x533f64(0x1be);break;case _0x533f64(0xef):default:_0x5a8b7e[_0x533f64(0x242)]('label')[_0x533f64(0x24d)]=_0x533f64(0x282),_0x5a8b7e[_0x533f64(0x242)](_0x533f64(0xb5))[_0x533f64(0xcd)]=_0x533f64(0x117),_0x2c3cc9[_0x533f64(0x242)](_0x533f64(0x176))[_0x533f64(0x24d)]=_0x533f64(0x28e);break;}}function loadSettingsToUI(){const _0x3f1d5c=_0x30c5e9,_0x50a151=_0x1d6382[_0x3f1d5c(0x108)]();if(!_0x50a151)return;document['getElementById'](_0x3f1d5c(0x22c))[_0x3f1d5c(0x28c)]=_0x50a151['retrieval'][_0x3f1d5c(0xf7)],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x228))[_0x3f1d5c(0x1b2)]=_0x50a151[_0x3f1d5c(0x24e)][_0x3f1d5c(0x25f)],document['getElementById'](_0x3f1d5c(0x272))['value']=_0x50a151['retrieval']['customApiUrl'],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x1d9))[_0x3f1d5c(0x1b2)]=_0x50a151['retrieval']['apiKey'];const _0x1e5082=document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x1fe));if(_0x1e5082['options'][_0x3f1d5c(0x174)]===0x0){const _0x139fbd=_0x50a151['retrieval']['embeddingModel'],_0x332ee4=new Option(_0x139fbd,_0x139fbd,!![],!![]);_0x1e5082['add'](_0x332ee4);}_0x1e5082[_0x3f1d5c(0x1b2)]=_0x50a151[_0x3f1d5c(0x24e)][_0x3f1d5c(0x127)],document[_0x3f1d5c(0x14b)]('hly-retrieval-notify')[_0x3f1d5c(0x28c)]=_0x50a151['retrieval']['notify'],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x24b))[_0x3f1d5c(0x1b2)]=_0x50a151[_0x3f1d5c(0x15b)]['chunkSize'],document['getElementById']('hly-overlap-size')[_0x3f1d5c(0x1b2)]=_0x50a151[_0x3f1d5c(0x15b)]['overlap'],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x1f2))[_0x3f1d5c(0x1b2)]=_0x50a151['advanced'][_0x3f1d5c(0x287)],document['getElementById'](_0x3f1d5c(0x106))['value']=_0x50a151[_0x3f1d5c(0x15b)][_0x3f1d5c(0x248)],document['getElementById'](_0x3f1d5c(0x27e))['value']=_0x50a151[_0x3f1d5c(0x15b)]['maxResults'],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x1d1))['value']=_0x50a151[_0x3f1d5c(0x24e)]['batchSize'],handleApiModeChange(),document[_0x3f1d5c(0x14b)]('hly-condensation-enabled')[_0x3f1d5c(0x28c)]=_0x50a151[_0x3f1d5c(0x129)][_0x3f1d5c(0xf7)],document['getElementById'](_0x3f1d5c(0x284))[_0x3f1d5c(0x1b2)]=_0x50a151[_0x3f1d5c(0x129)][_0x3f1d5c(0x137)],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x103))['value']=_0x50a151['condensation'][_0x3f1d5c(0x240)],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0xd9))['checked']=_0x50a151[_0x3f1d5c(0x129)][_0x3f1d5c(0x289)][_0x3f1d5c(0x13c)],document[_0x3f1d5c(0x14b)]('hly-include-ai')[_0x3f1d5c(0x28c)]=_0x50a151[_0x3f1d5c(0x129)]['messageTypes']['ai'];const _0x3519ff=document['getElementById'](_0x3f1d5c(0x13d)),_0x3dcf57=document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x1ce)),_0xba4534=document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x1f0));_0x3519ff[_0x3f1d5c(0x28c)]=_0x50a151[_0x3f1d5c(0x129)][_0x3f1d5c(0x144)],_0x3dcf57[_0x3f1d5c(0x1b2)]=_0x50a151[_0x3f1d5c(0x129)][_0x3f1d5c(0x19e)],_0xba4534[_0x3f1d5c(0x109)][_0x3f1d5c(0x1b0)]=_0x3519ff[_0x3f1d5c(0x28c)]?_0x3f1d5c(0xb4):'none',document[_0x3f1d5c(0x14b)]('hly-rerank-enabled')['checked']=_0x50a151[_0x3f1d5c(0xda)][_0x3f1d5c(0xf7)],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0xd5))[_0x3f1d5c(0x1b2)]=_0x50a151[_0x3f1d5c(0xda)][_0x3f1d5c(0xaf)],document[_0x3f1d5c(0x14b)]('hly-rerank-api-key')['value']=_0x50a151[_0x3f1d5c(0xda)][_0x3f1d5c(0x110)];const _0x3eb593=document['getElementById'](_0x3f1d5c(0x27f));if(_0x3eb593['options'][_0x3f1d5c(0x174)]===0x0){const _0x36e174=_0x50a151[_0x3f1d5c(0xda)][_0x3f1d5c(0x164)];if(_0x36e174){const _0xf8c80f=new Option(_0x36e174,_0x36e174,!![],!![]);_0x3eb593['add'](_0xf8c80f);}}_0x3eb593[_0x3f1d5c(0x1b2)]=_0x50a151[_0x3f1d5c(0xda)][_0x3f1d5c(0x164)],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0xd7))[_0x3f1d5c(0x1b2)]=_0x50a151['rerank'][_0x3f1d5c(0x11e)],document[_0x3f1d5c(0x14b)]('hly-rerank-hybrid-alpha')[_0x3f1d5c(0x1b2)]=_0x50a151['rerank'][_0x3f1d5c(0x1a5)],document[_0x3f1d5c(0x14b)](_0x3f1d5c(0x1f1))['checked']=_0x50a151[_0x3f1d5c(0xda)][_0x3f1d5c(0x1b9)];}function saveSettingsFromUI(_0x348d2d=!![]){const _0x5621d5=_0x30c5e9,_0x326763=document[_0x5621d5(0x14b)](_0x5621d5(0x1fd));if(!_0x326763)return;const _0x35c442=_0x326763['querySelectorAll'](_0x5621d5(0x1a4));_0x35c442[_0x5621d5(0x1e5)](_0x3d1fd6=>{const _0xb3ded4=_0x5621d5,_0x216ece=_0x3d1fd6['dataset'][_0xb3ded4(0x188)];if(!_0x216ece)return;let _0x1964e6;const _0x27876e=_0x3d1fd6['dataset'][_0xb3ded4(0xa7)]||_0xb3ded4(0x222);if(_0x3d1fd6[_0xb3ded4(0xa7)]===_0xb3ded4(0x1f7))_0x1964e6=_0x3d1fd6[_0xb3ded4(0x28c)];else{if(_0x3d1fd6[_0xb3ded4(0xa7)]==='radio'){if(!_0x3d1fd6['checked'])return;_0x1964e6=_0x3d1fd6[_0xb3ded4(0x1b2)];}else _0x1964e6=_0x3d1fd6[_0xb3ded4(0x1b2)];}switch(_0x27876e){case'integer':_0x1964e6=parseInt(_0x1964e6,0xa);break;case _0xb3ded4(0xac):_0x1964e6=parseFloat(_0x1964e6);break;case _0xb3ded4(0x237):if(typeof _0x1964e6!==_0xb3ded4(0x237))_0x1964e6=_0x1964e6==='true';break;}const _0x389fa3=_0x1d6382[_0xb3ded4(0x108)](),_0x620704=_0x216ece[_0xb3ded4(0x23a)]('.');let _0x492855=_0x389fa3;for(let _0x52173e=0x0;_0x52173e<_0x620704[_0xb3ded4(0x174)]-0x1;_0x52173e++){_0x492855=_0x492855[_0x620704[_0x52173e]]=_0x492855[_0x620704[_0x52173e]]||{};}_0x492855[_0x620704[_0x620704[_0xb3ded4(0x174)]-0x1]]=_0x1964e6;}),_0x1d6382['saveSettings'](),!_0x348d2d&&(log('【手动存档】所有设定已存档封印。',_0x5621d5(0x140)),toastr[_0x5621d5(0x140)](_0x5621d5(0xdd),_0x5621d5(0x1a9)));}function resetSettingsToUI(){const _0x362648=_0x30c5e9;confirm(_0x362648(0xd8))&&(_0x1d6382[_0x362648(0x219)](),loadSettingsToUI(),toastr['info'](_0x362648(0x203),'诏曰'));}async function updatePanelStatus(){const _0x5e0d2c=_0x30c5e9,_0x21b5df=_0x1d6382[_0x5e0d2c(0x23e)](),_0x496702=document[_0x5e0d2c(0x14b)](_0x5e0d2c(0xf1)),_0x4e63da=document['getElementById'](_0x5e0d2c(0x131));if(_0x21b5df){const _0x1450c9=_0x1d6382['getLockedSessionInfo']();_0x1450c9&&(_0x496702[_0x5e0d2c(0x24d)]=_0x5e0d2c(0xae),_0x4e63da[_0x5e0d2c(0x24d)]=_0x1450c9['id'],_0x4e63da[_0x5e0d2c(0x251)]=_0x5e0d2c(0x10a)+_0x1450c9['id'],_0x496702['classList']['add'](_0x5e0d2c(0x1e3)),_0x4e63da['classList'][_0x5e0d2c(0x152)](_0x5e0d2c(0x1e3)));}else _0x496702[_0x5e0d2c(0x24d)]=_0x7530ec[_0x5e0d2c(0xad)](),_0x4e63da[_0x5e0d2c(0x24d)]=_0x7530ec[_0x5e0d2c(0x1ed)]()||'无',_0x4e63da[_0x5e0d2c(0x251)]='',_0x496702[_0x5e0d2c(0x167)][_0x5e0d2c(0x160)](_0x5e0d2c(0x1e3)),_0x4e63da[_0x5e0d2c(0x167)][_0x5e0d2c(0x160)](_0x5e0d2c(0x1e3));const _0x30acdd=document[_0x5e0d2c(0x14b)](_0x5e0d2c(0x9d));_0x30acdd[_0x5e0d2c(0x24d)]='...';try{const _0x1e7248=await _0x1d6382[_0x5e0d2c(0x273)]();_0x30acdd[_0x5e0d2c(0x24d)]=_0x1e7248;}catch(_0x3cbdc2){console[_0x5e0d2c(0x277)](_0x5e0d2c(0xf4),_0x3cbdc2),_0x30acdd[_0x5e0d2c(0x24d)]=_0x5e0d2c(0x157),_0x30acdd[_0x5e0d2c(0x251)]=_0x5e0d2c(0x1df)+_0x3cbdc2[_0x5e0d2c(0x250)];}const _0x4efecd=document[_0x5e0d2c(0x14b)](_0x5e0d2c(0x13b));if(_0x4efecd&&!_0x4efecd[_0x5e0d2c(0x111)][_0x5e0d2c(0xd4)]){const _0x22e0b6=_0x1d6382[_0x5e0d2c(0x108)](),_0x57b4dc=await _0x1d6382[_0x5e0d2c(0x100)]();if(_0x22e0b6[_0x5e0d2c(0x27a)]&&_0x22e0b6[_0x5e0d2c(0x27a)][_0x57b4dc]){const _0x21bd92=_0x22e0b6[_0x5e0d2c(0x27a)][_0x57b4dc];_0x4efecd[_0x5e0d2c(0xff)]=_0x5e0d2c(0x1e0)+_0x21bd92[_0x5e0d2c(0xa1)]+_0x5e0d2c(0x19b)+_0x21bd92[_0x5e0d2c(0x288)]+_0x5e0d2c(0x1e6);}else _0x4efecd['innerHTML']=_0x5e0d2c(0x210);}renderKnowledgeBases();}async function moveAllKnowledgeBases(_0x22455b){const _0x33f157=_0x30c5e9,_0x1e395c=_0x22455b===_0x33f157(0x1ca),_0x116226=_0x1e395c?_0x33f157(0x220):_0x33f157(0x202),_0x1606f6=_0x1e395c?'局部':'全局',_0x3dc9be=_0x1e395c?_0x1d6382['getGlobalKnowledgeBases']():_0x1d6382[_0x33f157(0xba)](),_0x4d375d=Object['keys'](_0x3dc9be);if(_0x4d375d[_0x33f157(0x174)]===0x0){toastr[_0x33f157(0x185)](_0x33f157(0xce)+(_0x1e395c?'全局':'局部')+_0x33f157(0xc6),'圣谕');return;}if(!confirm(_0x33f157(0x16a)+_0x4d375d['length']+'\x20个知识库从【'+(_0x1e395c?'全局':'局部')+_0x33f157(0xe5)+_0x1606f6+_0x33f157(0x213)))return;log('开始将\x20'+_0x4d375d[_0x33f157(0x174)]+_0x33f157(0x118)+_0x116226+_0x33f157(0xf5)+(_0x1e395c?_0x33f157(0x202):_0x33f157(0x220))+_0x33f157(0x21d),_0x33f157(0x185));const _0x586501=_0x4d375d[_0x33f157(0x18d)](_0x966a14=>_0x1d6382[_0x33f157(0x14c)](_0x966a14,_0x116226));try{await Promise[_0x33f157(0x11f)](_0x586501),toastr[_0x33f157(0x140)]('所有\x20'+_0x4d375d[_0x33f157(0x174)]+_0x33f157(0x175),_0x33f157(0x260)),log(_0x33f157(0x20b),'success');}catch(_0x4098fd){toastr[_0x33f157(0x277)](_0x33f157(0x101)+_0x4098fd[_0x33f157(0x250)],'警报'),log(_0x33f157(0x227)+_0x4098fd[_0x33f157(0x250)],_0x33f157(0x277));}finally{await updatePanelStatus();}}async function deleteAllLocalKnowledgeBases(){const _0x498322=_0x30c5e9,_0x4470c4=_0x1d6382[_0x498322(0xba)](),_0x1373ae=Object[_0x498322(0xc8)](_0x4470c4);if(_0x1373ae[_0x498322(0x174)]===0x0){toastr[_0x498322(0x185)]('当前角色没有任何局部知识库可供删除。','圣谕');return;}if(!confirm(_0x498322(0x10b)+_0x1373ae[_0x498322(0x174)]+_0x498322(0x20c)))return;toastr['info']('正在删除\x20'+_0x1373ae[_0x498322(0x174)]+_0x498322(0xb6),'圣旨'),log(_0x498322(0x143)+_0x1373ae[_0x498322(0x174)]+_0x498322(0xb6),_0x498322(0x1b7));let _0x29b1b2=0x0,_0x59ef36=0x0;for(const _0x2ad48b of _0x1373ae){try{await _0x1d6382[_0x498322(0x170)](_0x2ad48b,_0x498322(0x202)),_0x29b1b2++;}catch(_0xb002ad){_0x59ef36++,log('删除局部知识库\x20'+_0x2ad48b+_0x498322(0x1b6)+_0xb002ad[_0x498322(0x250)],_0x498322(0x277));}}_0x59ef36>0x0?toastr[_0x498322(0x277)](_0x498322(0x1a1)+_0x59ef36+_0x498322(0x270),'警报'):toastr['success'](_0x498322(0x112)+_0x29b1b2+'\x20个局部知识库均已成功删除。',_0x498322(0x260)),log(_0x498322(0x193)+_0x29b1b2+_0x498322(0x26f)+_0x59ef36,_0x498322(0x185)),await updatePanelStatus();}async function renderKnowledgeBases(){const _0xb5923f=_0x30c5e9,_0x283e56=document['getElementById']('hly-kb-list-local'),_0x297f42=document['getElementById'](_0xb5923f(0x11d)),_0xb0e43f=document['getElementById'](_0xb5923f(0x148));if(!_0x283e56||!_0x297f42||!_0xb0e43f)return;_0xb0e43f[_0xb5923f(0x24d)]=_0x7530ec[_0xb5923f(0xad)]()||_0xb5923f(0x23b);try{const _0xffae2=_0x1d6382[_0xb5923f(0xba)](),_0x3e6791=_0x1d6382['getGlobalKnowledgeBases']();await _renderKbList(_0xffae2,_0x283e56,'local',_0xb5923f(0x135)),await _renderKbList(_0x3e6791,_0x297f42,_0xb5923f(0x220),_0xb5923f(0x169));}catch(_0x158095){console[_0xb5923f(0x277)](_0xb5923f(0x238),_0x158095),_0x283e56[_0xb5923f(0xff)]='
加载失败:\x20'+_0x158095[_0xb5923f(0x250)]+_0xb5923f(0x266),_0x297f42[_0xb5923f(0xff)]=_0xb5923f(0x145)+_0x158095[_0xb5923f(0x250)]+_0xb5923f(0x266);}}async function _renderKbList(_0x45ce1e,_0x4fef30,_0x4e3e03,_0x216863){const _0x6c1c33=_0x30c5e9,_0x1da59c=document['getElementById'](_0x216863);_0x4fef30[_0x6c1c33(0xff)]='',_0x4fef30[_0x6c1c33(0x283)](_0x1da59c);if(Object['keys'](_0x45ce1e)[_0x6c1c33(0x174)]===0x0){_0x1da59c[_0x6c1c33(0x109)][_0x6c1c33(0x1b0)]=_0x6c1c33(0xb4);return;}_0x1da59c[_0x6c1c33(0x109)][_0x6c1c33(0x1b0)]=_0x6c1c33(0x1be);for(const [_0x100b65,_0x1adddf]of Object[_0x6c1c33(0x1d0)](_0x45ce1e)){const _0x199652=document[_0x6c1c33(0x12e)](_0x6c1c33(0x11a));_0x199652[_0x6c1c33(0x1ab)]=_0x6c1c33(0x276),_0x199652[_0x6c1c33(0x111)]['kbId']=_0x100b65,_0x199652[_0x6c1c33(0x111)][_0x6c1c33(0x154)]=_0x4e3e03;const _0x3bd7f6=await _0x1d6382[_0x6c1c33(0x273)](_0x100b65,_0x4e3e03),_0x2aaeaa=_0x4e3e03===_0x6c1c33(0x202)?_0x6c1c33(0x11b):_0x6c1c33(0xa6);_0x199652[_0x6c1c33(0xff)]=_0x6c1c33(0x18b)+_0x100b65+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+_0x1adddf['name']+'\x20('+_0x3bd7f6+_0x6c1c33(0x1bb)+_0x2aaeaa+_0x6c1c33(0x231)+(_0x1adddf['enabled']?'checked':'')+_0x6c1c33(0x23c),_0x4fef30[_0x6c1c33(0x283)](_0x199652);}}async function handleKbAction(_0x5c7312){const _0x8266ae=_0x30c5e9,_0x336c40=_0x5c7312[_0x8266ae(0x17e)],_0xe3f6d5=_0x336c40[_0x8266ae(0x224)]('.hly-kb-list-item');if(!_0xe3f6d5)return;const _0x1b546c=_0xe3f6d5[_0x8266ae(0x111)]['kbId'],_0x4e05f0=_0xe3f6d5[_0x8266ae(0x111)][_0x8266ae(0x154)],_0x1945c1=_0xe3f6d5[_0x8266ae(0x242)](_0x8266ae(0x264))[_0x8266ae(0x24d)][_0x8266ae(0x23a)]('\x20(')[0x0];if(_0x336c40[_0x8266ae(0x167)][_0x8266ae(0x1c6)](_0x8266ae(0x265))){if(confirm(_0x8266ae(0x28a)+_0x1945c1+_0x8266ae(0x25a)))try{await _0x1d6382['removeKnowledgeBase'](_0x1b546c,_0x4e05f0),log(_0x8266ae(0xd3)+_0x1945c1+'\x20(ID:\x20'+_0x1b546c+')\x20已被删除',_0x8266ae(0x140)),toastr[_0x8266ae(0x140)]('知识库【'+_0x1945c1+'】已删除。'),await updatePanelStatus();}catch(_0x2adf76){log(_0x8266ae(0x151)+_0x1945c1+_0x8266ae(0x1b6)+_0x2adf76[_0x8266ae(0x250)],_0x8266ae(0x277)),toastr[_0x8266ae(0x277)]('删除失败:\x20'+_0x2adf76[_0x8266ae(0x250)]);}}if(_0x336c40[_0x8266ae(0x224)]('.hly-kb-move-btn')){const _0x51f0b7=_0x4e05f0===_0x8266ae(0x202)?'全局':'局部';if(confirm('您确定要将知识库【'+_0x1945c1+'】移动到【'+_0x51f0b7+_0x8266ae(0x213)))try{await _0x1d6382[_0x8266ae(0x14c)](_0x1b546c,_0x4e05f0),await updatePanelStatus();}catch(_0xb676bd){log(_0x8266ae(0x25d)+_0x1945c1+_0x8266ae(0x1b6)+_0xb676bd[_0x8266ae(0x250)],'error'),toastr[_0x8266ae(0x277)]('移动失败:\x20'+_0xb676bd[_0x8266ae(0x250)]);}}if(_0x336c40['classList'][_0x8266ae(0x1c6)](_0x8266ae(0x1a2))&&_0x5c7312['type']===_0x8266ae(0x1ff))try{await _0x1d6382[_0x8266ae(0x133)](_0x1b546c,_0x4e05f0),log(_0x8266ae(0xd3)+_0x1945c1+_0x8266ae(0x22d),_0x8266ae(0x140));}catch(_0x1b5558){log(_0x8266ae(0x10c)+_0x1945c1+'\x20状态失败:\x20'+_0x1b5558['message'],_0x8266ae(0x277)),toastr[_0x8266ae(0x277)](_0x8266ae(0x24c)+_0x1b5558[_0x8266ae(0x250)]),_0x336c40[_0x8266ae(0x28c)]=!_0x336c40[_0x8266ae(0x28c)];}_0x336c40[_0x8266ae(0x167)][_0x8266ae(0x1c6)](_0x8266ae(0x1f3))&&_0x5c7312[_0x8266ae(0xa7)]===_0x8266ae(0x1ff)&&updateBulkActionUI(_0x4e05f0);}function handleSelectAll(_0x20dfe4,_0x1ab805){const _0x3712a6=_0x30c5e9,_0x2a6228=_0x20dfe4[_0x3712a6(0x17e)][_0x3712a6(0x28c)],_0x1d7608=document[_0x3712a6(0x14b)](_0x3712a6(0x226)+_0x1ab805),_0x2cca16=_0x1d7608[_0x3712a6(0x1e1)](_0x3712a6(0x217));_0x2cca16[_0x3712a6(0x1e5)](_0x157554=>_0x157554[_0x3712a6(0x28c)]=_0x2a6228),updateBulkActionUI(_0x1ab805);}function _0x1d12(){const _0x3bd6ad=['所有\x20','-tab','1258467YGXQAA','','\x20楼到\x20','hly-kb-list-global','top_n','all','13350656IQWPbp','\x20个知识块。','\x20个条目进行批量编纂...','move','fas\x20fa-lock-open','[自动保存]\x20设置项\x20\x27','内容排除规则已保存。','embeddingModel','log-success','condensation','hly-api-key-group','fa-exclamation-triangle','injection_','成功加载\x20','createElement','\x20个知识库吗?此操作无法恢复!','files','hly-current-chat-id','hly-injection-source-selector','toggleKnowledgeBase','\x20个Rerank模型。','hly-kb-list-local-placeholder','收到手动录入请求,文本长度:\x20','layerStart','[翰林院-枢纽]\x20获取Rerank模型列表失败:','错误:\x20','您确定要将选中的\x20','hly-condensation-results','user','hly-tag-extraction-toggle','正在准备凝识...','清空宝库失败。','success','stringify','手动录入成功,新增\x20','开始批量删除\x20','tagExtractionEnabled','加载失败:\x20','warning','正在读取文件...','hly-local-kb-char-name','hly-delete-rule-btn','\x20条忆识。','getElementById','moveKnowledgeBase','\x20条消息,开始凝识...','chat','\x0a忆识总数:\x20','\x0a所用模型:\x20','删除知识库\x20','add','input[name=\x22hly-unified-injection-position\x22]:checked','kbScope','startHLYHistoriography','toLocaleTimeString','N/A','[翰林院-枢纽]\x20获取模型列表失败:','hly-kb-bulk-actions-','\x20个知识库移动到【','advanced','批量编纂任务已完成,但有部分错误。','确认并更新预览','fa-circle-info','clearJob','remove','preventDefault','#hly-rules-list','generateJobId','model','宝库状态','hly-kb-bulk-actions-local','classList','hanlinyuan-ingest-novel-start','hly-kb-list-global-placeholder','您确定要将\x20','\x20块继续录入。','%。是否从上次中断之处继续?','hly-kb-move-all-to-local','18oKeGBQ','\x20条有效条目),请点击“开始凝识”进入自动向量化流程。','removeKnowledgeBase','成功切换了\x20','novel','amily2_open_rag_palace','length','\x20个知识库均已成功移动。','label','处理中:\x20','{{text}}','hly-session-lock-btn','6106086MRzTLa','selectedIndex','hanlinyuan-ingest-novel-file-input','批量编纂任务已完成。','target','解锁会话','.position','totalSuccess','hly-kb-delete-local-btn','未选择文件','hly-kb-select-all-local','info','正在处理您确认后的文书...','圣旨已下','settingKey','insertAdjacentHTML','val','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20获取失败','tags','会话已解锁。','已选择\x20','操作完成,但有\x20','hly-kb-toggle','#hly-add-rule-btn','[data-setting-key]','hybrid_alpha','preview-item-','任务已由用户中止。进度已保存,可随时继续。','启禀大人,发现此书上次录入已完成\x20','圣旨已达','initialize','className','圣谕不明','beforeend','未检测到预览文本,按标准流程采集消息...','saveSettings','display','removeEventListener','value','\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-send-date=\x22','fetchHLYRerankModels','遵命,将从头开始录入此书。','\x20失败:\x20','warn','》获取条目列表...','notify','option','条)
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','检测到预览后待处理的消息对象,开始精确凝识...','startHLYCondensation','none','fa-check-circle','准备对《','testApiConnection','send_date','\x20个知识库的状态。','.hly-tab-pane','_searchHandler','contains','.depth_role','5042880kkccDg','stopPropagation','globalToLocal','local_proxy','log-warn','批量编纂任务已开始...','hly-tag-input','批量\x20','entries','hly-batch-size','正在为《','getAvailableWorldbooks','查看宝库状态成功:集合ID=',')\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
未找到模型','无法获取总数:\x20','
上次已从第\x20','querySelectorAll','totalVectors','hly-locked-status','data','forEach','\x20楼。
','已选择\x200\x20/\x20','》中的\x20','hly-kb-move-all-to-global','toggle','开始对《','hly-hist-select-library','getChatId','预览失败:\x20','hly-log-output','hly-tag-input-container','hly-rerank-notify','hly-match-threshold','hly-kb-item-checkbox','凝识完成!新增\x20','1024818dqKNDx','开始获取模型列表...','checkbox','fetchHLYEmbeddingModels','hly-kb-select-all-','scrollHeight',']\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
','localToGlobal','批量移动完成。','\x20个局部知识库吗?此操作无法恢复!','\x20个书库。','未找到匹配的条目','processCondensation','
可在此预览凝识结果。
','use\x20strict','点击以锁定,让翰林院固定操作当前角色的宝库','】吗?','查询宝库状态失败:\x20','hly-historiography-results','
','.hly-kb-item-checkbox','hly-unified-template-editor','resetSettings','is_user','[翰林院-枢纽]\x20凝识过程发生错误:','用户请求查看宝库状态。','...','processedChunks','例如\x20http://127.0.0.1:8000/v1','global','total','string','\x22\x20placeholder=\x22结束字符,\x20如\x20-->\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20','closest','{{chat_text}}','hly-kb-list-','批量移动失败:\x20','hly-api-endpoint','请先选择一个\x20.txt\x20文件','神力连接失败:\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
在这里定义需要从提取内容中排除的文本片段。例如,排除HTML注释,可以设置开始字符为\x20``。
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
','hly-retrieval-enabled','\x20的状态已切换','\x20楼已成功凝识,新增\x20','
','active','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
','.hly-exclusion-rule-row','kbId','executeCompilation','\x20操作...','boolean','[翰林院-枢纽]\x20渲染知识库列表失败:','翰林院启奏','split','当前角色','>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨!','isSessionLocked','编辑内容排除规则','layerEnd','[断点续传]\x20用户选择继续任务\x20','querySelector','7GrBZrx','getLoresForWorldbook','\x20个知识库\x20(范围:\x20','\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-is-user=\x22','[翰林院-枢纽]\x20编纂过程发生严重错误:','queryMessageCount','hly-manual-text','成功删除了\x20','hly-chunk-size','切换状态失败:\x20','textContent','retrieval','您确定要切换选中的\x20','message','title','join','hly-hist-entry-multiselect-options','getMessagesForCondensation','hly-hist-select-all-entries','会话已锁定到:\x20','flex','手动录入','录入内容不能为空。','】吗?此操作无法恢复!','testHLYApi','from','移动知识库\x20','filter','apiEndpoint','大功告成','点击以解锁,让翰林院跟随当前角色','.hly-preview-textarea','\x20/\x20','.hly-kb-name','hly-kb-delete-btn','
','trim','聊天记录从第\x20','hly-hist-entry-multiselect-btn','finalMessages','未知错误','hly-unified-template-notes','','.hly-kb-item-checkbox:checked',',\x20失败:\x20','\x20个知识库删除失败。','showHLYStats','hly-custom-api-url','getVectorCount','hly-kb-bulk-actions-global','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20')['join']('');showHtmlModal('预览并编辑凝识内容',''+_0x5ba3c3+_0x2b434f(0x22f),{'okText':_0x2b434f(0x15d),'onOk':_0x2b2941=>{const _0x3f398d=_0x2b434f,_0x16dc5a=[];_0x2b2941[_0x3f398d(0x278)](_0x3f398d(0xfb))[_0x3f398d(0xb8)](function(){const _0x3c257b=_0x3f398d,_0x4e47c5=$(this)['find'](_0x3c257b(0x262)),_0x174915=_0x4e47c5[_0x3c257b(0x18a)]();_0x174915[_0x3c257b(0x267)]()&&_0x16dc5a[_0x3c257b(0x286)]({'mes':_0x174915,'is_user':_0x4e47c5[_0x3c257b(0x1e4)]('is-user'),'send_date':_0x4e47c5['data']('send-date'),'floor':_0x4e47c5[_0x3c257b(0x1e4)](_0x3c257b(0x281))});}),_0x33bb9f['dataset'][_0x3f398d(0x26a)]=JSON[_0x3f398d(0x141)](_0x16dc5a);const _0x699e5=document[_0x3f398d(0x14b)](_0x3f398d(0x284))['value'],_0x564c56=document[_0x3f398d(0x14b)](_0x3f398d(0x103))[_0x3f398d(0x1b2)];_0x33bb9f[_0x3f398d(0x24d)]=_0x3f398d(0x1a0)+_0x699e5+_0x3f398d(0x11c)+_0x564c56+_0x3f398d(0xfa)+_0x16dc5a[_0x3f398d(0x174)]+_0x3f398d(0x16f),toastr[_0x3f398d(0x140)]('预览内容已更新,可随时开始凝识。',_0x3f398d(0x1a9));}}),$('.hly-preview-delete-btn-v2')['on'](_0x2b434f(0x10f),function(_0x57a89f){const _0x4e1a16=_0x2b434f;_0x57a89f[_0x4e1a16(0x161)]();const _0xdbd9e0=$(this)[_0x4e1a16(0x1e4)](_0x4e1a16(0x17e));$('#'+_0xdbd9e0)['remove']();});}catch(_0x4790d4){console[_0x2b434f(0x277)](_0x2b434f(0x1da),_0x4790d4),_0x33bb9f[_0x2b434f(0x24d)]=_0x2b434f(0x1ee)+_0x4790d4[_0x2b434f(0x250)],toastr[_0x2b434f(0x277)](_0x2b434f(0x1ee)+_0x4790d4['message'],_0x2b434f(0xfd));}}function log(_0x44fb5e,_0x3f9ef5=_0x30c5e9(0x185)){const _0x66ac17=_0x30c5e9,_0x1aa861=document['getElementById'](_0x66ac17(0x1ef));if(!_0x1aa861)return;const _0x2d506a=document[_0x66ac17(0x12e)]('p'),_0x4d998c=new Date()[_0x66ac17(0x156)]();let _0x5bce4a=_0x66ac17(0x15e),_0x42dfc8='log-info';switch(_0x3f9ef5){case _0x66ac17(0x140):_0x5bce4a=_0x66ac17(0x1bf),_0x42dfc8=_0x66ac17(0x128);break;case'error':_0x5bce4a='fa-times-circle',_0x42dfc8=_0x66ac17(0xca);break;case _0x66ac17(0x1b7):_0x5bce4a=_0x66ac17(0x12b),_0x42dfc8=_0x66ac17(0x1cc);break;}_0x2d506a[_0x66ac17(0x1ab)]=_0x66ac17(0xe0)+_0x42dfc8,_0x2d506a['innerHTML']=_0x66ac17(0x115)+_0x5bce4a+'\x22>\x20['+_0x4d998c+']\x20'+_0x44fb5e;const _0x443305=_0x1aa861[_0x66ac17(0x242)](_0x66ac17(0xa8));_0x443305&&_0x443305['remove'](),_0x1aa861[_0x66ac17(0x283)](_0x2d506a),_0x1aa861[_0x66ac17(0x1dd)]=_0x1aa861[_0x66ac17(0x1fa)];}async function ingestManualText(){const _0x584f9f=_0x30c5e9,_0x2dd2ec=document[_0x584f9f(0x14b)](_0x584f9f(0x249)),_0x54e180=_0x2dd2ec['value']['trim']();if(!_0x54e180){toastr[_0x584f9f(0x146)](_0x584f9f(0x259),'翰林院启奏'),log('用户尝试录入空文本。',_0x584f9f(0x1b7));return;}log(_0x584f9f(0x136)+_0x54e180['length'],_0x584f9f(0x185)),toastr[_0x584f9f(0x185)]('正在处理您提交的文书...','圣旨');try{const _0x19dac2=await _0x1d6382[_0x584f9f(0xa0)](_0x54e180,'manual',{'sourceName':_0x584f9f(0x258)});if(_0x19dac2[_0x584f9f(0x140)])toastr[_0x584f9f(0x140)]('文书已成功录入宝库,新增\x20'+_0x19dac2['count']+_0x584f9f(0x14a),_0x584f9f(0x260)),log(_0x584f9f(0x142)+_0x19dac2[_0x584f9f(0x1db)]+_0x584f9f(0x14a),'success'),_0x2dd2ec[_0x584f9f(0x1b2)]='';else throw new Error(_0x19dac2['error']||_0x584f9f(0x26b));}catch(_0x426bfd){console[_0x584f9f(0x277)]('[翰林院-枢纽]\x20手动录入过程发生错误:',_0x426bfd),toastr[_0x584f9f(0x277)]('文书录入失败:\x20'+_0x426bfd[_0x584f9f(0x250)],'严重错误'),log('手动录入失败:\x20'+_0x426bfd['message'],'error');}finally{await updatePanelStatus();}}
+const _0x2eed1f=_0x91bf;(function(_0x53e8fb,_0x57de97){const _0x4490c1=_0x91bf,_0x4c5056=_0x53e8fb();while(!![]){try{const _0x57bc76=parseInt(_0x4490c1(0x159))/0x1*(-parseInt(_0x4490c1(0x269))/0x2)+-parseInt(_0x4490c1(0x92))/0x3*(parseInt(_0x4490c1(0x1dd))/0x4)+parseInt(_0x4490c1(0x1c8))/0x5*(parseInt(_0x4490c1(0x247))/0x6)+parseInt(_0x4490c1(0x7e))/0x7+-parseInt(_0x4490c1(0x195))/0x8+-parseInt(_0x4490c1(0x26d))/0x9+-parseInt(_0x4490c1(0x25b))/0xa*(-parseInt(_0x4490c1(0x1a5))/0xb);if(_0x57bc76===_0x57de97)break;else _0x4c5056['push'](_0x4c5056['shift']());}catch(_0x2fc4d8){_0x4c5056['push'](_0x4c5056['shift']());}}}(_0x21f4,0x43cce));import{getContext}from'/scripts/extensions.js';import*as _0x222c37 from'../core/rag-processor.js';import*as _0x9d7bfc from'../core/historiographer.js';import*as _0x27cc29 from'../core/utils/context-utils.js';import*as _0x263e19 from'../core/ingestion-manager.js';import{showContentModal,showHtmlModal}from'./page-window.js';import{extractBlocksByTags,applyExclusionRules}from'../core/utils/rag-tag-extractor.js';import{filterWorldbooks,filterWorldbookEntries,highlightSearchMatch,debounce}from'../core/rag-processor.js';_0x2eed1f(0x17c);function setupGlobalEventHandlers(){const _0xdb1182=_0x2eed1f;window[_0xdb1182(0x104)]=()=>saveSettingsFromUI(![]),window[_0xdb1182(0x134)]=resetSettingsToUI,window[_0xdb1182(0x170)]=testApi,window[_0xdb1182(0x1f0)]=fetchHLYEmbeddingModels,window[_0xdb1182(0x8c)]=fetchHLYRerankModels,window[_0xdb1182(0x265)]=updatePanelStatus,window[_0xdb1182(0x20c)]=purgeStorage,window[_0xdb1182(0x112)]=startCondensation,window[_0xdb1182(0x194)]=previewCondensation,window[_0xdb1182(0x21a)]=ingestManualText,window[_0xdb1182(0x167)]=log,window[_0xdb1182(0x215)]=showStats,window[_0xdb1182(0x73)]=startHistoriography;}function updateAndSaveSetting(_0x1b367c,_0x16e83b){const _0x56f7ba=_0x2eed1f,_0x8e6d43=_0x222c37[_0x56f7ba(0x1f9)]();if(!_0x8e6d43)return;const _0x37d1ec=_0x1b367c[_0x56f7ba(0x7a)]('.');let _0x3f98cb=_0x8e6d43;for(let _0x3d87c3=0x0;_0x3d87c3<_0x37d1ec[_0x56f7ba(0x1a7)]-0x1;_0x3d87c3++){_0x3f98cb=_0x3f98cb[_0x37d1ec[_0x3d87c3]]=_0x3f98cb[_0x37d1ec[_0x3d87c3]]||{};}_0x3f98cb[_0x37d1ec[_0x37d1ec[_0x56f7ba(0x1a7)]-0x1]]=_0x16e83b,_0x222c37[_0x56f7ba(0x70)](),log(_0x56f7ba(0x225)+_0x1b367c+_0x56f7ba(0x126)+JSON[_0x56f7ba(0xbf)](_0x16e83b),_0x56f7ba(0x249));}function bindAutoSaveEvents(){const _0xcd32c3=_0x2eed1f,_0x49958a=document[_0xcd32c3(0x242)](_0xcd32c3(0x6b));if(!_0x49958a)return;_0x49958a['addEventListener'](_0xcd32c3(0x1ee),_0x32ed26=>{const _0x3f063c=_0xcd32c3,_0x8b449e=_0x32ed26[_0x3f063c(0x18a)],_0x3e4857=_0x8b449e[_0x3f063c(0x13c)]['settingKey'];if(!_0x3e4857)return;let _0x539310;const _0x103817=_0x8b449e[_0x3f063c(0x13c)][_0x3f063c(0x87)]||_0x3f063c(0xf1);if(_0x8b449e[_0x3f063c(0x87)]==='checkbox')_0x539310=_0x8b449e[_0x3f063c(0x13e)];else{if(_0x8b449e[_0x3f063c(0x87)]===_0x3f063c(0x11b)){if(_0x8b449e[_0x3f063c(0x13e)]){const _0x35e330=_0x49958a[_0x3f063c(0x25d)](_0x3f063c(0xe8)+_0x8b449e['name']+'\x22]'),_0x4b1902=Array[_0x3f063c(0xc0)](_0x35e330)['find'](_0x24de98=>_0x24de98['checked']);_0x539310=_0x4b1902[_0x3f063c(0x15e)];}else return;}else _0x539310=_0x8b449e['value'];}switch(_0x103817){case _0x3f063c(0x132):_0x539310=parseInt(_0x539310,0xa);break;case _0x3f063c(0x19d):_0x539310=parseFloat(_0x539310);break;case _0x3f063c(0x21f):typeof _0x539310!==_0x3f063c(0x21f)&&(_0x539310=_0x539310===_0x3f063c(0x163));break;}if(_0x8b449e[_0x3f063c(0x87)]===_0x3f063c(0x11b)&&!_0x8b449e[_0x3f063c(0x13e)])return;updateAndSaveSetting(_0x3e4857,_0x539310);});}export function bindHanlinyuanEvents(){const _0x59a90f=_0x2eed1f,_0x32ca7a=getContext();if(!_0x32ca7a){console[_0x59a90f(0xf4)]('[翰林院-枢纽]\x20未能获取SillyTavern上下文,绑定失败。');return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents(),bindTutorialEvents(),bindAutoSaveEvents(),bindSessionLockEvent(),initializeUnifiedInjectionEditor();if(_0x222c37['initialize'])_0x222c37[_0x59a90f(0x1c9)]();else{console[_0x59a90f(0xf4)](_0x59a90f(0x16a));return;}loadSettingsToUI(),loadWorldbookList(),log(_0x59a90f(0x17a),_0x59a90f(0x1a4));const _0x2a2d9d=document['getElementById'](_0x59a90f(0x1e6)),_0x4bffe6=document[_0x59a90f(0x242)]('hanlinyuan-ingest-novel-file-name'),_0x550855=document[_0x59a90f(0x242)]('hanlinyuan-ingest-novel-start'),_0x1610ac=document[_0x59a90f(0x242)](_0x59a90f(0xa4)),_0xb0e167=document[_0x59a90f(0x242)]('hanlinyuan-ingest-progress-container'),_0x30f0bb=document['getElementById'](_0x59a90f(0x7d)),_0x9136d7=document[_0x59a90f(0x242)]('hanlinyuan-ingest-status'),_0x1adcca=document[_0x59a90f(0x242)](_0x59a90f(0x106));let _0x1340b0=null,_0x16b666=null;_0x2a2d9d[_0x59a90f(0x1cd)](_0x59a90f(0x1ee),_0x488348=>{const _0x2e9fa2=_0x59a90f;_0x1340b0=_0x488348['target'][_0x2e9fa2(0x260)][0x0],_0x1340b0?(_0x4bffe6[_0x2e9fa2(0x153)]=_0x1340b0[_0x2e9fa2(0x113)],_0x4bffe6['title']=_0x1340b0[_0x2e9fa2(0x113)]):_0x4bffe6[_0x2e9fa2(0x153)]=_0x2e9fa2(0x89);}),_0x550855[_0x59a90f(0x1cd)]('click',async()=>{const _0x36f58a=_0x59a90f;if(!_0x1340b0){toastr[_0x36f58a(0x17d)]('请先选择一个\x20.txt\x20文件');return;}let _0x43a77b=0x0;const _0x154e1e=_0x263e19[_0x36f58a(0x173)](_0x1340b0),_0xf8ff23=_0x263e19[_0x36f58a(0x1d0)](_0x154e1e);if(_0xf8ff23){const _0x31fabe=(_0xf8ff23['processedChunks']/_0xf8ff23[_0x36f58a(0x22f)]*0x64)['toFixed'](0x1),_0x40b90f=confirm('启禀大人,发现此书上次录入已完成\x20'+_0x31fabe+_0x36f58a(0x14e));_0x40b90f?(_0x43a77b=_0xf8ff23[_0x36f58a(0x10b)],toastr['info'](_0x36f58a(0x145)+(_0x43a77b+0x1)+'\x20块继续录入。',_0x36f58a(0x23f)),log(_0x36f58a(0xe5)+_0x154e1e+_0x36f58a(0xa8)+_0x43a77b+_0x36f58a(0x230),_0x36f58a(0x1a4))):(_0x263e19[_0x36f58a(0xc1)](_0x154e1e),toastr[_0x36f58a(0x1a4)](_0x36f58a(0x216),_0x36f58a(0x23f)),log('[断点续传]\x20用户选择放弃旧任务\x20'+_0x154e1e+_0x36f58a(0x9e),_0x36f58a(0x205)));}_0x16b666=new AbortController();const _0x5f4fee=_0x16b666['signal'];_0x1adcca[_0x36f58a(0x191)][_0x36f58a(0x1e1)]=_0x36f58a(0xc7),_0xb0e167[_0x36f58a(0x191)]['display']=_0x36f58a(0x1a1),_0x9136d7['textContent']=_0x36f58a(0x12e),_0x30f0bb[_0x36f58a(0x15e)]=0x0;try{const _0x1ba543=await _0x1340b0['text'](),_0x395440=_0x4fd023=>{const _0x8735a4=_0x36f58a;_0x9136d7['textContent']=_0x8735a4(0x136)+_0x4fd023[_0x8735a4(0x13f)]+'\x20('+_0x4fd023[_0x8735a4(0xaf)]+'/'+_0x4fd023[_0x8735a4(0xbe)]+')',_0x30f0bb['value']=_0x4fd023['processed']/_0x4fd023[_0x8735a4(0xbe)]*0x64;},_0x56bae3=()=>{updatePanelStatus(),log('[实时刷新]\x20批次完成,忆识总数已更新。','info');},_0x34fc08=await _0x222c37['ingestTextToHanlinyuan'](_0x1ba543,_0x36f58a(0x1bc),{'sourceName':_0x1340b0['name']},_0x395440,_0x5f4fee,log,_0x56bae3,_0x154e1e,_0x43a77b);if(_0x34fc08[_0x36f58a(0x249)])toastr['success'](_0x36f58a(0xfc)+_0x34fc08[_0x36f58a(0x165)]+_0x36f58a(0x189)),_0x9136d7[_0x36f58a(0x153)]=_0x36f58a(0x97)+_0x34fc08[_0x36f58a(0x165)]+_0x36f58a(0x1e5),_0x30f0bb[_0x36f58a(0x15e)]=0x64,updatePanelStatus();else throw new Error(_0x34fc08['error']||_0x36f58a(0xc6));}catch(_0x52a0d5){_0x52a0d5['name']===_0x36f58a(0x21b)?(toastr[_0x36f58a(0x1a4)](_0x36f58a(0x7c)),_0x9136d7[_0x36f58a(0x153)]='任务已中止。'):(toastr['error'](_0x36f58a(0x141)+_0x52a0d5['message']+_0x36f58a(0x1ce)),_0x9136d7[_0x36f58a(0x153)]=_0x36f58a(0x188)+_0x52a0d5[_0x36f58a(0x13f)]);}finally{setTimeout(()=>{const _0xb1254b=_0x36f58a;_0x1adcca[_0xb1254b(0x191)][_0xb1254b(0x1e1)]=_0xb1254b(0x185),_0xb0e167['style'][_0xb1254b(0x1e1)]=_0xb1254b(0xc7),_0x2a2d9d[_0xb1254b(0x15e)]='',_0x1340b0=null,_0x4bffe6[_0xb1254b(0x153)]=_0xb1254b(0x89);},0xbb8);}}),_0x1610ac['addEventListener'](_0x59a90f(0x217),()=>{const _0x1a3f0a=_0x59a90f;_0x16b666&&_0x16b666[_0x1a3f0a(0x13b)]();});}function bindSessionLockEvent(){const _0xe8aae0=_0x2eed1f,_0x488ccd=document[_0xe8aae0(0x242)](_0xe8aae0(0x84));if(!_0x488ccd)return;_0x488ccd[_0xe8aae0(0x1cd)]('click',async()=>{const _0x37dcc3=_0xe8aae0,_0x12a74e=await _0x222c37[_0x37dcc3(0xc2)]();updateSessionLockUI(_0x12a74e);if(_0x12a74e){const _0xf397f6=_0x222c37[_0x37dcc3(0x152)]();_0xf397f6&&(toastr[_0x37dcc3(0x249)](_0x37dcc3(0x150)+_0xf397f6['id'],_0x37dcc3(0xa7)),log('会话已锁定到宝库:\x20'+_0xf397f6['id'],_0x37dcc3(0x249)));}else toastr['info'](_0x37dcc3(0x8d),'诏曰'),log(_0x37dcc3(0x183),_0x37dcc3(0x1a4));updatePanelStatus();}),updateSessionLockUI(_0x222c37[_0xe8aae0(0x250)]());}function updateSessionLockUI(_0x547abd){const _0x33342f=_0x2eed1f,_0x3b74fd=document[_0x33342f(0x242)](_0x33342f(0x84));if(!_0x3b74fd)return;const _0x294209=_0x3b74fd[_0x33342f(0x1dc)]('i'),_0x351c88=_0x3b74fd['querySelector'](_0x33342f(0x6d));_0x547abd?(_0x3b74fd[_0x33342f(0x22b)][_0x33342f(0xe7)]('active'),_0x294209[_0x33342f(0x229)]=_0x33342f(0x7f),_0x351c88[_0x33342f(0x153)]=_0x33342f(0x18e),_0x3b74fd['title']=_0x33342f(0x12a)):(_0x3b74fd[_0x33342f(0x22b)][_0x33342f(0x24c)](_0x33342f(0x10c)),_0x294209['className']=_0x33342f(0x266),_0x351c88[_0x33342f(0x153)]=_0x33342f(0xb4),_0x3b74fd['title']=_0x33342f(0xa6));}function bindPanelToggleEvents(){const _0x18b8b2=_0x2eed1f,_0x4318f0=document[_0x18b8b2(0x242)](_0x18b8b2(0xfa));if(_0x4318f0){}}function bindTutorialEvents(){const _0x48a130=_0x2eed1f,_0x589c87=document['getElementById'](_0x48a130(0x255));_0x589c87&&_0x589c87['addEventListener'](_0x48a130(0x217),()=>{const _0x1f1757=_0x48a130;showContentModal(_0x1f1757(0x26a),_0x1f1757(0x1be));});}function bindInternalUIEvents(){const _0x18096f=_0x2eed1f,_0x445cc2=document[_0x18096f(0x25d)](_0x18096f(0xa5));_0x445cc2['forEach'](_0x5db251=>{const _0xf1cdde=_0x18096f;_0x5db251[_0xf1cdde(0x1cd)]('click',()=>{const _0x15246a=_0xf1cdde,_0x4a5911=_0x5db251['dataset'][_0x15246a(0x16e)],_0x409543='hly-'+_0x4a5911+_0x15246a(0x227);document[_0x15246a(0x25d)]('.hly-tab-pane')[_0x15246a(0x1d2)](_0x4257ec=>{const _0x36ff74=_0x15246a;_0x4257ec[_0x36ff74(0x22b)][_0x36ff74(0x1a6)](_0x36ff74(0x10c),_0x4257ec['id']===_0x409543);}),_0x445cc2[_0x15246a(0x1d2)](_0x4d6c8f=>_0x4d6c8f[_0x15246a(0x22b)][_0x15246a(0x1a6)]('active',_0x4d6c8f===_0x5db251));});});const _0x1f81d1=document[_0x18096f(0x242)]('hly-api-endpoint');_0x1f81d1&&_0x1f81d1[_0x18096f(0x1cd)]('change',handleApiModeChange);const _0x4908fd=document[_0x18096f(0x242)](_0x18096f(0xeb)),_0x156dd5=document['getElementById']('hly-tag-input-container');_0x4908fd&&_0x156dd5&&_0x4908fd[_0x18096f(0x1cd)](_0x18096f(0x1ee),()=>{const _0x53a294=_0x18096f;_0x156dd5[_0x53a294(0x191)]['display']=_0x4908fd['checked']?'block':_0x53a294(0xc7);});const _0x174d36=document[_0x18096f(0x242)](_0x18096f(0x23b));_0x174d36&&_0x174d36[_0x18096f(0x1cd)](_0x18096f(0x1ee),handleWorldbookSelectionChange);const _0x2169a5=document[_0x18096f(0x242)]('hly-exclusion-rules-btn');_0x2169a5&&_0x2169a5[_0x18096f(0x1cd)]('click',showExclusionRulesModal);const _0x59cf21=document[_0x18096f(0x242)]('hly-hist-entry-multiselect-btn'),_0x73b81a=document[_0x18096f(0x242)](_0x18096f(0x1ef));_0x59cf21&&_0x73b81a&&(_0x59cf21['addEventListener'](_0x18096f(0x217),_0x76ea7b=>{const _0x4df355=_0x18096f;_0x76ea7b[_0x4df355(0x76)]();const _0x4ee04b=_0x73b81a[_0x4df355(0x191)]['display']===_0x4df355(0x1a1);_0x73b81a[_0x4df355(0x191)][_0x4df355(0x1e1)]=_0x4ee04b?'none':_0x4df355(0x1a1);}),_0x73b81a[_0x18096f(0x1cd)]('change',_0x184f6e=>{const _0x4f33c2=_0x18096f,_0x34c041=_0x184f6e[_0x4f33c2(0x18a)];if(_0x34c041[_0x4f33c2(0x87)]!==_0x4f33c2(0x1fc))return;const _0x1ecec7=_0x73b81a[_0x4f33c2(0x25d)](_0x4f33c2(0x231)),_0x2afb8c=document[_0x4f33c2(0x242)](_0x4f33c2(0x100));if(_0x34c041['id']===_0x4f33c2(0x100))_0x1ecec7[_0x4f33c2(0x1d2)](_0x138b3b=>_0x138b3b['checked']=_0x34c041['checked']);else{const _0x3d30f1=Array[_0x4f33c2(0xc0)](_0x1ecec7)['every'](_0x3198f4=>_0x3198f4[_0x4f33c2(0x13e)]);_0x2afb8c[_0x4f33c2(0x13e)]=_0x3d30f1;}const _0x10cecf=_0x73b81a[_0x4f33c2(0x25d)](_0x4f33c2(0x21e))['length'],_0x505e92=_0x1ecec7[_0x4f33c2(0x1a7)];_0x59cf21[_0x4f33c2(0x1dc)](_0x4f33c2(0x6d))['textContent']=_0x4f33c2(0x1ec)+_0x10cecf+'\x20/\x20'+_0x505e92+_0x4f33c2(0x15b);}),document['addEventListener']('click',_0x46231e=>{const _0x428f68=_0x18096f;!_0x59cf21[_0x428f68(0x26c)](_0x46231e['target'])&&!_0x73b81a[_0x428f68(0x26c)](_0x46231e[_0x428f68(0x18a)])&&(_0x73b81a[_0x428f68(0x191)][_0x428f68(0x1e1)]=_0x428f68(0xc7));}));const _0xf710ed=document['getElementById'](_0x18096f(0x124));_0xf710ed&&_0xf710ed['addEventListener']('click',deleteAllLocalKnowledgeBases);const _0x111206=document['getElementById'](_0x18096f(0x1ff));_0x111206&&_0x111206['addEventListener'](_0x18096f(0x217),()=>moveAllKnowledgeBases(_0x18096f(0x1c3)));const _0x3c038f=document['getElementById'](_0x18096f(0x1ad));_0x3c038f&&_0x3c038f['addEventListener'](_0x18096f(0x217),()=>moveAllKnowledgeBases(_0x18096f(0x224)));const _0x153405=[_0x18096f(0x12c),_0x18096f(0x22c)];_0x153405[_0x18096f(0x1d2)](_0x168654=>{const _0x2fe279=_0x18096f,_0x358ca5=document[_0x2fe279(0x242)](_0x168654);_0x358ca5&&(_0x358ca5[_0x2fe279(0x1cd)](_0x2fe279(0x217),handleKbAction),_0x358ca5[_0x2fe279(0x1cd)](_0x2fe279(0x1ee),handleKbAction));}),document['getElementById'](_0x18096f(0x223))[_0x18096f(0x1cd)](_0x18096f(0x1ee),_0x450273=>handleSelectAll(_0x450273,_0x18096f(0x118))),document[_0x18096f(0x242)]('hly-kb-select-all-local')['addEventListener'](_0x18096f(0x1ee),_0xcdaa76=>handleSelectAll(_0xcdaa76,_0x18096f(0x1eb))),document['getElementById'](_0x18096f(0x10a))['addEventListener']('click',_0x4be060=>handleBulkAction(_0x4be060,'global')),document[_0x18096f(0x242)](_0x18096f(0x204))[_0x18096f(0x1cd)]('click',_0x443b7b=>handleBulkAction(_0x443b7b,_0x18096f(0x1eb)));}function initializeUnifiedInjectionEditor(){const _0x10f115=_0x2eed1f,_0x228011=document['getElementById'](_0x10f115(0x1c4)),_0x2a5fc7=document[_0x10f115(0x242)]('hly-unified-template-editor'),_0xb43f10=document['getElementById'](_0x10f115(0x235)),_0x256826=document[_0x10f115(0x25d)](_0x10f115(0x23c)),_0x300e7a=document[_0x10f115(0x242)](_0x10f115(0x129)),_0x509a18=document[_0x10f115(0x242)]('hly-unified-injection-role');if(!_0x228011)return;const _0x16a74b={'novel':'{{novel_text}}','chat':_0x10f115(0xa9),'lorebook':'{{lorebook_text}}','manual':_0x10f115(0xa0)};function _0xc77ce4(){const _0x534afa=_0x10f115,_0x35cdf0=_0x228011[_0x534afa(0x15e)],_0xe88796=_0x222c37['getSettings'](),_0x1fb55d=_0xe88796['injection_'+_0x35cdf0]||{};_0x2a5fc7['value']=_0x1fb55d[_0x534afa(0x268)]||'',_0xb43f10[_0x534afa(0x153)]='以\x20'+(_0x16a74b[_0x35cdf0]||_0x534afa(0xb0))+_0x534afa(0x139);const _0x9b2890=_0x1fb55d[_0x534afa(0x117)]!==undefined?String(_0x1fb55d[_0x534afa(0x117)]):'2';_0x256826[_0x534afa(0x1d2)](_0x13105c=>_0x13105c[_0x534afa(0x13e)]=_0x13105c[_0x534afa(0x15e)]===_0x9b2890),_0x300e7a[_0x534afa(0x15e)]=_0x1fb55d[_0x534afa(0x1aa)]||0x0,_0x509a18['value']=_0x1fb55d[_0x534afa(0xde)]!==undefined?String(_0x1fb55d[_0x534afa(0xde)]):'0';const _0x3dfb3a=_0x9b2890==='1';_0x300e7a[_0x534afa(0xd5)]=!_0x3dfb3a,_0x509a18[_0x534afa(0xd5)]=!_0x3dfb3a;}function _0x5f3b6e(){const _0x1c5035=_0x10f115,_0x4429de=_0x228011[_0x1c5035(0x15e)];updateAndSaveSetting('injection_'+_0x4429de+'.template',_0x2a5fc7[_0x1c5035(0x15e)]);const _0x430985=document[_0x1c5035(0x1dc)]('input[name=\x22hly-unified-injection-position\x22]:checked');_0x430985&&updateAndSaveSetting(_0x1c5035(0xdb)+_0x4429de+_0x1c5035(0x251),parseInt(_0x430985[_0x1c5035(0x15e)],0xa)),updateAndSaveSetting(_0x1c5035(0xdb)+_0x4429de+'.depth',parseInt(_0x300e7a[_0x1c5035(0x15e)],0xa)),updateAndSaveSetting(_0x1c5035(0xdb)+_0x4429de+'.depth_role',parseInt(_0x509a18['value'],0xa));}_0x228011[_0x10f115(0x1cd)](_0x10f115(0x1ee),_0xc77ce4);const _0x1a20be=debounce(_0x5f3b6e,0x12c);_0x2a5fc7[_0x10f115(0x1cd)](_0x10f115(0x82),_0x1a20be),_0x300e7a['addEventListener'](_0x10f115(0x1ee),_0x5f3b6e),_0x509a18['addEventListener']('change',_0x5f3b6e),_0x256826[_0x10f115(0x1d2)](_0x596ce7=>_0x596ce7['addEventListener'](_0x10f115(0x1ee),()=>{const _0x5e5de9=_0x10f115;_0x5f3b6e();const _0x21639b=_0x596ce7[_0x5e5de9(0x15e)]==='1'&&_0x596ce7[_0x5e5de9(0x13e)];_0x300e7a[_0x5e5de9(0xd5)]=!_0x21639b,_0x509a18['disabled']=!_0x21639b;})),_0xc77ce4();}function handleApiModeChange(){const _0x32c35e=_0x2eed1f,_0x34362a=document[_0x32c35e(0x242)]('hly-api-endpoint')['value'],_0x159129=document[_0x32c35e(0x242)](_0x32c35e(0x74)),_0x3e9434=document[_0x32c35e(0x242)](_0x32c35e(0xd2)),_0xe3fb22=document[_0x32c35e(0x242)](_0x32c35e(0x81)),_0x2481c1=_0xe3fb22[_0x32c35e(0x218)];if(!_0x159129||!_0x3e9434)return;_0x159129['style'][_0x32c35e(0x1e1)]='block',_0x3e9434[_0x32c35e(0x191)]['display']=_0x32c35e(0x1a1);switch(_0x34362a){case'google_direct':_0x159129[_0x32c35e(0x191)][_0x32c35e(0x1e1)]='none',_0x3e9434[_0x32c35e(0x1dc)](_0x32c35e(0x1df))[_0x32c35e(0x153)]=_0x32c35e(0xe0),_0x3e9434[_0x32c35e(0x1dc)](_0x32c35e(0x82))[_0x32c35e(0x147)]='请输入您的Google\x20API\x20Key';break;case _0x32c35e(0x1bf):_0x159129['querySelector']('label')[_0x32c35e(0x153)]='本地代理地址:',_0x159129[_0x32c35e(0x1dc)](_0x32c35e(0x82))[_0x32c35e(0x147)]='例如\x20http://127.0.0.1:8000/v1',_0x3e9434['style'][_0x32c35e(0x1e1)]=_0x32c35e(0xc7);break;case'custom':default:_0x159129[_0x32c35e(0x1dc)](_0x32c35e(0x1df))['textContent']='自定义路径:',_0x159129[_0x32c35e(0x1dc)](_0x32c35e(0x82))['placeholder']=_0x32c35e(0xf5),_0x3e9434[_0x32c35e(0x1dc)](_0x32c35e(0x1df))[_0x32c35e(0x153)]='通行令牌\x20(API\x20Key):';break;}}function loadSettingsToUI(){const _0x219a09=_0x2eed1f,_0x419957=_0x222c37['getSettings']();if(!_0x419957)return;document[_0x219a09(0x242)](_0x219a09(0xb1))['checked']=_0x419957[_0x219a09(0x99)][_0x219a09(0x209)],document['getElementById'](_0x219a09(0x18c))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x99)][_0x219a09(0xec)],document[_0x219a09(0x242)](_0x219a09(0x264))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x99)][_0x219a09(0x240)],document[_0x219a09(0x242)](_0x219a09(0x149))['value']=_0x419957[_0x219a09(0x99)][_0x219a09(0x1f7)];const _0x347d8a=document[_0x219a09(0x242)](_0x219a09(0x81));if(_0x347d8a['options'][_0x219a09(0x1a7)]===0x0){const _0x46bbd6=_0x419957[_0x219a09(0x99)][_0x219a09(0xed)],_0x16a0ca=new Option(_0x46bbd6,_0x46bbd6,!![],!![]);_0x347d8a[_0x219a09(0xe7)](_0x16a0ca);}_0x347d8a['value']=_0x419957[_0x219a09(0x99)][_0x219a09(0xed)],document[_0x219a09(0x242)](_0x219a09(0xf6))[_0x219a09(0x13e)]=_0x419957[_0x219a09(0x99)][_0x219a09(0x199)],document[_0x219a09(0x242)](_0x219a09(0x19a))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x181)][_0x219a09(0x1b3)],document[_0x219a09(0x242)](_0x219a09(0x1d5))['value']=_0x419957['advanced'][_0x219a09(0x1cb)],document[_0x219a09(0x242)](_0x219a09(0x17b))[_0x219a09(0x15e)]=_0x419957['advanced'][_0x219a09(0x111)],document['getElementById']('hly-query-message-count')[_0x219a09(0x15e)]=_0x419957['advanced'][_0x219a09(0x78)],document[_0x219a09(0x242)](_0x219a09(0x11f))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x181)]['maxResults'],document[_0x219a09(0x242)](_0x219a09(0x109))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x99)]['batchSize'],handleApiModeChange(),document[_0x219a09(0x242)]('hly-condensation-enabled')['checked']=_0x419957['condensation']['enabled'],document[_0x219a09(0x242)](_0x219a09(0x198))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x221)][_0x219a09(0x25f)],document[_0x219a09(0x242)](_0x219a09(0x10e))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x221)][_0x219a09(0x14a)],document[_0x219a09(0x242)](_0x219a09(0x237))[_0x219a09(0x13e)]=_0x419957['condensation'][_0x219a09(0xa2)][_0x219a09(0x7b)],document[_0x219a09(0x242)]('hly-include-ai')[_0x219a09(0x13e)]=_0x419957[_0x219a09(0x221)][_0x219a09(0xa2)]['ai'];const _0x504881=document[_0x219a09(0x242)]('hly-tag-extraction-toggle'),_0x17c410=document[_0x219a09(0x242)](_0x219a09(0x12f)),_0x1a212c=document[_0x219a09(0x242)](_0x219a09(0x239));_0x504881[_0x219a09(0x13e)]=_0x419957['condensation'][_0x219a09(0x222)],_0x17c410[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x221)]['tags'],_0x1a212c['style']['display']=_0x504881[_0x219a09(0x13e)]?_0x219a09(0x1a1):_0x219a09(0xc7),document['getElementById'](_0x219a09(0x24e))[_0x219a09(0x13e)]=_0x419957['rerank'][_0x219a09(0x209)],document[_0x219a09(0x242)](_0x219a09(0xfd))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x18f)]['url'],document[_0x219a09(0x242)](_0x219a09(0x15f))[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x18f)][_0x219a09(0x1f7)];const _0x4bee8b=document[_0x219a09(0x242)]('hly-rerank-model');if(_0x4bee8b[_0x219a09(0x232)]['length']===0x0){const _0x58807f=_0x419957[_0x219a09(0x18f)]['model'];if(_0x58807f){const _0x3e1768=new Option(_0x58807f,_0x58807f,!![],!![]);_0x4bee8b[_0x219a09(0xe7)](_0x3e1768);}}_0x4bee8b[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x18f)]['model'],document[_0x219a09(0x242)]('hly-rerank-top-n')['value']=_0x419957[_0x219a09(0x18f)]['top_n'],document[_0x219a09(0x242)]('hly-rerank-hybrid-alpha')[_0x219a09(0x15e)]=_0x419957[_0x219a09(0x18f)][_0x219a09(0x12b)],document[_0x219a09(0x242)](_0x219a09(0x1a0))[_0x219a09(0x13e)]=_0x419957['rerank'][_0x219a09(0x199)],document['getElementById']('hly-super-sort-enabled')[_0x219a09(0x13e)]=_0x419957[_0x219a09(0x18f)]['superSortEnabled'];}function saveSettingsFromUI(_0x4b8aae=!![]){const _0x1fd7b9=_0x2eed1f,_0x5b0f6b=document[_0x1fd7b9(0x242)](_0x1fd7b9(0x6b));if(!_0x5b0f6b)return;const _0x49ebfc=_0x5b0f6b[_0x1fd7b9(0x25d)](_0x1fd7b9(0x1ba));_0x49ebfc['forEach'](_0x50b97b=>{const _0x36abf6=_0x1fd7b9,_0x427a39=_0x50b97b[_0x36abf6(0x13c)][_0x36abf6(0x193)];if(!_0x427a39)return;let _0x591493;const _0x505520=_0x50b97b[_0x36abf6(0x13c)]['type']||_0x36abf6(0xf1);if(_0x50b97b['type']==='checkbox')_0x591493=_0x50b97b[_0x36abf6(0x13e)];else{if(_0x50b97b[_0x36abf6(0x87)]==='radio'){if(!_0x50b97b['checked'])return;_0x591493=_0x50b97b['value'];}else _0x591493=_0x50b97b[_0x36abf6(0x15e)];}switch(_0x505520){case'integer':_0x591493=parseInt(_0x591493,0xa);break;case _0x36abf6(0x19d):_0x591493=parseFloat(_0x591493);break;case _0x36abf6(0x21f):if(typeof _0x591493!=='boolean')_0x591493=_0x591493===_0x36abf6(0x163);break;}const _0xb6fde7=_0x222c37[_0x36abf6(0x1f9)](),_0x56e00a=_0x427a39['split']('.');let _0x2c2428=_0xb6fde7;for(let _0xf2e9d=0x0;_0xf2e9d<_0x56e00a[_0x36abf6(0x1a7)]-0x1;_0xf2e9d++){_0x2c2428=_0x2c2428[_0x56e00a[_0xf2e9d]]=_0x2c2428[_0x56e00a[_0xf2e9d]]||{};}_0x2c2428[_0x56e00a[_0x56e00a[_0x36abf6(0x1a7)]-0x1]]=_0x591493;}),_0x222c37[_0x1fd7b9(0x70)](),!_0x4b8aae&&(log(_0x1fd7b9(0x1f1),_0x1fd7b9(0x249)),toastr[_0x1fd7b9(0x249)](_0x1fd7b9(0xb2),_0x1fd7b9(0x23f)));}function resetSettingsToUI(){const _0x43d5d1=_0x2eed1f;confirm(_0x43d5d1(0x176))&&(_0x222c37[_0x43d5d1(0x243)](),loadSettingsToUI(),toastr[_0x43d5d1(0x1a4)](_0x43d5d1(0x15c),'诏曰'));}async function updatePanelStatus(){const _0x2e3d7d=_0x2eed1f,_0x163d16=_0x222c37[_0x2e3d7d(0x250)](),_0x1060de=document[_0x2e3d7d(0x242)](_0x2e3d7d(0x1e2)),_0xe2e094=document[_0x2e3d7d(0x242)](_0x2e3d7d(0xcd));if(_0x163d16){const _0x22d101=_0x222c37['getLockedSessionInfo']();_0x22d101&&(_0x1060de[_0x2e3d7d(0x153)]=_0x2e3d7d(0x18b),_0xe2e094['textContent']=_0x22d101['id'],_0xe2e094[_0x2e3d7d(0x122)]='当前所有操作都将指向这个锁定的宝库:'+_0x22d101['id'],_0x1060de[_0x2e3d7d(0x22b)][_0x2e3d7d(0xe7)]('hly-locked-status'),_0xe2e094[_0x2e3d7d(0x22b)][_0x2e3d7d(0xe7)](_0x2e3d7d(0x101)));}else _0x1060de[_0x2e3d7d(0x153)]=_0x27cc29[_0x2e3d7d(0x107)](),_0xe2e094[_0x2e3d7d(0x153)]=_0x27cc29[_0x2e3d7d(0x13d)]()||'无',_0xe2e094[_0x2e3d7d(0x122)]='',_0x1060de['classList'][_0x2e3d7d(0x24c)]('hly-locked-status'),_0xe2e094[_0x2e3d7d(0x22b)]['remove'](_0x2e3d7d(0x101));const _0x285b3e=document[_0x2e3d7d(0x242)](_0x2e3d7d(0x71));_0x285b3e[_0x2e3d7d(0x153)]=_0x2e3d7d(0x1a9);try{const _0x257293=await _0x222c37['getVectorCount']();_0x285b3e[_0x2e3d7d(0x153)]=_0x257293;}catch(_0x59af74){console[_0x2e3d7d(0xf4)](_0x2e3d7d(0x1c5),_0x59af74),_0x285b3e[_0x2e3d7d(0x153)]=_0x2e3d7d(0x6f),_0x285b3e[_0x2e3d7d(0x122)]=_0x2e3d7d(0x102)+_0x59af74[_0x2e3d7d(0x13f)];}const _0x45eaba=document['getElementById'](_0x2e3d7d(0x1b7));if(_0x45eaba&&!_0x45eaba['dataset'][_0x2e3d7d(0xa1)]){const _0x3dbf6f=_0x222c37[_0x2e3d7d(0x1f9)](),_0x2981b4=await _0x222c37[_0x2e3d7d(0x154)]();if(_0x3dbf6f[_0x2e3d7d(0x186)]&&_0x3dbf6f[_0x2e3d7d(0x186)][_0x2981b4]){const _0x4c8035=_0x3dbf6f[_0x2e3d7d(0x186)][_0x2981b4];_0x45eaba[_0x2e3d7d(0x1d7)]='
上次已从第\x20'+_0x4c8035[_0x2e3d7d(0x207)]+_0x2e3d7d(0x1c0)+_0x4c8035[_0x2e3d7d(0x23d)]+'\x20楼。
';}else _0x45eaba[_0x2e3d7d(0x1d7)]='
可在此预览凝识结果。
';}renderKnowledgeBases();}async function moveAllKnowledgeBases(_0x4deef9){const _0x4bf2d8=_0x2eed1f,_0x165969=_0x4deef9===_0x4bf2d8(0x1c3),_0x1df23b=_0x165969?'global':_0x4bf2d8(0x1eb),_0x122e8f=_0x165969?'局部':'全局',_0x2dece0=_0x165969?_0x222c37[_0x4bf2d8(0x143)]():_0x222c37[_0x4bf2d8(0x67)](),_0x316b91=Object['keys'](_0x2dece0);if(_0x316b91[_0x4bf2d8(0x1a7)]===0x0){toastr['info'](_0x4bf2d8(0x1b0)+(_0x165969?'全局':'局部')+_0x4bf2d8(0x75),'圣谕');return;}if(!confirm(_0x4bf2d8(0x1db)+_0x316b91['length']+_0x4bf2d8(0x1d3)+(_0x165969?'全局':'局部')+_0x4bf2d8(0x16d)+_0x122e8f+'】吗?'))return;log(_0x4bf2d8(0x96)+_0x316b91[_0x4bf2d8(0x1a7)]+'\x20个知识库从\x20'+_0x1df23b+'\x20移动到\x20'+(_0x165969?_0x4bf2d8(0x1eb):_0x4bf2d8(0x118))+_0x4bf2d8(0x1a9),_0x4bf2d8(0x1a4));const _0x2e9695=_0x316b91[_0x4bf2d8(0x1d8)](_0x59e46d=>_0x222c37['moveKnowledgeBase'](_0x59e46d,_0x1df23b));try{await Promise[_0x4bf2d8(0x160)](_0x2e9695),toastr[_0x4bf2d8(0x249)]('所有\x20'+_0x316b91[_0x4bf2d8(0x1a7)]+'\x20个知识库均已成功移动。',_0x4bf2d8(0x130)),log(_0x4bf2d8(0xb5),_0x4bf2d8(0x249));}catch(_0x1b8978){toastr[_0x4bf2d8(0xf4)]('批量移动过程中发生错误:\x20'+_0x1b8978[_0x4bf2d8(0x13f)],'警报'),log(_0x4bf2d8(0x220)+_0x1b8978[_0x4bf2d8(0x13f)],_0x4bf2d8(0xf4));}finally{await updatePanelStatus();}}async function deleteAllLocalKnowledgeBases(){const _0x34a7c4=_0x2eed1f,_0x348c07=_0x222c37[_0x34a7c4(0x67)](),_0x105924=Object[_0x34a7c4(0x119)](_0x348c07);if(_0x105924['length']===0x0){toastr[_0x34a7c4(0x1a4)]('当前角色没有任何局部知识库可供删除。','圣谕');return;}if(!confirm(_0x34a7c4(0x22d)+_0x105924[_0x34a7c4(0x1a7)]+_0x34a7c4(0x25a)))return;toastr[_0x34a7c4(0x1a4)](_0x34a7c4(0x123)+_0x105924[_0x34a7c4(0x1a7)]+_0x34a7c4(0x22a),'圣旨'),log(_0x34a7c4(0x19f)+_0x105924[_0x34a7c4(0x1a7)]+_0x34a7c4(0x22a),'warn');let _0x7eb903=0x0,_0x4fdef2=0x0;for(const _0x1d8c0f of _0x105924){try{await _0x222c37['removeKnowledgeBase'](_0x1d8c0f,_0x34a7c4(0x1eb)),_0x7eb903++;}catch(_0xe81d50){_0x4fdef2++,log('删除局部知识库\x20'+_0x1d8c0f+'\x20失败:\x20'+_0xe81d50[_0x34a7c4(0x13f)],_0x34a7c4(0xf4));}}_0x4fdef2>0x0?toastr[_0x34a7c4(0xf4)](_0x34a7c4(0x15d)+_0x4fdef2+_0x34a7c4(0x1b1),'警报'):toastr['success'](_0x34a7c4(0x182)+_0x7eb903+'\x20个局部知识库均已成功删除。',_0x34a7c4(0x130)),log(_0x34a7c4(0x24f)+_0x7eb903+_0x34a7c4(0x8f)+_0x4fdef2,_0x34a7c4(0x1a4)),await updatePanelStatus();}async function renderKnowledgeBases(){const _0x182e3a=_0x2eed1f,_0x4c8fc1=document[_0x182e3a(0x242)](_0x182e3a(0x12c)),_0x41f18e=document[_0x182e3a(0x242)]('hly-kb-list-global'),_0x30da28=document[_0x182e3a(0x242)](_0x182e3a(0x19b));if(!_0x4c8fc1||!_0x41f18e||!_0x30da28)return;_0x30da28['textContent']=_0x27cc29[_0x182e3a(0x107)]()||_0x182e3a(0x151);try{const _0x477031=_0x222c37['getLocalKnowledgeBases'](),_0x26fb83=_0x222c37['getGlobalKnowledgeBases']();await _renderKbList(_0x477031,_0x4c8fc1,'local','hly-kb-list-local-placeholder'),await _renderKbList(_0x26fb83,_0x41f18e,'global',_0x182e3a(0xb7));}catch(_0x725202){console[_0x182e3a(0xf4)](_0x182e3a(0x108),_0x725202),_0x4c8fc1[_0x182e3a(0x1d7)]=_0x182e3a(0x258)+_0x725202[_0x182e3a(0x13f)]+_0x182e3a(0x125),_0x41f18e[_0x182e3a(0x1d7)]='
加载失败:\x20'+_0x725202[_0x182e3a(0x13f)]+_0x182e3a(0x125);}}async function _renderKbList(_0x4e03a9,_0x455848,_0xa770f2,_0x330db6){const _0x28cc2b=_0x2eed1f,_0x289a67=document[_0x28cc2b(0x242)](_0x330db6);_0x455848[_0x28cc2b(0x1d7)]='',_0x455848[_0x28cc2b(0x200)](_0x289a67);if(Object['keys'](_0x4e03a9)[_0x28cc2b(0x1a7)]===0x0){_0x289a67[_0x28cc2b(0x191)][_0x28cc2b(0x1e1)]=_0x28cc2b(0x1a1);return;}_0x289a67['style'][_0x28cc2b(0x1e1)]='none';for(const [_0x6fb85d,_0x19a1d7]of Object[_0x28cc2b(0xbd)](_0x4e03a9)){const _0x19bb62=document[_0x28cc2b(0x80)](_0x28cc2b(0xdf));_0x19bb62[_0x28cc2b(0x229)]='hly-kb-list-item',_0x19bb62[_0x28cc2b(0x13c)][_0x28cc2b(0x1b5)]=_0x6fb85d,_0x19bb62[_0x28cc2b(0x13c)][_0x28cc2b(0x1b6)]=_0xa770f2;const _0x229f47=await _0x222c37[_0x28cc2b(0xb8)](_0x6fb85d,_0xa770f2),_0x3f9f04=_0xa770f2===_0x28cc2b(0x1eb)?_0x28cc2b(0x1c1):_0x28cc2b(0xf0);_0x19bb62[_0x28cc2b(0x1d7)]=_0x28cc2b(0x17f)+_0x6fb85d+_0x28cc2b(0x1e9)+_0x6fb85d+'\x22>'+_0x19a1d7[_0x28cc2b(0x113)]+'\x20('+_0x229f47+_0x28cc2b(0x131)+_0x3f9f04+_0x28cc2b(0x69)+(_0x19a1d7['enabled']?_0x28cc2b(0x13e):'')+'>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20×\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20',_0x455848[_0x28cc2b(0x200)](_0x19bb62);}}async function handleKbAction(_0x25e2e9){const _0x41b462=_0x2eed1f,_0x16a086=_0x25e2e9[_0x41b462(0x18a)],_0x2e776d=_0x16a086[_0x41b462(0x10f)](_0x41b462(0xe4));if(!_0x2e776d)return;const _0x385851=_0x2e776d[_0x41b462(0x13c)][_0x41b462(0x1b5)],_0x181dc4=_0x2e776d['dataset']['kbScope'],_0x5d13a4=_0x2e776d['querySelector'](_0x41b462(0x202))['textContent'][_0x41b462(0x7a)]('\x20(')[0x0];if(_0x16a086[_0x41b462(0x22b)]['contains'](_0x41b462(0x253))){if(confirm('您确定要永久删除知识库【'+_0x5d13a4+_0x41b462(0x179)))try{await _0x222c37['removeKnowledgeBase'](_0x385851,_0x181dc4),log(_0x41b462(0x201)+_0x5d13a4+_0x41b462(0x262)+_0x385851+_0x41b462(0x234),_0x41b462(0x249)),toastr[_0x41b462(0x249)](_0x41b462(0xee)+_0x5d13a4+_0x41b462(0x19e)),await updatePanelStatus();}catch(_0x4f1b2d){log('删除知识库\x20'+_0x5d13a4+_0x41b462(0xe6)+_0x4f1b2d[_0x41b462(0x13f)],_0x41b462(0xf4)),toastr['error'](_0x41b462(0x252)+_0x4f1b2d[_0x41b462(0x13f)]);}}if(_0x16a086[_0x41b462(0x10f)](_0x41b462(0xc4))){const _0x1b15ac=_0x181dc4===_0x41b462(0x1eb)?'全局':'局部';if(confirm(_0x41b462(0x133)+_0x5d13a4+_0x41b462(0x16d)+_0x1b15ac+_0x41b462(0x197)))try{await _0x222c37['moveKnowledgeBase'](_0x385851,_0x181dc4),await updatePanelStatus();}catch(_0xe81869){log(_0x41b462(0xe9)+_0x5d13a4+_0x41b462(0xe6)+_0xe81869[_0x41b462(0x13f)],'error'),toastr[_0x41b462(0xf4)](_0x41b462(0x178)+_0xe81869[_0x41b462(0x13f)]);}}if(_0x16a086[_0x41b462(0x22b)][_0x41b462(0x26c)](_0x41b462(0x98))&&_0x25e2e9[_0x41b462(0x87)]===_0x41b462(0x1ee))try{await _0x222c37[_0x41b462(0xf3)](_0x385851,_0x181dc4),log(_0x41b462(0x201)+_0x5d13a4+_0x41b462(0x212),_0x41b462(0x249));}catch(_0x1f1695){log(_0x41b462(0x226)+_0x5d13a4+_0x41b462(0xc3)+_0x1f1695[_0x41b462(0x13f)],_0x41b462(0xf4)),toastr['error'](_0x41b462(0xbb)+_0x1f1695[_0x41b462(0x13f)]),_0x16a086[_0x41b462(0x13e)]=!_0x16a086[_0x41b462(0x13e)];}_0x16a086[_0x41b462(0x22b)]['contains'](_0x41b462(0xa3))&&_0x25e2e9[_0x41b462(0x87)]===_0x41b462(0x1ee)&&updateBulkActionUI(_0x181dc4);}function handleSelectAll(_0x1fe508,_0x4d1c0c){const _0x2ff17f=_0x2eed1f,_0x296d34=_0x1fe508[_0x2ff17f(0x18a)][_0x2ff17f(0x13e)],_0x1a5fc5=document[_0x2ff17f(0x242)](_0x2ff17f(0x95)+_0x4d1c0c),_0x539cca=_0x1a5fc5['querySelectorAll'](_0x2ff17f(0x24a));_0x539cca[_0x2ff17f(0x1d2)](_0x4eefdc=>_0x4eefdc[_0x2ff17f(0x13e)]=_0x296d34),updateBulkActionUI(_0x4d1c0c);}function _0x21f4(){const _0x4bd65b=['会话已解锁,将跟随当前角色。','\x22>\x20[',',\x20失败:\x20','condensation.exclusionRules','\x20条忆识。','93DFBTzE','您确定要永久删除选中的\x20','未找到符合条件的消息。','hly-kb-list-','开始将\x20','任务完成!成功录入\x20','hly-kb-toggle','retrieval','hly-historiography-results','成功获取\x20',',\x20向量:\x20','正在处理您提交的文书...',',重新开始。','\x20楼到第\x20','{{manual_text}}','finalText','messageTypes','hly-kb-item-checkbox','hanlinyuan-ingest-abort','.hly-nav-item','点击以锁定,让翰林院固定操作当前角色的宝库','圣旨已下',',从第\x20','{{chat_text}}','批量编纂任务已完成,但有部分错误。','[翰林院-枢纽]\x20预览过程发生错误:','.hly-preview-textarea','delete','send-date','processed','{{text}}','hly-retrieval-enabled','翰林院设定已存档封印。','[翰林院-枢纽]\x20加载书库列表失败:','锁定会话','批量移动完成。','finalMessages','hly-kb-list-global-placeholder','getVectorCount','is_user','此书库为空','切换状态失败:\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a翰林院宝库状态\x0a--------------------\x0a集合ID:\x20','\x20个书库。','神力连接失败:\x20','.hly-kb-list-item','[断点续传]\x20用户选择继续任务\x20','\x20失败:\x20','add','input[name=\x22','移动知识库\x20','凝识失败:\x20','hly-tag-extraction-toggle','apiEndpoint','embeddingModel','知识库【','\x0a\x20\x20\x20\x20\x20\x20\x20\x20
','string','根据标签提取或内容排除条件,未找到任何有效内容。','toggleKnowledgeBase','error','输入兼容OpenAI的embeddings端点','hly-retrieval-notify','\x22\x20placeholder=\x22结束字符,\x20如\x20-->\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20×\x0a\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20','已采集\x20','正在对\x20','amily2_open_rag_palace','hly-log-output','成功录入\x20','hly-rerank-url','收到手动录入请求,文本长度:\x20','开始对《','hly-hist-select-all-entries','hly-locked-status','无法获取总数:\x20','.hly-log-placeholder','saveHLYSettings','.hly-preview-item-v2','hanlinyuan-ingest-novel-controls','getCharacterName','[翰林院-枢纽]\x20渲染知识库列表失败:','hly-batch-size','hly-kb-bulk-actions-global','processedChunks','active','[翰林院-枢纽]\x20凝识过程发生错误:','hly-layer-end','closest','toLocaleTimeString','matchThreshold','startHLYCondensation','name','[翰林院-枢纽]\x20查询宝库状态失败:','
','用户尝试录入空文本。','position','global','keys','getAvailableWorldbooks','radio','查询宝库状态失败:\x20','\x20个知识库\x20(范围:\x20','请先选择一个书库并至少选择一个要编纂的条目。','hly-max-results','未能获取到任何Rerank模型。','文书已成功录入宝库,新增\x20','title','正在删除\x20','hly-kb-delete-local-btn','','\x27\x20已更新为:\x20','join','严重错误','hly-unified-injection-depth','点击以解锁,让翰林院跟随当前角色','hybrid_alpha','hly-kb-list-local','》的条目失败:','正在读取文件...','hly-tag-input','大功告成','条)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','integer','您确定要将知识库【','resetHLYSettings','\x20个模型。','处理中:\x20','加载失败','insertAdjacentHTML','\x20为占位符。','正在清空宝库...','abort','dataset','getChatId','checked','message','testApiConnection','录入失败:\x20','\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20','getGlobalKnowledgeBases','indeterminate','遵命,将从第\x20','hly-include-ai','placeholder','预览失败:\x20','hly-api-key','layerEnd','
未找到匹配的条目
','_searchHandler',')\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
到\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
未找到模型','flex','condensationHistory','\x20个知识库执行批量操作...','错误:\x20','\x20个知识块','target','会话已锁定','hly-api-endpoint','聊天记录从第\x20','解锁会话','rerank','成功删除了\x20','style','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
','
','globalToLocal','hly-injection-source-selector','[翰林院-枢纽]\x20更新忆识数量失败:','文书录入失败:\x20','scrollTop','20rhwboa','initialize','.hly-preview-delete-btn-v2','overlap','正在查询宝库状态...','addEventListener','。进度已保存,可稍后重试。','hly-manual-text','loadProgress','宝库已清空。','forEach','\x20个知识库从【','data','hly-overlap-size','\x20楼到\x20','innerHTML','map','检测到预览后待处理的消息对象,开始精确凝识...','mes','您确定要将\x20','querySelector','51260keGLnO','allWorldbooks','label','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
','hly-tag-input-container','action','hly-hist-select-library','input[name=\x22hly-unified-injection-position\x22]','end','.hly-kb-item-checkbox:checked','圣旨已达','customApiUrl','获取模型失败:\x20','getElementById','resetSettings','正在为《','\x0a\x20\x20\x20\x20\x20\x20\x20\x20','请至少选择一个知识库进行操作。','710916wDCmXY','manual','success','.hly-kb-item-checkbox','您确定要切换选中的\x20','remove','预览并编辑凝识内容','hly-rerank-enabled','局部知识库批量删除完成。成功:\x20','isSessionLocked','.position','删除失败:\x20','hly-kb-delete-btn','录入内容不能为空。','amily2_open_hanlin_tutorial','[翰林院-枢纽]\x20编纂过程发生严重错误:','\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20加载失败:\x20','准备对《','\x20个局部知识库吗?此操作无法恢复!','94630JLPCaS','正在准备凝识...','querySelectorAll','根据当前勾选条件,未找到符合的消息可供预览。','layerStart','files','确认并更新预览','\x20(ID:\x20','','hly-custom-api-url','updateHLYMemoryCount','fas\x20fa-lock-open','\x20个Rerank模型。','template','2PKrxSz','翰林院使用教程','》中的\x20','contains','2211930rMuWdG','批量\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
在这里定义需要从提取内容中排除的文本片段。例如,排除HTML注释,可以设置开始字符为\x20``。
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
','getLocalKnowledgeBases','fetchRerankModels','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20';_0x24f846['insertAdjacentHTML'](_0x39f282(0x1e4),_0x27e4fd);}),_0x16c3c8[_0x492392(0x1dc)](_0x492392(0x6d))[_0x492392(0x153)]=_0x492392(0x156)+_0x64b7b5[_0x492392(0x1a7)]+_0x492392(0x15b);}async function startHistoriography(){const _0x3b0ecd=_0x2eed1f,_0x169685=document['getElementById'](_0x3b0ecd(0x23b))[_0x3b0ecd(0x15e)],_0x477509=document[_0x3b0ecd(0x242)](_0x3b0ecd(0x1ef)),_0x4c448d=document[_0x3b0ecd(0x242)](_0x3b0ecd(0x9a)),_0x22ce66=Array[_0x3b0ecd(0xc0)](_0x477509[_0x3b0ecd(0x25d)](_0x3b0ecd(0x21e)))[_0x3b0ecd(0x1d8)](_0x528e31=>_0x528e31[_0x3b0ecd(0x15e)]);if(!_0x169685||_0x22ce66['length']===0x0){toastr[_0x3b0ecd(0x17d)](_0x3b0ecd(0x11e),_0x3b0ecd(0x20a));return;}_0x4c448d[_0x3b0ecd(0x153)]=_0x3b0ecd(0x259)+_0x169685+_0x3b0ecd(0x26b)+_0x22ce66[_0x3b0ecd(0x1a7)]+'\x20个条目进行批量编纂...',toastr[_0x3b0ecd(0x1a4)](_0x3b0ecd(0x157),'圣旨'),log(_0x3b0ecd(0xff)+_0x169685+_0x3b0ecd(0x26b)+_0x22ce66[_0x3b0ecd(0x1a7)]+_0x3b0ecd(0x72),_0x3b0ecd(0x1a4));try{const _0x22261c=await _0x9d7bfc[_0x3b0ecd(0x1a3)](_0x169685,_0x22ce66);_0x4c448d[_0x3b0ecd(0x153)]=_0x22261c[_0x3b0ecd(0x233)],_0x22261c[_0x3b0ecd(0x249)]?toastr[_0x3b0ecd(0x249)](_0x3b0ecd(0x158),_0x3b0ecd(0x130)):toastr[_0x3b0ecd(0x17d)](_0x3b0ecd(0xaa),'圣谕'),log('对《'+_0x169685+_0x3b0ecd(0x21c)+_0x22261c[_0x3b0ecd(0x1f2)]+_0x3b0ecd(0x9c)+_0x22261c[_0x3b0ecd(0x1e8)],_0x3b0ecd(0x249));}catch(_0x4b1a9c){console[_0x3b0ecd(0xf4)](_0x3b0ecd(0x256),_0x4b1a9c),toastr[_0x3b0ecd(0xf4)](_0x3b0ecd(0xc5)+_0x4b1a9c[_0x3b0ecd(0x13f)],_0x3b0ecd(0x128)),_0x4c448d[_0x3b0ecd(0x153)]='编纂失败:\x20'+_0x4b1a9c[_0x3b0ecd(0x13f)];}finally{await updatePanelStatus();}}async function showStats(){const _0x337841=_0x2eed1f;try{log(_0x337841(0x77),_0x337841(0x1a4)),toastr[_0x337841(0x1a4)](_0x337841(0x1cc),'圣旨');const _0x116826=await _0x222c37[_0x337841(0xb8)](),_0x157490=await _0x222c37[_0x337841(0x154)](),_0x1eb939=_0x222c37[_0x337841(0x1f9)](),_0x328420=_0x337841(0xe1)+_0x157490+_0x337841(0x175)+_0x116826+'\x0a--------------------\x0aAPI端点:\x20'+_0x1eb939[_0x337841(0x99)][_0x337841(0xec)]+'\x0a所用模型:\x20'+_0x1eb939['retrieval']['embeddingModel']+_0x337841(0x142);toastr[_0x337841(0x1a4)](_0x328420,_0x337841(0x1b4),{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log(_0x337841(0x166)+_0x157490+_0x337841(0x1e7)+_0x116826,_0x337841(0x249));}catch(_0x34738c){console['error'](_0x337841(0x114),_0x34738c),toastr[_0x337841(0xf4)](_0x337841(0x11c)+_0x34738c['message'],_0x337841(0x128)),log('查询宝库状态失败:\x20'+_0x34738c['message'],_0x337841(0xf4));}}function showExclusionRulesModal(){const _0x32ab6d=_0x2eed1f,_0x5e723f=_0x222c37[_0x32ab6d(0x1f9)](),_0x14b57c=_0x5e723f['condensation'][_0x32ab6d(0x1b2)]||[],_0x1c6bf7=(_0x1ddd98={'start':'','end':''},_0x296d64)=>_0x32ab6d(0xef)+_0x296d64+_0x32ab6d(0x257)+_0x1ddd98[_0x32ab6d(0x207)]+_0x32ab6d(0x171)+_0x1ddd98['end']+_0x32ab6d(0xf7),_0x44e1db=_0x14b57c['map'](_0x1c6bf7)[_0x32ab6d(0x127)](''),_0x1f94a1=_0x32ab6d(0x26f)+_0x44e1db+'
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20添加新规则\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20';showHtmlModal(_0x32ab6d(0x172),_0x1f94a1,{'okText':'保存规则','onOk':_0xdb5aa9=>{const _0x493885=_0x32ab6d,_0x26ae04=[];_0xdb5aa9[_0x493885(0xcf)](_0x493885(0x85))[_0x493885(0xcb)](function(){const _0x3f33df=_0x493885,_0x29755d=$(this)[_0x3f33df(0xcf)](_0x3f33df(0x82))['eq'](0x0)[_0x3f33df(0xd3)]()[_0x3f33df(0x155)](),_0x37503d=$(this)[_0x3f33df(0xcf)](_0x3f33df(0x82))['eq'](0x1)[_0x3f33df(0xd3)]()[_0x3f33df(0x155)]();_0x29755d&&_0x37503d&&_0x26ae04[_0x3f33df(0x1af)]({'start':_0x29755d,'end':_0x37503d});}),updateAndSaveSetting(_0x493885(0x90),_0x26ae04),toastr[_0x493885(0x249)](_0x493885(0xd8),'圣旨已达');}});const _0x1e4bad=document[_0x32ab6d(0x242)]('hly-exclusion-rules-container'),_0x9890d4=_0x1e4bad[_0x32ab6d(0x1dc)](_0x32ab6d(0x1fb));_0x1e4bad[_0x32ab6d(0x1dc)]('#hly-add-rule-btn')[_0x32ab6d(0x1cd)](_0x32ab6d(0x217),()=>{const _0x5ca979=_0x32ab6d,_0x480e4c=_0x9890d4[_0x5ca979(0x20f)][_0x5ca979(0x1a7)],_0x52221b=_0x1c6bf7({'start':'','end':''},_0x480e4c);_0x9890d4['insertAdjacentHTML'](_0x5ca979(0x1e4),_0x52221b);}),_0x9890d4['addEventListener'](_0x32ab6d(0x217),_0x51a1b7=>{const _0x28f04f=_0x32ab6d;_0x51a1b7[_0x28f04f(0x18a)][_0x28f04f(0x22b)][_0x28f04f(0x26c)](_0x28f04f(0x1f5))&&_0x51a1b7['target'][_0x28f04f(0x10f)](_0x28f04f(0x85))['remove']();});}function previewCondensation(){const _0x207657=_0x2eed1f,_0x4d4764=document['getElementById']('hly-condensation-results');try{const _0x5b6603=_0x222c37[_0x207657(0x1f9)](),_0x1a9c66=_0x5b6603[_0x207657(0x221)][_0x207657(0x1b2)]||[],_0x25529f={'user':document[_0x207657(0x242)](_0x207657(0x237))[_0x207657(0x13e)],'ai':document['getElementById'](_0x207657(0x146))[_0x207657(0x13e)]},_0x4b335a=document[_0x207657(0x242)](_0x207657(0xeb))[_0x207657(0x13e)],_0x1cb4ab=_0x4b335a?document[_0x207657(0x242)](_0x207657(0x12f))[_0x207657(0x15e)][_0x207657(0x7a)](',')[_0x207657(0x1d8)](_0x47820b=>_0x47820b[_0x207657(0x155)]())[_0x207657(0x161)](Boolean):[],_0x5e613d=_0x222c37[_0x207657(0xd9)](_0x25529f);if(!_0x5e613d||_0x5e613d[_0x207657(0x1a7)]===0x0){_0x4d4764[_0x207657(0x153)]=_0x207657(0x25e),toastr[_0x207657(0x17d)](_0x207657(0x94),'翰林院启奏');return;}const _0x5dca39=getContext()[_0x207657(0x228)],_0x39f938=_0x5e613d[_0x207657(0x1d8)]((_0x16b342,_0x3da0c8)=>{const _0x27c412=_0x207657;let _0x41cf85;if(_0x16b342[_0x27c412(0xb9)])_0x41cf85=_0x16b342[_0x27c412(0x1da)];else{if(_0x4b335a&&_0x1cb4ab[_0x27c412(0x1a7)]>0x0){const _0x36797b=extractBlocksByTags(_0x16b342['mes'],_0x1cb4ab);_0x41cf85=_0x36797b['join']('\x0a\x0a');}else _0x41cf85=_0x16b342[_0x27c412(0x1da)];_0x41cf85=applyExclusionRules(_0x41cf85,_0x1a9c66);}const _0x5b7eb7=_0x5dca39[_0x27c412(0x6e)](_0x5e2b21=>_0x5e2b21===_0x16b342),_0x12b576=_0x5b7eb7!==-0x1?_0x5b7eb7+0x1:-0x1;return{'id':_0x27c412(0x1f4)+_0x3da0c8,'name':_0x16b342[_0x27c412(0x113)],'content':_0x41cf85[_0x27c412(0x155)](),'floor':_0x12b576,'is_user':_0x16b342[_0x27c412(0xb9)],'send_date':_0x16b342[_0x27c412(0x20e)]};})['filter'](_0x50b0d6=>_0x50b0d6[_0x207657(0x233)]);if(_0x39f938[_0x207657(0x1a7)]===0x0){_0x4d4764[_0x207657(0x153)]=_0x207657(0xf2),toastr['warning'](_0x207657(0xf2),_0x207657(0x219));return;}const _0x19a03f=_0x39f938['map']((_0x2bb6c3,_0x5291a7)=>_0x207657(0xbc)+_0x2bb6c3['id']+_0x207657(0x21d)+_0x2bb6c3[_0x207657(0x1bb)]+_0x207657(0x1ea)+_0x2bb6c3['name']+']\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
\x0a\x20\x20\x20\x20\x20\x20\x20\x20')['join']('');showHtmlModal(_0x207657(0x24d),_0x207657(0x79)+_0x19a03f+_0x207657(0x238),{'okText':_0x207657(0x261),'onOk':_0x2b44cf=>{const _0x5861eb=_0x207657,_0xc1bbf0=[];_0x2b44cf[_0x5861eb(0xcf)](_0x5861eb(0x105))[_0x5861eb(0xcb)](function(){const _0x10effb=_0x5861eb,_0x9328c8=$(this)[_0x10effb(0xcf)](_0x10effb(0xac)),_0x245ad5=_0x9328c8[_0x10effb(0xd3)]();_0x245ad5[_0x10effb(0x155)]()&&_0xc1bbf0[_0x10effb(0x1af)]({'mes':_0x245ad5,'is_user':_0x9328c8[_0x10effb(0x1d4)](_0x10effb(0x86)),'send_date':_0x9328c8[_0x10effb(0x1d4)](_0x10effb(0xae)),'floor':_0x9328c8[_0x10effb(0x1d4)](_0x10effb(0x1bb))});}),_0x4d4764[_0x5861eb(0x13c)]['finalMessages']=JSON['stringify'](_0xc1bbf0);const _0x426010=document[_0x5861eb(0x242)](_0x5861eb(0x198))[_0x5861eb(0x15e)],_0x26bea6=document['getElementById'](_0x5861eb(0x10e))['value'];_0x4d4764[_0x5861eb(0x153)]=_0x5861eb(0x1ec)+_0x426010+_0x5861eb(0x1d6)+_0x26bea6+'\x20楼的内容(共\x20'+_0xc1bbf0['length']+'\x20条有效条目),请点击“开始凝识”进入自动向量化流程。',toastr[_0x5861eb(0x249)]('预览内容已更新,可随时开始凝识。',_0x5861eb(0x23f));}}),$(_0x207657(0x1ca))['on'](_0x207657(0x217),function(_0x4c15f4){const _0x3e6675=_0x207657;_0x4c15f4[_0x3e6675(0x203)]();const _0x5984b8=$(this)[_0x3e6675(0x1d4)](_0x3e6675(0x18a));$('#'+_0x5984b8)['remove']();});}catch(_0x5f0086){console[_0x207657(0xf4)](_0x207657(0xab),_0x5f0086),_0x4d4764[_0x207657(0x153)]=_0x207657(0x148)+_0x5f0086[_0x207657(0x13f)],toastr['error'](_0x207657(0x148)+_0x5f0086[_0x207657(0x13f)],_0x207657(0x128));}}function _0x91bf(_0x4a7f01,_0x560610){const _0x21f4d0=_0x21f4();return _0x91bf=function(_0x91bfea,_0x3f1dca){_0x91bfea=_0x91bfea-0x67;let _0x4f33ea=_0x21f4d0[_0x91bfea];return _0x4f33ea;},_0x91bf(_0x4a7f01,_0x560610);}function log(_0x1da166,_0x1fed3c=_0x2eed1f(0x1a4)){const _0x6d1cee=_0x2eed1f,_0x246421=document[_0x6d1cee(0x242)](_0x6d1cee(0xfb));if(!_0x246421)return;const _0x2091f7=document[_0x6d1cee(0x80)]('p'),_0x298dc3=new Date()[_0x6d1cee(0x110)]();let _0x44484f='fa-circle-info',_0x26ff05='log-info';switch(_0x1fed3c){case _0x6d1cee(0x249):_0x44484f=_0x6d1cee(0x1ed),_0x26ff05=_0x6d1cee(0x1b9);break;case _0x6d1cee(0xf4):_0x44484f=_0x6d1cee(0x1ac),_0x26ff05='log-error';break;case _0x6d1cee(0x205):_0x44484f='fa-exclamation-triangle',_0x26ff05='log-warn';break;}_0x2091f7[_0x6d1cee(0x229)]=_0x6d1cee(0x16f)+_0x26ff05,_0x2091f7['innerHTML']='