From 5151e1bb00de5eb50be82e7b864cf852dfd32681 Mon Sep 17 00:00:00 2001 From: Wx-2025 <351320169@qq.com> Date: Sat, 2 Aug 2025 19:36:06 +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 f674534..6b262c6 100644 --- a/ui/hanlinyuan-bindings.js +++ b/ui/hanlinyuan-bindings.js @@ -1 +1 @@ -const _0x5589d6=_0xc00f;(function(_0x1da8fe,_0x4292d0){const _0x36c97d=_0xc00f,_0xaf9aaa=_0x1da8fe();while(!![]){try{const _0x2faade=-parseInt(_0x36c97d(0x16c))/0x1*(parseInt(_0x36c97d(0x120))/0x2)+-parseInt(_0x36c97d(0x1e7))/0x3+parseInt(_0x36c97d(0x144))/0x4*(parseInt(_0x36c97d(0xe2))/0x5)+parseInt(_0x36c97d(0x1b3))/0x6*(-parseInt(_0x36c97d(0x1ed))/0x7)+parseInt(_0x36c97d(0x154))/0x8*(-parseInt(_0x36c97d(0x103))/0x9)+parseInt(_0x36c97d(0xb3))/0xa+-parseInt(_0x36c97d(0x1ef))/0xb*(-parseInt(_0x36c97d(0x178))/0xc);if(_0x2faade===_0x4292d0)break;else _0xaf9aaa['push'](_0xaf9aaa['shift']());}catch(_0x3d12f3){_0xaf9aaa['push'](_0xaf9aaa['shift']());}}}(_0xc393,0xbb8bc));import{getContext}from'/scripts/extensions.js';import*as _0x488321 from'../core/rag-processor.js';import*as _0x114fcd from'../core/historiographer.js';import*as _0x1ab3b1 from'../core/utils/context-utils.js';import*as _0x223bb0 from'../core/ingestion-manager.js';import{showContentModal,showHtmlModal}from'./page-window.js';import{extractBlocksByTags,applyExclusionRules}from'../core/utils/rag-tag-extractor.js';_0x5589d6(0x17d);function setupGlobalEventHandlers(){const _0x3ea8ed=_0x5589d6;window[_0x3ea8ed(0x110)]=()=>saveSettingsFromUI(![]),window['resetHLYSettings']=resetSettingsToUI,window[_0x3ea8ed(0x1a0)]=testApi,window[_0x3ea8ed(0xcc)]=fetchHLYEmbeddingModels,window[_0x3ea8ed(0x10a)]=fetchHLYRerankModels,window[_0x3ea8ed(0xc2)]=updatePanelStatus,window[_0x3ea8ed(0x15a)]=purgeStorage,window[_0x3ea8ed(0x15f)]=startCondensation,window[_0x3ea8ed(0x138)]=previewCondensation,window[_0x3ea8ed(0x1b8)]=ingestManualText,window[_0x3ea8ed(0x142)]=log,window[_0x3ea8ed(0xed)]=showStats,window['startHLYHistoriography']=startHistoriography;}function updateAndSaveSetting(_0x55f521,_0x1bb424){const _0x566433=_0x5589d6,_0xbd4a8b=_0x488321[_0x566433(0x1c2)]();if(!_0xbd4a8b)return;const _0x335f42=_0x55f521[_0x566433(0xd8)]('.');let _0x22c53d=_0xbd4a8b;for(let _0x37429d=0x0;_0x37429d<_0x335f42['length']-0x1;_0x37429d++){_0x22c53d=_0x22c53d[_0x335f42[_0x37429d]]=_0x22c53d[_0x335f42[_0x37429d]]||{};}_0x22c53d[_0x335f42[_0x335f42['length']-0x1]]=_0x1bb424,_0x488321[_0x566433(0xdf)](),log(_0x566433(0x18a)+_0x55f521+_0x566433(0x102)+JSON[_0x566433(0x19f)](_0x1bb424),_0x566433(0xc4));}function _0xc00f(_0x53ce35,_0x5648f3){const _0xc3939c=_0xc393();return _0xc00f=function(_0xc00f6c,_0x2f087b){_0xc00f6c=_0xc00f6c-0xb0;let _0x16f034=_0xc3939c[_0xc00f6c];return _0x16f034;},_0xc00f(_0x53ce35,_0x5648f3);}function bindAutoSaveEvents(){const _0x58186d=_0x5589d6,_0x4fd641=document[_0x58186d(0x1c0)](_0x58186d(0xe7));if(!_0x4fd641)return;_0x4fd641['addEventListener'](_0x58186d(0x170),_0x5198b6=>{const _0x28a8fd=_0x58186d,_0x451ca8=_0x5198b6['target'],_0x53df22=_0x451ca8[_0x28a8fd(0x105)][_0x28a8fd(0x181)];if(!_0x53df22)return;let _0x178615;const _0x35768b=_0x451ca8[_0x28a8fd(0x105)]['type']||_0x28a8fd(0xcd);if(_0x451ca8[_0x28a8fd(0x199)]===_0x28a8fd(0x148))_0x178615=_0x451ca8[_0x28a8fd(0x1b9)];else{if(_0x451ca8['type']===_0x28a8fd(0xb7)){if(_0x451ca8['checked']){const _0x1f7152=_0x4fd641[_0x28a8fd(0x18e)](_0x28a8fd(0x187)+_0x451ca8[_0x28a8fd(0xd6)]+'\x22]'),_0xc4e5dc=Array[_0x28a8fd(0x19c)](_0x1f7152)[_0x28a8fd(0x134)](_0x4b0bd2=>_0x4b0bd2[_0x28a8fd(0x1b9)]);_0x178615=_0xc4e5dc[_0x28a8fd(0x194)];}else return;}else _0x178615=_0x451ca8[_0x28a8fd(0x194)];}switch(_0x35768b){case _0x28a8fd(0x141):_0x178615=parseInt(_0x178615,0xa);break;case'float':_0x178615=parseFloat(_0x178615);break;case'boolean':typeof _0x178615!=='boolean'&&(_0x178615=_0x178615===_0x28a8fd(0x1fa));break;}if(_0x451ca8[_0x28a8fd(0x199)]===_0x28a8fd(0xb7)&&!_0x451ca8['checked'])return;updateAndSaveSetting(_0x53df22,_0x178615);});}export function bindHanlinyuanEvents(){const _0x17babb=_0x5589d6,_0x55372f=getContext();if(!_0x55372f){console[_0x17babb(0xf5)](_0x17babb(0x124));return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents(),bindTutorialEvents(),bindAutoSaveEvents(),bindSessionLockEvent();if(_0x488321['initialize'])_0x488321[_0x17babb(0x167)]();else{console[_0x17babb(0xf5)](_0x17babb(0x198));return;}loadSettingsToUI(),loadWorldbookList(),log('[翰林院-枢纽]\x20已成功连接各部,政令畅通。','info');const _0x2fbe13=document[_0x17babb(0x1c0)](_0x17babb(0x214)),_0x4f955d=document[_0x17babb(0x1c0)](_0x17babb(0x117)),_0x4dd4bc=document['getElementById'](_0x17babb(0x203)),_0x412370=document[_0x17babb(0x1c0)](_0x17babb(0x216)),_0x4ba88f=document[_0x17babb(0x1c0)](_0x17babb(0x1b0)),_0x48911a=document[_0x17babb(0x1c0)](_0x17babb(0x10f)),_0x3e8435=document[_0x17babb(0x1c0)](_0x17babb(0xfd)),_0x507441=document['getElementById'](_0x17babb(0x1ec));let _0x23e963=null,_0x45a4dc=null;_0x2fbe13[_0x17babb(0x14c)](_0x17babb(0x170),_0x3a1621=>{const _0x4c43b9=_0x17babb;_0x23e963=_0x3a1621[_0x4c43b9(0x17b)]['files'][0x0],_0x23e963?(_0x4f955d['textContent']=_0x23e963[_0x4c43b9(0xd6)],_0x4f955d['title']=_0x23e963[_0x4c43b9(0xd6)]):_0x4f955d[_0x4c43b9(0x151)]=_0x4c43b9(0x17e);}),_0x4dd4bc[_0x17babb(0x14c)](_0x17babb(0x1bb),async()=>{const _0x4898f7=_0x17babb;if(!_0x23e963){toastr[_0x4898f7(0x1bc)](_0x4898f7(0x175));return;}let _0x40894c=0x0;const _0x46806b=_0x223bb0[_0x4898f7(0x149)](_0x23e963),_0xbcf9a5=_0x223bb0[_0x4898f7(0x1d7)](_0x46806b);if(_0xbcf9a5){const _0x2a4ed6=(_0xbcf9a5['processedChunks']/_0xbcf9a5[_0x4898f7(0x11e)]*0x64)[_0x4898f7(0x197)](0x1),_0x328119=confirm(_0x4898f7(0x209)+_0x2a4ed6+'%。是否从上次中断之处继续?');_0x328119?(_0x40894c=_0xbcf9a5[_0x4898f7(0x18f)],toastr['info'](_0x4898f7(0x122)+(_0x40894c+0x1)+'\x20块继续录入。',_0x4898f7(0xe6)),log('[断点续传]\x20用户选择继续任务\x20'+_0x46806b+_0x4898f7(0xfc)+_0x40894c+_0x4898f7(0x20e),_0x4898f7(0x11a))):(_0x223bb0['clearJob'](_0x46806b),toastr[_0x4898f7(0x11a)]('遵命,将从头开始录入此书。',_0x4898f7(0xe6)),log('[断点续传]\x20用户选择放弃旧任务\x20'+_0x46806b+',重新开始。','warn'));}_0x45a4dc=new AbortController();const _0x363495=_0x45a4dc[_0x4898f7(0x113)];_0x507441[_0x4898f7(0x13b)][_0x4898f7(0x166)]=_0x4898f7(0x14d),_0x4ba88f['style'][_0x4898f7(0x166)]=_0x4898f7(0xe5),_0x3e8435[_0x4898f7(0x151)]=_0x4898f7(0x101),_0x48911a[_0x4898f7(0x194)]=0x0;try{const _0x53d3cc=await _0x23e963[_0x4898f7(0x1ac)](),_0x1583b4=_0x5ce48d=>{const _0x360e6f=_0x4898f7;_0x3e8435[_0x360e6f(0x151)]=_0x360e6f(0x1b1)+_0x5ce48d[_0x360e6f(0x1c7)]+'\x20('+_0x5ce48d[_0x360e6f(0xc8)]+'/'+_0x5ce48d[_0x360e6f(0x129)]+')',_0x48911a[_0x360e6f(0x194)]=_0x5ce48d[_0x360e6f(0xc8)]/_0x5ce48d[_0x360e6f(0x129)]*0x64;},_0x538243=()=>{const _0x4fa87b=_0x4898f7;updatePanelStatus(),log(_0x4fa87b(0x12f),_0x4fa87b(0x11a));},_0x4a5d3d=await _0x488321[_0x4898f7(0xea)](_0x53d3cc,_0x4898f7(0x1d1),_0x23e963['name'],_0x1583b4,_0x363495,log,_0x538243,_0x46806b,_0x40894c);if(_0x4a5d3d['success'])toastr[_0x4898f7(0xc4)]('成功录入\x20'+_0x4a5d3d[_0x4898f7(0x161)]+_0x4898f7(0xf0)),_0x3e8435[_0x4898f7(0x151)]=_0x4898f7(0x1f2)+_0x4a5d3d[_0x4898f7(0x161)]+_0x4898f7(0x1a3),_0x48911a[_0x4898f7(0x194)]=0x64,updatePanelStatus();else throw new Error(_0x4a5d3d[_0x4898f7(0xf5)]||_0x4898f7(0xe9));}catch(_0x42503c){_0x42503c[_0x4898f7(0xd6)]===_0x4898f7(0x132)?(toastr['info'](_0x4898f7(0x15d)),_0x3e8435[_0x4898f7(0x151)]=_0x4898f7(0x1c8)):(toastr[_0x4898f7(0xf5)](_0x4898f7(0x126)+_0x42503c[_0x4898f7(0x1c7)]+_0x4898f7(0x215)),_0x3e8435[_0x4898f7(0x151)]=_0x4898f7(0x1db)+_0x42503c[_0x4898f7(0x1c7)]);}finally{setTimeout(()=>{const _0x50683c=_0x4898f7;_0x507441[_0x50683c(0x13b)]['display']=_0x50683c(0x200),_0x4ba88f[_0x50683c(0x13b)]['display']=_0x50683c(0x14d),_0x2fbe13[_0x50683c(0x194)]='',_0x23e963=null,_0x4f955d[_0x50683c(0x151)]=_0x50683c(0x17e);},0xbb8);}}),_0x412370[_0x17babb(0x14c)]('click',()=>{const _0x4d41ff=_0x17babb;_0x45a4dc&&_0x45a4dc[_0x4d41ff(0x165)]();});}function bindSessionLockEvent(){const _0x2f6cd6=_0x5589d6,_0x5bc9ed=document[_0x2f6cd6(0x1c0)](_0x2f6cd6(0x15c));if(!_0x5bc9ed)return;_0x5bc9ed[_0x2f6cd6(0x14c)]('click',()=>{const _0x171026=_0x2f6cd6,_0x3c2265=_0x488321['toggleSessionLock']();updateSessionLockUI(_0x3c2265);if(_0x3c2265){const _0x226ce7=_0x488321['getLockedSessionInfo']();toastr[_0x171026(0xc4)]('会话已锁定到:\x20'+_0x226ce7['id'],'圣旨已下'),log(_0x171026(0x109)+_0x226ce7['id'],_0x171026(0xc4));}else toastr[_0x171026(0x11a)](_0x171026(0x115),'诏曰'),log(_0x171026(0x16f),_0x171026(0x11a));updatePanelStatus();}),updateSessionLockUI(_0x488321[_0x2f6cd6(0xf3)]());}function updateSessionLockUI(_0x25443d){const _0x4319e3=_0x5589d6,_0x1c949c=document['getElementById']('hly-session-lock-btn');if(!_0x1c949c)return;const _0x42006c=_0x1c949c[_0x4319e3(0x1fc)]('i'),_0x4df7fc=_0x1c949c[_0x4319e3(0x1fc)](_0x4319e3(0x212));_0x25443d?(_0x1c949c[_0x4319e3(0x168)][_0x4319e3(0xca)]('active'),_0x42006c[_0x4319e3(0x137)]=_0x4319e3(0x1e1),_0x4df7fc[_0x4319e3(0x151)]=_0x4319e3(0xf7),_0x1c949c[_0x4319e3(0x20c)]=_0x4319e3(0x169)):(_0x1c949c[_0x4319e3(0x168)][_0x4319e3(0x186)](_0x4319e3(0x18b)),_0x42006c[_0x4319e3(0x137)]=_0x4319e3(0xbd),_0x4df7fc[_0x4319e3(0x151)]='锁定会话',_0x1c949c['title']=_0x4319e3(0x193));}function bindPanelToggleEvents(){const _0x3bf840=_0x5589d6,_0x4bb12e=document[_0x3bf840(0x1c0)]('amily2_open_rag_palace');if(_0x4bb12e){}}function bindTutorialEvents(){const _0x4fd43e=_0x5589d6,_0x1db727=document['getElementById']('amily2_open_hanlin_tutorial');_0x1db727&&_0x1db727['addEventListener'](_0x4fd43e(0x1bb),()=>{const _0x3223ab=_0x4fd43e;showContentModal(_0x3223ab(0x153),_0x3223ab(0xb1));});}function bindInternalUIEvents(){const _0x190933=_0x5589d6,_0x1576fb=document['querySelectorAll'](_0x190933(0x190));_0x1576fb[_0x190933(0x189)](_0xba13ef=>{const _0x3855ca=_0x190933;_0xba13ef[_0x3855ca(0x14c)]('click',()=>{const _0x1dc2d6=_0x3855ca,_0xcec30=_0xba13ef[_0x1dc2d6(0x105)][_0x1dc2d6(0x19a)],_0x49fbbb='hly-'+_0xcec30+'-tab';document['querySelectorAll']('.hly-tab-pane')[_0x1dc2d6(0x189)](_0x5037cd=>{const _0x12d9fd=_0x1dc2d6;_0x5037cd[_0x12d9fd(0x168)][_0x12d9fd(0x14e)]('active',_0x5037cd['id']===_0x49fbbb);}),_0x1576fb[_0x1dc2d6(0x189)](_0x2d6dc1=>_0x2d6dc1['classList']['toggle']('active',_0x2d6dc1===_0xba13ef));});});const _0x155a49=document[_0x190933(0x1c0)]('hly-api-endpoint');_0x155a49&&_0x155a49[_0x190933(0x14c)](_0x190933(0x170),toggleCustomEndpointDocket);const _0x30f4c5=document[_0x190933(0x18e)](_0x190933(0xd7));_0x30f4c5[_0x190933(0x189)](_0x2661cc=>{const _0x5aeae2=_0x190933;_0x2661cc[_0x5aeae2(0x14c)](_0x5aeae2(0x170),toggleInjectionDetails);});const _0x9a78b=document['getElementById'](_0x190933(0xfa)),_0x2f498f=document[_0x190933(0x1c0)](_0x190933(0x13c));_0x9a78b&&_0x2f498f&&_0x9a78b[_0x190933(0x14c)](_0x190933(0x170),()=>{const _0x160db4=_0x190933;_0x2f498f[_0x160db4(0x13b)][_0x160db4(0x166)]=_0x9a78b[_0x160db4(0x1b9)]?_0x160db4(0xe5):_0x160db4(0x14d);});const _0x11a268=document[_0x190933(0x1c0)](_0x190933(0x119));_0x11a268&&_0x11a268[_0x190933(0x14c)](_0x190933(0x170),handleWorldbookSelectionChange);const _0x1c1262=document[_0x190933(0x1c0)]('hly-exclusion-rules-btn');_0x1c1262&&_0x1c1262[_0x190933(0x14c)]('click',showExclusionRulesModal);}function toggleInjectionDetails(){const _0x4eadae=_0x5589d6,_0x203edb=document[_0x4eadae(0x1fc)](_0x4eadae(0x13d))[_0x4eadae(0x194)],_0x4507a9=document['getElementById'](_0x4eadae(0x11b)),_0x29e484=document[_0x4eadae(0x1c0)](_0x4eadae(0x1e9)),_0x33a03c=_0x203edb==='1';_0x4507a9[_0x4eadae(0xbb)]=!_0x33a03c,_0x29e484[_0x4eadae(0xbb)]=!_0x33a03c;}function toggleCustomEndpointDocket(){const _0x326635=_0x5589d6,_0x3da337=document['getElementById'](_0x326635(0xc3))[_0x326635(0x194)],_0x479d55=document[_0x326635(0x1c0)](_0x326635(0xd3));_0x479d55&&(_0x479d55[_0x326635(0x13b)]['display']=_0x3da337===_0x326635(0x1ae)||_0x3da337==='azure'?'block':_0x326635(0x14d));}function _0xc393(){const _0x35a1bf=['正在为《','您确定要将所有设定恢复为出厂默认值吗?','novel','加载书库列表失败:\x20','hly-injection-template','开始获取模型列表...','此操作将彻底清空当前角色的所有忆识(向量),且无法恢复。您确定要继续吗?','key','loadProgress','condensation','hly-query-message-count','宝库已清空。','错误:\x20','getAvailableWorldbooks','position','scrollHeight','hly-locked-status','.hly-preview-delete-btn-v2','fas\x20fa-lock','\x20个模型。','fa-times-circle','.hly-exclusion-rule-row','正在采集消息...','user','1247481ujODVt','fetchRerankModels','hly-injection-role','无法获取总数,可能是由于数据量过大导致服务器API错误:\x20','finalText','hanlinyuan-ingest-novel-controls','110173riCXre','[翰林院-枢纽]\x20编纂过程发生错误:','437987zTvvYd','成功加载\x20','hly-delete-rule-btn','任务完成!成功录入\x20','rerank','fetchEmbeddingModels','embeddingModel','contains','\x20个Rerank模型。','未找到符合条件的消息。','\x20条忆识。','true','神力连接失败:\x20','querySelector','\x20条消息,开始凝识...','[data-setting-key]','根据标签提取或内容排除条件,未找到任何有效内容。','flex','hly-manual-text','预览后文本录入成功,新增\x20','hanlinyuan-ingest-novel-start','hly-rerank-hybrid-alpha','未找到符合条件的消息可供凝识。','\x20个书库。','hly-max-results','advanced','启禀大人,发现此书上次录入已完成\x20','manual','\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请选择一个书库...','radio','innerHTML','layerStart','请选择一个条目...','disabled','hly-rerank-model','fas\x20fa-lock-open','正在清空宝库...','apiEndpoint','预览并编辑凝识内容','content','updateHLYMemoryCount','hly-api-endpoint','success','预览内容已更新,可随时开始凝识。','\x0a
\x0a翰林院宝库状态\x0a--------------------\x0a集合ID:\x20','hly-include-user','processed','mes','add','\x0a--------------------\x0aAPI端点:\x20','fetchHLYEmbeddingModels','string','获取失败','正在处理预览后的文本...','[翰林院-枢纽]\x20获取Rerank模型列表失败:','\x0a\x20\x20\x20\x20\x20\x20\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','hly-rerank-url','hanlinyuan-ingest-progress-bar','saveHLYSettings','hly-layer-start','当前所有操作都将指向这个锁定的宝库:','signal','getLockedSessionInfo','会话已解锁,将跟随当前角色。','翰林院启奏','hanlinyuan-ingest-novel-file-name','end','hly-hist-select-library','info','hly-injection-depth','\x20个条目。','comment','totalChunks','凝识失败:\x20','410WXEblc','hly-match-threshold','遵命,将从第\x20','model','[翰林院-枢纽]\x20未能获取SillyTavern上下文,绑定失败。','\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\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第\x20','录入失败:\x20','根据当前勾选条件,未找到符合的消息可供预览。','hly-rerank-notify','total','》中条目\x20(Key:\x20','preview-item-','enabled','closest','selectedIndex','[实时刷新]\x20批次完成,忆识总数已更新。','hly-rerank-api-key','.hly-preview-textarea','AbortError',']\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','find','','hly-exclusion-rules-container','className','previewHLYCondensation','[翰林院-枢纽]\x20预览过程发生错误:','toLocaleTimeString','style','hly-tag-input-container','input[name=\x22hly-injection-position\x22]:checked','hly-layer-end','preventDefault','\x22>\x20[','integer','hlyLog','hly-chunk-size','4862152pDRMoU','injection','#hly-add-rule-btn','正在处理您确认后的文书...','checkbox','generateJobId','start','beforeend','addEventListener','none','toggle','hly-current-vector-count','未能获取到任何模型。','textContent','》获取条目列表...','翰林院使用教程','24HwGUGU','凝识完成!新增\x20','正在处理您提交的文书...','此书库为空','retrieval','成功获取\x20','purgeHLYStorage','matchThreshold','hly-session-lock-btn','任务已由用户中止。进度已保存,可随时继续。','预览失败:\x20','startHLYCondensation','收到手动录入请求,文本长度:\x20','count','未能获取到任何Rerank模型。','includes','正在获取可用书库列表...','abort','display','initialize','classList','点击以解锁,让翰林院跟随当前角色','#hly-rules-list','depth_role','6063EyMQPB','getCharacterName','push','会话已解锁。','change','加载条目失败:\x20','','getMessagesForCondensation','fa-check-circle','请先选择一个\x20.txt\x20文件','layerEnd','\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','336uTmuJl','hly-condensation-enabled','手动录入失败:\x20','target','getCollectionId','use\x20strict','未选择文件','.hly-preview-item-v2','scrollTop','settingKey','input',')\x20进行编纂...','condensation.exclusionRules','未找到任何书库','remove','input[name=\x22','\x20条内容进行凝识:\x0a\x0a','forEach','[自动保存]\x20设置项\x20\x27','active','val','手动录入成功,新增\x20','querySelectorAll','processedChunks','.hly-nav-item','请先选择书库','\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','点击以锁定,让翰林院固定操作当前角色的宝库','value','宝库状态','url','toFixed','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨!','type','tab','大功告成','from','\x20(Key:\x20','length','stringify','testHLYApi','\x0a
\x0a\x20\x20\x20\x20\x20\x20\x20\x20','map','\x20个知识块。','','正在加载条目...','录入内容不能为空。','hybrid_alpha','hly-tag-input','\x0a忆识总数:\x20','hly-api-key','未知的编纂错误','text','join','custom','hly-log-entry\x20','hanlinyuan-ingest-progress-container','处理中:\x20','hly-include-ai','216SgkbHA','\x22>\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\x0a\x20\x20\x20\x20\x20\x20\x20\x20','click','warning','getVectorCount','N/A\x20(数据量过大)','top_n','getElementById','hly-rerank-enabled','getSettings','boolean','tagExtractionEnabled','notify','hly-condensation-results','message','任务已中止。','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'];_0xc393=function(){return _0x35a1bf;};return _0xc393();}function loadSettingsToUI(){const _0x6b7569=_0x5589d6,_0x1aefa3=_0x488321['getSettings']();if(!_0x1aefa3)return;document[_0x6b7569(0x1c0)]('hly-retrieval-enabled')[_0x6b7569(0x1b9)]=_0x1aefa3[_0x6b7569(0x158)][_0x6b7569(0x12c)],document[_0x6b7569(0x1c0)](_0x6b7569(0xc3))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x158)]['apiEndpoint'],document[_0x6b7569(0x1c0)](_0x6b7569(0xe8))[_0x6b7569(0x194)]=_0x1aefa3['retrieval']['customApiUrl'],document[_0x6b7569(0x1c0)](_0x6b7569(0x1aa))['value']=_0x1aefa3['retrieval']['apiKey'];const _0xf0384e=document[_0x6b7569(0x1c0)](_0x6b7569(0x1b7));if(_0xf0384e[_0x6b7569(0x106)]['length']===0x0){const _0x5431eb=_0x1aefa3[_0x6b7569(0x158)][_0x6b7569(0x1f5)],_0x117865=new Option(_0x5431eb,_0x5431eb,!![],!![]);_0xf0384e['add'](_0x117865);}_0xf0384e['value']=_0x1aefa3[_0x6b7569(0x158)][_0x6b7569(0x1f5)],document['getElementById'](_0x6b7569(0x10b))[_0x6b7569(0x1b9)]=_0x1aefa3[_0x6b7569(0x158)][_0x6b7569(0x1c5)],document[_0x6b7569(0x1c0)](_0x6b7569(0x143))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x208)]['chunkSize'],document[_0x6b7569(0x1c0)]('hly-overlap-size')[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x208)][_0x6b7569(0xb0)],document['getElementById'](_0x6b7569(0x121))['value']=_0x1aefa3[_0x6b7569(0x208)][_0x6b7569(0x15b)],document[_0x6b7569(0x1c0)](_0x6b7569(0x1d9))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x208)][_0x6b7569(0x218)],document[_0x6b7569(0x1c0)](_0x6b7569(0x207))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x208)]['maxResults'],document[_0x6b7569(0x1c0)](_0x6b7569(0xb2))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x158)]['batchSize'],document[_0x6b7569(0x1c0)](_0x6b7569(0x1d3))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x145)][_0x6b7569(0xf4)];const _0x4bf599=document[_0x6b7569(0x1fc)]('input[name=\x22hly-injection-position\x22][value=\x22'+_0x1aefa3[_0x6b7569(0x145)][_0x6b7569(0x1dd)]+'\x22]');_0x4bf599&&(_0x4bf599[_0x6b7569(0x1b9)]=!![]);document['getElementById'](_0x6b7569(0x11b))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x145)]['depth'],document[_0x6b7569(0x1c0)](_0x6b7569(0x1e9))[_0x6b7569(0x194)]=_0x1aefa3['injection'][_0x6b7569(0x16b)],toggleInjectionDetails(),document[_0x6b7569(0x1c0)](_0x6b7569(0x179))[_0x6b7569(0x1b9)]=_0x1aefa3[_0x6b7569(0x1d8)][_0x6b7569(0x12c)],document[_0x6b7569(0x1c0)](_0x6b7569(0x111))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x1d8)][_0x6b7569(0xb9)],document[_0x6b7569(0x1c0)](_0x6b7569(0x13e))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x1d8)][_0x6b7569(0x176)],document[_0x6b7569(0x1c0)](_0x6b7569(0xc7))[_0x6b7569(0x1b9)]=_0x1aefa3[_0x6b7569(0x1d8)][_0x6b7569(0x107)][_0x6b7569(0x1e6)],document['getElementById'](_0x6b7569(0x1b2))['checked']=_0x1aefa3[_0x6b7569(0x1d8)]['messageTypes']['ai'];const _0x40ede2=document[_0x6b7569(0x1c0)](_0x6b7569(0xfa)),_0x433d99=document[_0x6b7569(0x1c0)](_0x6b7569(0x1a8)),_0x4e77c6=document[_0x6b7569(0x1c0)]('hly-tag-input-container');_0x40ede2[_0x6b7569(0x1b9)]=_0x1aefa3[_0x6b7569(0x1d8)][_0x6b7569(0x1c4)],_0x433d99['value']=_0x1aefa3['condensation']['tags'],_0x4e77c6[_0x6b7569(0x13b)][_0x6b7569(0x166)]=_0x40ede2[_0x6b7569(0x1b9)]?_0x6b7569(0xe5):_0x6b7569(0x14d),document['getElementById'](_0x6b7569(0x1c1))[_0x6b7569(0x1b9)]=_0x1aefa3[_0x6b7569(0x1f3)][_0x6b7569(0x12c)],document[_0x6b7569(0x1c0)](_0x6b7569(0x10e))['value']=_0x1aefa3[_0x6b7569(0x1f3)][_0x6b7569(0x196)],document[_0x6b7569(0x1c0)](_0x6b7569(0x130))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x1f3)]['apiKey'];const _0x54b6f7=document[_0x6b7569(0x1c0)](_0x6b7569(0xbc));if(_0x54b6f7[_0x6b7569(0x106)][_0x6b7569(0x19e)]===0x0){const _0x4da2cf=_0x1aefa3[_0x6b7569(0x1f3)][_0x6b7569(0x123)];if(_0x4da2cf){const _0x99318d=new Option(_0x4da2cf,_0x4da2cf,!![],!![]);_0x54b6f7[_0x6b7569(0xca)](_0x99318d);}}_0x54b6f7[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x1f3)]['model'],document[_0x6b7569(0x1c0)](_0x6b7569(0x1b6))[_0x6b7569(0x194)]=_0x1aefa3['rerank'][_0x6b7569(0x1bf)],document['getElementById'](_0x6b7569(0x204))[_0x6b7569(0x194)]=_0x1aefa3[_0x6b7569(0x1f3)][_0x6b7569(0x1a7)],document[_0x6b7569(0x1c0)](_0x6b7569(0x128))[_0x6b7569(0x1b9)]=_0x1aefa3['rerank'][_0x6b7569(0x1c5)],toggleCustomEndpointDocket();}function saveSettingsFromUI(_0x5a461f=!![]){const _0x5f1c45=_0x5589d6,_0xd46350=document[_0x5f1c45(0x1c0)](_0x5f1c45(0xe7));if(!_0xd46350)return;const _0x38adf7=_0xd46350[_0x5f1c45(0x18e)](_0x5f1c45(0x1fe));_0x38adf7[_0x5f1c45(0x189)](_0x4757e4=>{const _0x4bb532=_0x5f1c45,_0x4d8772=_0x4757e4[_0x4bb532(0x105)]['settingKey'];if(!_0x4d8772)return;let _0x56d4cc;const _0x4a9fb4=_0x4757e4[_0x4bb532(0x105)][_0x4bb532(0x199)]||_0x4bb532(0xcd);if(_0x4757e4[_0x4bb532(0x199)]===_0x4bb532(0x148))_0x56d4cc=_0x4757e4[_0x4bb532(0x1b9)];else{if(_0x4757e4['type']===_0x4bb532(0xb7)){if(!_0x4757e4[_0x4bb532(0x1b9)])return;_0x56d4cc=_0x4757e4[_0x4bb532(0x194)];}else _0x56d4cc=_0x4757e4[_0x4bb532(0x194)];}switch(_0x4a9fb4){case _0x4bb532(0x141):_0x56d4cc=parseInt(_0x56d4cc,0xa);break;case'float':_0x56d4cc=parseFloat(_0x56d4cc);break;case _0x4bb532(0x1c3):if(typeof _0x56d4cc!==_0x4bb532(0x1c3))_0x56d4cc=_0x56d4cc===_0x4bb532(0x1fa);break;}const _0x45a21c=_0x488321[_0x4bb532(0x1c2)](),_0x3e179d=_0x4d8772[_0x4bb532(0xd8)]('.');let _0x5d8ac5=_0x45a21c;for(let _0x14ae7a=0x0;_0x14ae7a<_0x3e179d['length']-0x1;_0x14ae7a++){_0x5d8ac5=_0x5d8ac5[_0x3e179d[_0x14ae7a]]=_0x5d8ac5[_0x3e179d[_0x14ae7a]]||{};}_0x5d8ac5[_0x3e179d[_0x3e179d[_0x4bb532(0x19e)]-0x1]]=_0x56d4cc;}),_0x488321[_0x5f1c45(0xdf)](),!_0x5a461f&&(log(_0x5f1c45(0xb4),_0x5f1c45(0xc4)),toastr[_0x5f1c45(0xc4)]('翰林院设定已存档封印。',_0x5f1c45(0xe6)));}function resetSettingsToUI(){const _0x523af8=_0x5589d6;confirm(_0x523af8(0x1d0))&&(_0x488321['resetSettings'](),loadSettingsToUI(),toastr[_0x523af8(0x11a)]('翰林院设定已重置为初始状态。','诏曰'));}async function updatePanelStatus(){const _0x22cc9e=_0x5589d6,_0x390bd4=_0x488321[_0x22cc9e(0xf3)](),_0x31a512=document[_0x22cc9e(0x1c0)](_0x22cc9e(0xd9)),_0x5713d6=document[_0x22cc9e(0x1c0)]('hly-current-chat-id');if(_0x390bd4){const _0x2820cf=_0x488321[_0x22cc9e(0x114)]();_0x31a512['textContent']='会话已锁定',_0x5713d6['textContent']=_0x2820cf['id'],_0x5713d6['title']=_0x22cc9e(0x112)+_0x2820cf['id'],_0x31a512['classList'][_0x22cc9e(0xca)](_0x22cc9e(0x1df)),_0x5713d6[_0x22cc9e(0x168)]['add'](_0x22cc9e(0x1df));}else _0x31a512[_0x22cc9e(0x151)]=_0x1ab3b1[_0x22cc9e(0x16d)](),_0x5713d6[_0x22cc9e(0x151)]=_0x1ab3b1[_0x22cc9e(0xf8)]()||'无',_0x5713d6[_0x22cc9e(0x20c)]='',_0x31a512['classList'][_0x22cc9e(0x186)]('hly-locked-status'),_0x5713d6[_0x22cc9e(0x168)][_0x22cc9e(0x186)](_0x22cc9e(0x1df));const _0x33e606=document['getElementById'](_0x22cc9e(0x14f));_0x33e606[_0x22cc9e(0x151)]=_0x22cc9e(0xf2);try{const _0x171151=await _0x488321[_0x22cc9e(0x1bd)]();_0x33e606[_0x22cc9e(0x151)]=_0x171151;}catch(_0x383033){console[_0x22cc9e(0xf5)]('[翰林院-枢纽]\x20更新忆识数量失败:',_0x383033),_0x33e606[_0x22cc9e(0x151)]=_0x22cc9e(0x1be),_0x33e606['title']=_0x22cc9e(0x1ea)+_0x383033['message'];}}async function testApi(){const _0x4876a5=_0x5589d6;toastr[_0x4876a5(0x11a)]('正在测试神力连接...','圣旨');try{await _0x488321['testApiConnection'](),toastr[_0x4876a5(0xc4)](_0x4876a5(0x108),'圣意');}catch(_0x16a95){toastr[_0x4876a5(0xf5)](_0x4876a5(0x1fb)+_0x16a95[_0x4876a5(0x1c7)],'警报');}}async function fetchHLYEmbeddingModels(){const _0x3334c0=_0x5589d6,_0x4c8a92=document[_0x3334c0(0x1c0)](_0x3334c0(0x1b7)),_0x2eb19f=_0x4c8a92[_0x3334c0(0x194)];_0x4c8a92[_0x3334c0(0xb8)]=_0x3334c0(0x135),_0x4c8a92['disabled']=!![];try{log(_0x3334c0(0x1d4),_0x3334c0(0x11a));const _0x34e15b=await _0x488321[_0x3334c0(0x1f4)]();_0x4c8a92[_0x3334c0(0xb8)]='';if(_0x34e15b[_0x3334c0(0x19e)]===0x0){_0x4c8a92[_0x3334c0(0xb8)]=_0x3334c0(0x172),toastr['warn']('未能获取到任何模型。',_0x3334c0(0x116)),log(_0x3334c0(0x150),_0x3334c0(0x1cd));return;}_0x34e15b['forEach'](_0x529214=>{const _0x3b6500=_0x3334c0,_0x4aa034=new Option(_0x529214,_0x529214);_0x4c8a92[_0x3b6500(0xca)](_0x4aa034);}),_0x34e15b['includes'](_0x2eb19f)?_0x4c8a92[_0x3334c0(0x194)]=_0x2eb19f:_0x4c8a92[_0x3334c0(0x12e)]=0x0,toastr[_0x3334c0(0xc4)](_0x3334c0(0x159)+_0x34e15b[_0x3334c0(0x19e)]+_0x3334c0(0x1e2),'圣意'),log(_0x3334c0(0x159)+_0x34e15b[_0x3334c0(0x19e)]+'\x20个模型。',_0x3334c0(0xc4));}catch(_0x108f5a){console['error']('[翰林院-枢纽]\x20获取模型列表失败:',_0x108f5a),toastr['error']('获取模型失败:\x20'+_0x108f5a[_0x3334c0(0x1c7)],_0x3334c0(0xef)),log('获取模型失败:\x20'+_0x108f5a[_0x3334c0(0x1c7)],_0x3334c0(0xf5)),_0x4c8a92['innerHTML']=_0x3334c0(0xda);}finally{_0x4c8a92['disabled']=![];}}async function fetchHLYRerankModels(){const _0x16ada5=_0x5589d6,_0x333989=document[_0x16ada5(0x1c0)](_0x16ada5(0xbc)),_0x3fbfa6=_0x333989[_0x16ada5(0x194)];_0x333989[_0x16ada5(0xb8)]=_0x16ada5(0x135),_0x333989[_0x16ada5(0xbb)]=!![];try{log(_0x16ada5(0x217),_0x16ada5(0x11a));const _0x513f52=await _0x488321[_0x16ada5(0x1e8)]();_0x333989['innerHTML']='';if(_0x513f52['length']===0x0){_0x333989['innerHTML']=_0x16ada5(0x172),toastr[_0x16ada5(0x1cd)](_0x16ada5(0x162),_0x16ada5(0x116)),log(_0x16ada5(0x162),'warn');return;}_0x513f52[_0x16ada5(0x189)](_0x3061f0=>{const _0x1a512f=_0x16ada5,_0x1199f0=new Option(_0x3061f0,_0x3061f0);_0x333989[_0x1a512f(0xca)](_0x1199f0);}),_0x513f52[_0x16ada5(0x163)](_0x3fbfa6)?_0x333989[_0x16ada5(0x194)]=_0x3fbfa6:_0x333989[_0x16ada5(0x12e)]=0x0,toastr[_0x16ada5(0xc4)](_0x16ada5(0x159)+_0x513f52[_0x16ada5(0x19e)]+_0x16ada5(0x1f7),'圣意'),log(_0x16ada5(0x159)+_0x513f52[_0x16ada5(0x19e)]+'\x20个Rerank模型。',_0x16ada5(0xc4));}catch(_0xd12c93){console[_0x16ada5(0xf5)](_0x16ada5(0xdc),_0xd12c93),toastr[_0x16ada5(0xf5)](_0x16ada5(0xee)+_0xd12c93[_0x16ada5(0x1c7)],_0x16ada5(0xef)),log(_0x16ada5(0xee)+_0xd12c93[_0x16ada5(0x1c7)],'error'),_0x333989[_0x16ada5(0xb8)]='';}finally{_0x333989['disabled']=![];}}async function purgeStorage(){const _0x33f121=_0x5589d6;if(confirm(_0x33f121(0x1d5))){toastr['info'](_0x33f121(0xbe),'圣旨');const _0x5e815e=await _0x488321['purgeStorage']();_0x5e815e?toastr[_0x33f121(0xc4)](_0x33f121(0x1da),'圣意'):toastr[_0x33f121(0xf5)](_0x33f121(0x20d),'警报'),await updatePanelStatus();}}async function startCondensation(){const _0x2f0233=_0x5589d6,_0x310daa=document[_0x2f0233(0x1c0)]('hly-condensation-results'),_0x71d8a5=_0x310daa[_0x2f0233(0x105)]['finalText'];try{if(_0x71d8a5&&_0x71d8a5[_0x2f0233(0xeb)]()){log(_0x2f0233(0x20f),_0x2f0233(0x11a)),toastr[_0x2f0233(0x11a)](_0x2f0233(0x147),'圣旨'),_0x310daa['textContent']=_0x2f0233(0xdb);const _0x3943fd=await _0x488321['ingestTextToHanlinyuan'](_0x71d8a5);if(_0x3943fd['success'])toastr[_0x2f0233(0xc4)](_0x2f0233(0xff)+_0x3943fd[_0x2f0233(0x161)]+_0x2f0233(0x1f9),_0x2f0233(0x19b)),log(_0x2f0233(0x202)+_0x3943fd[_0x2f0233(0x161)]+_0x2f0233(0x1f9),_0x2f0233(0xc4)),_0x310daa[_0x2f0233(0x151)]=_0x2f0233(0x155)+_0x3943fd[_0x2f0233(0x161)]+_0x2f0233(0x1f9),delete _0x310daa['dataset'][_0x2f0233(0x1eb)];else throw new Error(_0x3943fd[_0x2f0233(0xf5)]||_0x2f0233(0xe9));}else{_0x310daa[_0x2f0233(0x151)]=_0x2f0233(0x1e5),toastr[_0x2f0233(0x11a)](_0x2f0233(0x10c),'圣旨'),log(_0x2f0233(0xd0),_0x2f0233(0x11a));const _0x525e80=_0x488321[_0x2f0233(0x173)]();if(!_0x525e80||_0x525e80[_0x2f0233(0x19e)]===0x0){toastr['warning'](_0x2f0233(0x205),_0x2f0233(0x116)),_0x310daa[_0x2f0233(0x151)]=_0x2f0233(0x1f8);return;}_0x310daa['textContent']=_0x2f0233(0xf6)+_0x525e80[_0x2f0233(0x19e)]+_0x2f0233(0x1fd),toastr[_0x2f0233(0x11a)]('已采集\x20'+_0x525e80[_0x2f0233(0x19e)]+_0x2f0233(0x1fd),_0x2f0233(0x116));const _0x16629e=await _0x488321[_0x2f0233(0xd5)](_0x525e80,log);if(_0x16629e['success'])toastr[_0x2f0233(0xc4)](_0x2f0233(0x155)+_0x16629e['count']+_0x2f0233(0x1f9),_0x2f0233(0x19b)),_0x310daa[_0x2f0233(0x151)]='凝识完成!新增\x20'+_0x16629e['count']+_0x2f0233(0x1f9);else throw new Error(_0x16629e[_0x2f0233(0xf5)]||_0x2f0233(0xe9));}}catch(_0x17c847){console[_0x2f0233(0xf5)]('[翰林院-枢纽]\x20凝识过程发生错误:',_0x17c847),toastr[_0x2f0233(0xf5)]('凝识失败:\x20'+_0x17c847[_0x2f0233(0x1c7)],_0x2f0233(0xef)),_0x310daa['textContent']=_0x2f0233(0x11f)+_0x17c847[_0x2f0233(0x1c7)];}finally{await updatePanelStatus();}}async function loadWorldbookList(){const _0x1ea523=_0x5589d6,_0x281e03=document[_0x1ea523(0x1c0)](_0x1ea523(0x119));if(!_0x281e03)return;try{log(_0x1ea523(0x164),'info');const _0x2e8775=await _0x114fcd[_0x1ea523(0x1dc)]();_0x281e03[_0x1ea523(0xb8)]=_0x1ea523(0xb6);if(_0x2e8775[_0x1ea523(0x19e)]===0x0){_0x281e03[_0x1ea523(0xb8)]=_0x1ea523(0x185);return;}_0x2e8775[_0x1ea523(0x189)](_0x121cdd=>{const _0x45d5c6=_0x1ea523,_0x4e5907=new Option(_0x121cdd,_0x121cdd);_0x281e03[_0x45d5c6(0xca)](_0x4e5907);}),log(_0x1ea523(0x1f0)+_0x2e8775['length']+_0x1ea523(0x206),_0x1ea523(0xc4));}catch(_0x17b2f1){console[_0x1ea523(0xf5)]('[翰林院-枢纽]\x20加载书库列表失败:',_0x17b2f1),log(_0x1ea523(0x1d2)+_0x17b2f1['message'],_0x1ea523(0xf5)),_0x281e03[_0x1ea523(0xb8)]='加载失败';}}async function handleWorldbookSelectionChange(){const _0x4ef148=_0x5589d6,_0x4430a9=document[_0x4ef148(0x1c0)](_0x4ef148(0x119)),_0x229dc8=document[_0x4ef148(0x1c0)](_0x4ef148(0xe0)),_0x2451cd=_0x4430a9['value'];_0x229dc8[_0x4ef148(0xb8)]=_0x4ef148(0x1a5),_0x229dc8[_0x4ef148(0xbb)]=!![];if(!_0x2451cd){_0x229dc8[_0x4ef148(0xb8)]=_0x4ef148(0x191);return;}try{log(_0x4ef148(0x1cf)+_0x2451cd+_0x4ef148(0x152),_0x4ef148(0x11a));const _0x51e653=await _0x114fcd[_0x4ef148(0xb5)](_0x2451cd);_0x229dc8[_0x4ef148(0xb8)]=_0x4ef148(0xba);if(_0x51e653[_0x4ef148(0x19e)]===0x0){_0x229dc8['innerHTML']=_0x4ef148(0x157);return;}_0x51e653[_0x4ef148(0x189)](_0x3a7c63=>{const _0x554d0b=_0x4ef148,_0x1398a4=new Option(_0x3a7c63[_0x554d0b(0x11d)]+_0x554d0b(0x19d)+_0x3a7c63['key']+')',_0x3a7c63[_0x554d0b(0x1d6)]);_0x229dc8[_0x554d0b(0xca)](_0x1398a4);}),log('成功加载\x20'+_0x51e653[_0x4ef148(0x19e)]+_0x4ef148(0x11c),_0x4ef148(0xc4));}catch(_0x5e308d){console['error'](_0x4ef148(0xe4)+_0x2451cd+'》的条目失败:',_0x5e308d),log(_0x4ef148(0x171)+_0x5e308d['message'],_0x4ef148(0xf5)),_0x229dc8[_0x4ef148(0xb8)]='加载失败';}finally{_0x229dc8[_0x4ef148(0xbb)]=![];}}async function startHistoriography(){const _0x143d9c=_0x5589d6,_0x341650=document['getElementById']('hly-hist-select-library')[_0x143d9c(0x194)],_0x91eac3=document[_0x143d9c(0x1c0)]('hly-hist-select-entry')[_0x143d9c(0x194)],_0x15fb01=document[_0x143d9c(0x1c0)]('hly-historiography-results');if(!_0x341650||!_0x91eac3){toastr['warning'](_0x143d9c(0xcf),'圣谕不明');return;}_0x15fb01[_0x143d9c(0x151)]='准备对《'+_0x341650+_0x143d9c(0xfe)+_0x91eac3+_0x143d9c(0x183),toastr['info'](_0x143d9c(0x211),'圣旨'),log('开始对《'+_0x341650+'》-'+_0x91eac3+_0x143d9c(0x1ca),_0x143d9c(0x11a));try{const _0x3e943f=await _0x114fcd[_0x143d9c(0xe3)](_0x341650,_0x91eac3);if(_0x3e943f[_0x143d9c(0xc4)]){const _0x1f3f1b='对《'+_0x341650+_0x143d9c(0x12a)+_0x91eac3+')\x20的编纂任务已完成。';_0x15fb01['textContent']=_0x3e943f[_0x143d9c(0xc1)],toastr['success'](_0x143d9c(0xde),_0x143d9c(0x19b)),log(_0x1f3f1b,_0x143d9c(0xc4));}else throw new Error(_0x3e943f[_0x143d9c(0xf5)]||_0x143d9c(0x1ab));}catch(_0xcaafd3){console[_0x143d9c(0xf5)](_0x143d9c(0x1ee),_0xcaafd3),toastr[_0x143d9c(0xf5)](_0x143d9c(0xfb)+_0xcaafd3[_0x143d9c(0x1c7)],_0x143d9c(0xef)),_0x15fb01[_0x143d9c(0x151)]='编纂失败:\x20'+_0xcaafd3['message'];}}async function showStats(){const _0x4d9f2b=_0x5589d6;try{log(_0x4d9f2b(0xd2),_0x4d9f2b(0x11a)),toastr[_0x4d9f2b(0x11a)]('正在查询宝库状态...','圣旨');const _0x156b70=await _0x488321[_0x4d9f2b(0x1bd)](),_0x56122e=_0x488321[_0x4d9f2b(0x17c)](),_0x39e6e6=_0x488321['getSettings'](),_0x343c1d=_0x4d9f2b(0xc6)+_0x56122e+_0x4d9f2b(0x1a9)+_0x156b70+_0x4d9f2b(0xcb)+_0x39e6e6[_0x4d9f2b(0x158)][_0x4d9f2b(0xbf)]+'\x0a所用模型:\x20'+_0x39e6e6['retrieval'][_0x4d9f2b(0x1f5)]+_0x4d9f2b(0x1a1);toastr[_0x4d9f2b(0x11a)](_0x343c1d,_0x4d9f2b(0x195),{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log(_0x4d9f2b(0xd1)+_0x56122e+',\x20忆识总数='+_0x156b70,_0x4d9f2b(0xc4));}catch(_0x38b6b7){console[_0x4d9f2b(0xf5)]('[翰林院-枢纽]\x20查询宝库状态失败:',_0x38b6b7),toastr[_0x4d9f2b(0xf5)](_0x4d9f2b(0x104)+_0x38b6b7[_0x4d9f2b(0x1c7)],_0x4d9f2b(0xef)),log(_0x4d9f2b(0x104)+_0x38b6b7[_0x4d9f2b(0x1c7)],_0x4d9f2b(0xf5));}}function showExclusionRulesModal(){const _0x55671f=_0x5589d6,_0x56a266=_0x488321['getSettings'](),_0xb366ad=_0x56a266[_0x55671f(0x1d8)]['exclusionRules']||[],_0xc89ef=(_0x4bef0f={'start':'','end':''},_0x387458)=>_0x55671f(0xdd)+_0x387458+_0x55671f(0x1b4)+_0x4bef0f[_0x55671f(0x14a)]+'\x22\x20placeholder=\x22开始字符,\x20如\x20`。

\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','正在处理您确认后的文书...','fas\x20fa-lock-open','请先选择一个\x20.txt\x20文件','getCharacterName','%。是否从上次中断之处继续?','\x20楼。

','boolean','querySelector','[自动保存]\x20设置项\x20\x27','input[name=\x22','hly-modal-container','编纂失败:\x20','includes','请选择一个书库...','20914780lXPODl','maxResults','1733752eCckeq','innerHTML',']\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','toLocaleTimeString','\x20楼到第\x20','success','textContent','radio','hly-tag-input-container','text','hly-current-vector-count','toggleSessionLock','end','change','showHLYStats','hly-current-chat-id','top_n','\x20楼到\x20','正在处理预览后的文本...','previewHLYCondensation','[翰林院-枢纽]\x20加载《','8470422uHcNGU','[断点续传]\x20用户选择继续任务\x20','任务完成!成功录入\x20','startHLYHistoriography','value','\x0a\x20\x20\x20\x20\x20\x20\x20\x20','未找到符合条件的消息。','\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','log-warn','[翰林院-枢纽]\x20查询宝库状态失败:','hly-layer-start','chat_history','[翰林院-枢纽]\x20预览过程发生错误:','string','宝库已清空。','fa-check-circle','querySelectorAll','resetSettings','hly-rerank-enabled','\x20楼已成功凝识,新增\x20','dataset','model','trim','flex','log-success','\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\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第\x20','remove','hly-tag-input','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨!','[翰林院-枢纽]\x20获取Rerank模型列表失败:','大功告成','17700rmiYMk','selectedIndex','chat','ingestHLYManualText','scrollTop','fas\x20fa-lock','','disabled','fetchRerankModels','position','injection','novel','N/A','hly-exclusion-rules-container','hly-layer-end','任务已由用户中止。进度已保存,可随时继续。','azure','integer','手动录入成功,新增\x20','hly-api-endpoint','info','预览内容已更新,可随时开始凝识。','hly-rerank-api-key','hly-tag-extraction-toggle','\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20','processedChunks','\x22>\x20[','classList','正在加载条目...','33573LNoKYH','map','\x20个条目。','mes','宝库状态','\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','embeddingModel','hly-exclusion-rules-btn','checkbox','appendChild','','正在查询宝库状态...','[断点续传]\x20用户选择放弃旧任务\x20','根据当前勾选条件,未找到符合的消息可供预览。','hly-condensation-results','加载失败','会话已解锁。','','任务已中止。','layerEnd','hly-log-entry\x20','》中的条目【','getSettings','14ReKvRH','hanlinyuan-ingest-novel-file-name','split','filter','hly-hist-select-entry','正在处理您提交的文书...','已采集\x20','display','正在测试神力连接...','\x20块继续录入。','\x20条忆识。','total','isSessionLocked','target','解锁会话','input[name=\x22hly-injection-position\x22]','manual','会话已锁定','启禀大人,发现此书上次录入已完成\x20','正在为《','查询宝库状态失败:\x20','\x20进行编纂...','无法获取总数:\x20','purgeHLYStorage'];_0x5b11=function(){return _0x3f8e46;};return _0x5b11();}function _0x2981(_0x2fd9ad,_0x5240f0){const _0x5b1183=_0x5b11();return _0x2981=function(_0x2981cf,_0x4d8d06){_0x2981cf=_0x2981cf-0x1bc;let _0x4ebd42=_0x5b1183[_0x2981cf];return _0x4ebd42;},_0x2981(_0x2fd9ad,_0x5240f0);}function setupGlobalEventHandlers(){const _0x94533=_0x2981;window[_0x94533(0x331)]=()=>saveSettingsFromUI(![]),window[_0x94533(0x257)]=resetSettingsToUI,window[_0x94533(0x251)]=testApi,window['fetchHLYEmbeddingModels']=fetchHLYEmbeddingModels,window[_0x94533(0x317)]=fetchHLYRerankModels,window[_0x94533(0x25a)]=updatePanelStatus,window[_0x94533(0x221)]=purgeStorage,window['startHLYCondensation']=startCondensation,window[_0x94533(0x2e7)]=previewCondensation,window[_0x94533(0x1d9)]=ingestManualText,window[_0x94533(0x2a9)]=log,window[_0x94533(0x2e2)]=showStats,window[_0x94533(0x2ec)]=startHistoriography;}function updateAndSaveSetting(_0x128b1e,_0x32f430){const _0x19d092=_0x2981,_0x53e5d5=_0x3832bd[_0x19d092(0x209)]();if(!_0x53e5d5)return;const _0x31a166=_0x128b1e[_0x19d092(0x20c)]('.');let _0x5a75bb=_0x53e5d5;for(let _0xcf3595=0x0;_0xcf3595<_0x31a166[_0x19d092(0x228)]-0x1;_0xcf3595++){_0x5a75bb=_0x5a75bb[_0x31a166[_0xcf3595]]=_0x5a75bb[_0x31a166[_0xcf3595]]||{};}_0x5a75bb[_0x31a166[_0x31a166['length']-0x1]]=_0x32f430,_0x3832bd[_0x19d092(0x302)](),log(_0x19d092(0x2cc)+_0x128b1e+'\x27\x20已更新为:\x20'+JSON[_0x19d092(0x308)](_0x32f430),_0x19d092(0x2d9));}function bindAutoSaveEvents(){const _0x4f9ee0=_0x2981,_0x2d8337=document[_0x4f9ee0(0x263)](_0x4f9ee0(0x2ce));if(!_0x2d8337)return;_0x2d8337['addEventListener'](_0x4f9ee0(0x2e1),_0x58ed8a=>{const _0x306b8d=_0x4f9ee0,_0x5b4d5a=_0x58ed8a[_0x306b8d(0x217)],_0x14eb9d=_0x5b4d5a[_0x306b8d(0x1cb)]['settingKey'];if(!_0x14eb9d)return;let _0x21ebac;const _0x2b05a7=_0x5b4d5a[_0x306b8d(0x1cb)][_0x306b8d(0x25f)]||_0x306b8d(0x1c4);if(_0x5b4d5a[_0x306b8d(0x25f)]==='checkbox')_0x21ebac=_0x5b4d5a[_0x306b8d(0x298)];else{if(_0x5b4d5a['type']===_0x306b8d(0x2db)){if(_0x5b4d5a[_0x306b8d(0x298)]){const _0x1a7c36=_0x2d8337[_0x306b8d(0x1c7)](_0x306b8d(0x2cd)+_0x5b4d5a['name']+'\x22]'),_0x53d5db=Array['from'](_0x1a7c36)[_0x306b8d(0x256)](_0x5cc530=>_0x5cc530[_0x306b8d(0x298)]);_0x21ebac=_0x53d5db[_0x306b8d(0x2ed)];}else return;}else _0x21ebac=_0x5b4d5a[_0x306b8d(0x2ed)];}switch(_0x2b05a7){case _0x306b8d(0x1e7):_0x21ebac=parseInt(_0x21ebac,0xa);break;case'float':_0x21ebac=parseFloat(_0x21ebac);break;case'boolean':typeof _0x21ebac!==_0x306b8d(0x2ca)&&(_0x21ebac=_0x21ebac==='true');break;}if(_0x5b4d5a[_0x306b8d(0x25f)]===_0x306b8d(0x2db)&&!_0x5b4d5a['checked'])return;updateAndSaveSetting(_0x14eb9d,_0x21ebac);});}export function bindHanlinyuanEvents(){const _0x3d95e0=_0x2981,_0x177a73=getContext();if(!_0x177a73){console[_0x3d95e0(0x303)](_0x3d95e0(0x24e));return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents(),bindTutorialEvents(),bindAutoSaveEvents(),bindSessionLockEvent();if(_0x3832bd[_0x3d95e0(0x31d)])_0x3832bd['initialize']();else{console[_0x3d95e0(0x303)](_0x3d95e0(0x1d3));return;}loadSettingsToUI(),loadWorldbookList(),log(_0x3d95e0(0x22a),_0x3d95e0(0x1ea));const _0x2e24c7=document[_0x3d95e0(0x263)](_0x3d95e0(0x25b)),_0x5b475a=document['getElementById'](_0x3d95e0(0x20b)),_0x1ccd2f=document[_0x3d95e0(0x263)](_0x3d95e0(0x27a)),_0x5dfec9=document[_0x3d95e0(0x263)](_0x3d95e0(0x264)),_0x3fca0d=document['getElementById'](_0x3d95e0(0x299)),_0x33e2c8=document[_0x3d95e0(0x263)](_0x3d95e0(0x279)),_0x3f4ed4=document[_0x3d95e0(0x263)](_0x3d95e0(0x26d)),_0x40a23a=document['getElementById'](_0x3d95e0(0x291));let _0x23bcd0=null,_0x2fa2c1=null;_0x2e24c7[_0x3d95e0(0x325)]('change',_0x49c286=>{const _0x4fd7c3=_0x3d95e0;_0x23bcd0=_0x49c286['target'][_0x4fd7c3(0x333)][0x0],_0x23bcd0?(_0x5b475a[_0x4fd7c3(0x2da)]=_0x23bcd0[_0x4fd7c3(0x274)],_0x5b475a['title']=_0x23bcd0[_0x4fd7c3(0x274)]):_0x5b475a[_0x4fd7c3(0x2da)]=_0x4fd7c3(0x269);}),_0x1ccd2f['addEventListener'](_0x3d95e0(0x2b6),async()=>{const _0x4077bb=_0x3d95e0;if(!_0x23bcd0){toastr[_0x4077bb(0x23b)](_0x4077bb(0x2c6));return;}let _0x154685=0x0;const _0x35d13e=_0x3c7547[_0x4077bb(0x226)](_0x23bcd0),_0x5a0f55=_0x3c7547[_0x4077bb(0x2fd)](_0x35d13e);if(_0x5a0f55){const _0x5510e8=(_0x5a0f55['processedChunks']/_0x5a0f55[_0x4077bb(0x227)]*0x64)[_0x4077bb(0x24a)](0x1),_0x37af5b=confirm(_0x4077bb(0x21c)+_0x5510e8+_0x4077bb(0x2c8));_0x37af5b?(_0x154685=_0x5a0f55[_0x4077bb(0x1ef)],toastr[_0x4077bb(0x1ea)](_0x4077bb(0x260)+(_0x154685+0x1)+_0x4077bb(0x213),'圣旨已达'),log(_0x4077bb(0x2ea)+_0x35d13e+_0x4077bb(0x31f)+_0x154685+_0x4077bb(0x2a3),'info')):(_0x3c7547[_0x4077bb(0x2ad)](_0x35d13e),toastr['info'](_0x4077bb(0x267),_0x4077bb(0x2f8)),log(_0x4077bb(0x1ff)+_0x35d13e+_0x4077bb(0x2ef),_0x4077bb(0x284)));}_0x2fa2c1=new AbortController();const _0x79a92a=_0x2fa2c1[_0x4077bb(0x311)];_0x40a23a[_0x4077bb(0x2f2)]['display']=_0x4077bb(0x300),_0x3fca0d[_0x4077bb(0x2f2)][_0x4077bb(0x211)]=_0x4077bb(0x223),_0x3f4ed4[_0x4077bb(0x2da)]=_0x4077bb(0x289),_0x33e2c8[_0x4077bb(0x2ed)]=0x0;try{const _0x42e49f=await _0x23bcd0[_0x4077bb(0x2dd)](),_0x334712=_0x1bf23c=>{const _0x2f0e2a=_0x4077bb;_0x3f4ed4[_0x2f0e2a(0x2da)]=_0x2f0e2a(0x280)+_0x1bf23c['message']+'\x20('+_0x1bf23c[_0x2f0e2a(0x27f)]+'/'+_0x1bf23c[_0x2f0e2a(0x215)]+')',_0x33e2c8[_0x2f0e2a(0x2ed)]=_0x1bf23c[_0x2f0e2a(0x27f)]/_0x1bf23c[_0x2f0e2a(0x215)]*0x64;},_0x587393=()=>{const _0x4ad81b=_0x4077bb;updatePanelStatus(),log(_0x4ad81b(0x304),_0x4ad81b(0x1ea));},_0x444c39=await _0x3832bd[_0x4077bb(0x26a)](_0x42e49f,_0x4077bb(0x1e1),_0x23bcd0[_0x4077bb(0x274)],_0x334712,_0x79a92a,log,_0x587393,_0x35d13e,_0x154685);if(_0x444c39[_0x4077bb(0x2d9)])toastr[_0x4077bb(0x2d9)]('成功录入\x20'+_0x444c39['count']+_0x4077bb(0x32b)),_0x3f4ed4[_0x4077bb(0x2da)]=_0x4077bb(0x2eb)+_0x444c39[_0x4077bb(0x26c)]+_0x4077bb(0x287),_0x33e2c8[_0x4077bb(0x2ed)]=0x64,updatePanelStatus();else throw new Error(_0x444c39[_0x4077bb(0x303)]||_0x4077bb(0x2a0));}catch(_0x152395){_0x152395[_0x4077bb(0x274)]===_0x4077bb(0x238)?(toastr[_0x4077bb(0x1ea)](_0x4077bb(0x1e5)),_0x3f4ed4['textContent']=_0x4077bb(0x205)):(toastr[_0x4077bb(0x303)]('录入失败:\x20'+_0x152395['message']+'。进度已保存,可稍后重试。'),_0x3f4ed4[_0x4077bb(0x2da)]=_0x4077bb(0x254)+_0x152395[_0x4077bb(0x252)]);}finally{setTimeout(()=>{const _0x40e833=_0x4077bb;_0x40a23a[_0x40e833(0x2f2)]['display']=_0x40e833(0x1ce),_0x3fca0d['style'][_0x40e833(0x211)]=_0x40e833(0x300),_0x2e24c7[_0x40e833(0x2ed)]='',_0x23bcd0=null,_0x5b475a['textContent']=_0x40e833(0x269);},0xbb8);}}),_0x5dfec9[_0x3d95e0(0x325)](_0x3d95e0(0x2b6),()=>{const _0x22c2c6=_0x3d95e0;_0x2fa2c1&&_0x2fa2c1[_0x22c2c6(0x2bd)]();});}function bindSessionLockEvent(){const _0x473160=_0x2981,_0x595a5e=document[_0x473160(0x263)](_0x473160(0x2b1));if(!_0x595a5e)return;_0x595a5e[_0x473160(0x325)]('click',()=>{const _0x122602=_0x473160,_0x2b0e0e=_0x3832bd[_0x122602(0x2df)]();updateSessionLockUI(_0x2b0e0e);if(_0x2b0e0e){const _0x578441=_0x3832bd[_0x122602(0x2fe)]();toastr[_0x122602(0x2d9)](_0x122602(0x2ae)+_0x578441['id'],'圣旨已下'),log(_0x122602(0x24f)+_0x578441['id'],_0x122602(0x2d9));}else toastr[_0x122602(0x1ea)]('会话已解锁,将跟随当前角色。','诏曰'),log(_0x122602(0x203),_0x122602(0x1ea));updatePanelStatus();}),updateSessionLockUI(_0x3832bd['isSessionLocked']());}function updateSessionLockUI(_0x212748){const _0x5bdcf7=_0x2981,_0x311c18=document[_0x5bdcf7(0x263)](_0x5bdcf7(0x2b1));if(!_0x311c18)return;const _0xfdebb9=_0x311c18[_0x5bdcf7(0x2cb)]('i'),_0x163d6d=_0x311c18[_0x5bdcf7(0x2cb)](_0x5bdcf7(0x23e));_0x212748?(_0x311c18[_0x5bdcf7(0x1f1)][_0x5bdcf7(0x313)](_0x5bdcf7(0x32e)),_0xfdebb9[_0x5bdcf7(0x32f)]=_0x5bdcf7(0x1db),_0x163d6d['textContent']=_0x5bdcf7(0x218),_0x311c18['title']=_0x5bdcf7(0x301)):(_0x311c18[_0x5bdcf7(0x1f1)][_0x5bdcf7(0x1d1)](_0x5bdcf7(0x32e)),_0xfdebb9[_0x5bdcf7(0x32f)]=_0x5bdcf7(0x2c5),_0x163d6d[_0x5bdcf7(0x2da)]='锁定会话',_0x311c18[_0x5bdcf7(0x26e)]=_0x5bdcf7(0x24b));}function bindPanelToggleEvents(){const _0x203b43=_0x2981,_0x12e14f=document['getElementById'](_0x203b43(0x26b));if(_0x12e14f){}}function bindTutorialEvents(){const _0x2408d6=_0x2981,_0x432c34=document[_0x2408d6(0x263)]('amily2_open_hanlin_tutorial');_0x432c34&&_0x432c34[_0x2408d6(0x325)](_0x2408d6(0x2b6),()=>{const _0x4cebdb=_0x2408d6;showContentModal(_0x4cebdb(0x277),_0x4cebdb(0x320));});}function bindInternalUIEvents(){const _0x235711=_0x2981,_0x15e3d8=document[_0x235711(0x1c7)](_0x235711(0x2f1));_0x15e3d8[_0x235711(0x296)](_0x49c270=>{const _0x4ee631=_0x235711;_0x49c270[_0x4ee631(0x325)](_0x4ee631(0x2b6),()=>{const _0x527539=_0x4ee631,_0x1a1ad8=_0x49c270['dataset'][_0x527539(0x329)],_0x1b90c8='hly-'+_0x1a1ad8+_0x527539(0x258);document[_0x527539(0x1c7)](_0x527539(0x224))[_0x527539(0x296)](_0x418a0e=>{const _0x486e82=_0x527539;_0x418a0e[_0x486e82(0x1f1)]['toggle'](_0x486e82(0x32e),_0x418a0e['id']===_0x1b90c8);}),_0x15e3d8[_0x527539(0x296)](_0x1b1cc9=>_0x1b1cc9[_0x527539(0x1f1)]['toggle'](_0x527539(0x32e),_0x1b1cc9===_0x49c270));});});const _0x1a2327=document[_0x235711(0x263)](_0x235711(0x1e9));_0x1a2327&&_0x1a2327['addEventListener'](_0x235711(0x2e1),toggleCustomEndpointDocket);const _0x31d3f9=document[_0x235711(0x1c7)](_0x235711(0x219));_0x31d3f9[_0x235711(0x296)](_0x4a57d7=>{const _0x326e99=_0x235711;_0x4a57d7['addEventListener'](_0x326e99(0x2e1),toggleInjectionDetails);});const _0x997cd8=document[_0x235711(0x263)](_0x235711(0x1ed)),_0x208641=document[_0x235711(0x263)](_0x235711(0x2dc));_0x997cd8&&_0x208641&&_0x997cd8[_0x235711(0x325)](_0x235711(0x2e1),()=>{const _0x5c355f=_0x235711;_0x208641[_0x5c355f(0x2f2)][_0x5c355f(0x211)]=_0x997cd8[_0x5c355f(0x298)]?_0x5c355f(0x223):_0x5c355f(0x300);});const _0x5a8994=document[_0x235711(0x263)](_0x235711(0x2a5));_0x5a8994&&_0x5a8994[_0x235711(0x325)](_0x235711(0x2e1),handleWorldbookSelectionChange);const _0x462dab=document[_0x235711(0x263)](_0x235711(0x1fa));_0x462dab&&_0x462dab['addEventListener']('click',showExclusionRulesModal);}function toggleInjectionDetails(){const _0x195821=_0x2981,_0x386182=document['querySelector'](_0x195821(0x2a7))[_0x195821(0x2ed)],_0x102adc=document[_0x195821(0x263)]('hly-injection-depth'),_0x52de11=document[_0x195821(0x263)](_0x195821(0x22d)),_0x425373=_0x386182==='1';_0x102adc[_0x195821(0x1dd)]=!_0x425373,_0x52de11[_0x195821(0x1dd)]=!_0x425373;}function toggleCustomEndpointDocket(){const _0x3a4a5a=_0x2981,_0x148473=document[_0x3a4a5a(0x263)](_0x3a4a5a(0x1e9))[_0x3a4a5a(0x2ed)],_0x24fa45=document[_0x3a4a5a(0x263)](_0x3a4a5a(0x247));_0x24fa45&&(_0x24fa45[_0x3a4a5a(0x2f2)][_0x3a4a5a(0x211)]=_0x148473==='custom'||_0x148473===_0x3a4a5a(0x1e6)?_0x3a4a5a(0x223):_0x3a4a5a(0x300));}function loadSettingsToUI(){const _0x244f12=_0x2981,_0x159259=_0x3832bd[_0x244f12(0x209)]();if(!_0x159259)return;document[_0x244f12(0x263)]('hly-retrieval-enabled')[_0x244f12(0x298)]=_0x159259[_0x244f12(0x2b3)][_0x244f12(0x30b)],document['getElementById'](_0x244f12(0x1e9))['value']=_0x159259[_0x244f12(0x2b3)][_0x244f12(0x2be)],document[_0x244f12(0x263)](_0x244f12(0x2c0))['value']=_0x159259[_0x244f12(0x2b3)]['customApiUrl'],document[_0x244f12(0x263)]('hly-api-key')[_0x244f12(0x2ed)]=_0x159259['retrieval'][_0x244f12(0x2b0)];const _0x45af1d=document[_0x244f12(0x263)](_0x244f12(0x22f));if(_0x45af1d[_0x244f12(0x22b)][_0x244f12(0x228)]===0x0){const _0x40b0e7=_0x159259['retrieval']['embeddingModel'],_0x5ef21c=new Option(_0x40b0e7,_0x40b0e7,!![],!![]);_0x45af1d[_0x244f12(0x313)](_0x5ef21c);}_0x45af1d[_0x244f12(0x2ed)]=_0x159259['retrieval']['embeddingModel'],document[_0x244f12(0x263)]('hly-retrieval-notify')[_0x244f12(0x298)]=_0x159259[_0x244f12(0x2b3)]['notify'],document[_0x244f12(0x263)]('hly-chunk-size')[_0x244f12(0x2ed)]=_0x159259['advanced'][_0x244f12(0x2ac)],document[_0x244f12(0x263)](_0x244f12(0x276))[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x270)][_0x244f12(0x315)],document['getElementById'](_0x244f12(0x253))[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x270)][_0x244f12(0x261)],document['getElementById']('hly-query-message-count')[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x270)][_0x244f12(0x2a4)],document['getElementById']('hly-max-results')[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x270)][_0x244f12(0x2d3)],document[_0x244f12(0x263)](_0x244f12(0x250))[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x2b3)][_0x244f12(0x235)],document[_0x244f12(0x263)](_0x244f12(0x237))[_0x244f12(0x2ed)]=_0x159259['injection']['template'];const _0x4859d3=document['querySelector'](_0x244f12(0x297)+_0x159259[_0x244f12(0x1e0)][_0x244f12(0x1df)]+'\x22]');_0x4859d3&&(_0x4859d3['checked']=!![]);document[_0x244f12(0x263)](_0x244f12(0x233))[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x1e0)][_0x244f12(0x232)],document[_0x244f12(0x263)](_0x244f12(0x22d))['value']=_0x159259[_0x244f12(0x1e0)][_0x244f12(0x282)],toggleInjectionDetails(),document[_0x244f12(0x263)]('hly-condensation-enabled')[_0x244f12(0x298)]=_0x159259['condensation']['enabled'],document[_0x244f12(0x263)]('hly-layer-start')[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x28d)][_0x244f12(0x273)],document['getElementById']('hly-layer-end')[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x28d)][_0x244f12(0x206)],document[_0x244f12(0x263)](_0x244f12(0x32a))[_0x244f12(0x298)]=_0x159259[_0x244f12(0x28d)]['messageTypes'][_0x244f12(0x2ab)],document[_0x244f12(0x263)](_0x244f12(0x2b7))[_0x244f12(0x298)]=_0x159259['condensation'][_0x244f12(0x29b)]['ai'];const _0x3ebc92=document[_0x244f12(0x263)]('hly-tag-extraction-toggle'),_0x1bc81a=document[_0x244f12(0x263)](_0x244f12(0x1d2)),_0x4c0d23=document[_0x244f12(0x263)](_0x244f12(0x2dc));_0x3ebc92[_0x244f12(0x298)]=_0x159259['condensation']['tagExtractionEnabled'],_0x1bc81a[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x28d)][_0x244f12(0x2bc)],_0x4c0d23['style'][_0x244f12(0x211)]=_0x3ebc92[_0x244f12(0x298)]?_0x244f12(0x223):_0x244f12(0x300),document[_0x244f12(0x263)](_0x244f12(0x1c9))[_0x244f12(0x298)]=_0x159259[_0x244f12(0x288)][_0x244f12(0x30b)],document[_0x244f12(0x263)]('hly-rerank-url')[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x288)]['url'],document['getElementById'](_0x244f12(0x1ec))[_0x244f12(0x2ed)]=_0x159259['rerank'][_0x244f12(0x2b0)];const _0x476f3d=document[_0x244f12(0x263)](_0x244f12(0x243));if(_0x476f3d[_0x244f12(0x22b)][_0x244f12(0x228)]===0x0){const _0x3602d4=_0x159259[_0x244f12(0x288)][_0x244f12(0x1cc)];if(_0x3602d4){const _0x3e39e4=new Option(_0x3602d4,_0x3602d4,!![],!![]);_0x476f3d[_0x244f12(0x313)](_0x3e39e4);}}_0x476f3d['value']=_0x159259[_0x244f12(0x288)][_0x244f12(0x1cc)],document[_0x244f12(0x263)](_0x244f12(0x30e))[_0x244f12(0x2ed)]=_0x159259[_0x244f12(0x288)][_0x244f12(0x2e4)],document['getElementById'](_0x244f12(0x2fb))['value']=_0x159259[_0x244f12(0x288)]['hybrid_alpha'],document['getElementById']('hly-rerank-notify')['checked']=_0x159259[_0x244f12(0x288)][_0x244f12(0x328)],toggleCustomEndpointDocket();}function saveSettingsFromUI(_0x4f579f=!![]){const _0x11f494=_0x2981,_0x6e13ef=document[_0x11f494(0x263)](_0x11f494(0x2ce));if(!_0x6e13ef)return;const _0x40df85=_0x6e13ef[_0x11f494(0x1c7)](_0x11f494(0x2bf));_0x40df85['forEach'](_0x47b681=>{const _0x70f6e=_0x11f494,_0xcc24b1=_0x47b681['dataset'][_0x70f6e(0x306)];if(!_0xcc24b1)return;let _0x3b2ff3;const _0x382c8b=_0x47b681['dataset'][_0x70f6e(0x25f)]||_0x70f6e(0x1c4);if(_0x47b681['type']===_0x70f6e(0x1fb))_0x3b2ff3=_0x47b681[_0x70f6e(0x298)];else{if(_0x47b681[_0x70f6e(0x25f)]===_0x70f6e(0x2db)){if(!_0x47b681['checked'])return;_0x3b2ff3=_0x47b681[_0x70f6e(0x2ed)];}else _0x3b2ff3=_0x47b681[_0x70f6e(0x2ed)];}switch(_0x382c8b){case _0x70f6e(0x1e7):_0x3b2ff3=parseInt(_0x3b2ff3,0xa);break;case _0x70f6e(0x293):_0x3b2ff3=parseFloat(_0x3b2ff3);break;case _0x70f6e(0x2ca):if(typeof _0x3b2ff3!==_0x70f6e(0x2ca))_0x3b2ff3=_0x3b2ff3===_0x70f6e(0x283);break;}const _0x2eae78=_0x3832bd['getSettings'](),_0x491c0f=_0xcc24b1[_0x70f6e(0x20c)]('.');let _0x3ba902=_0x2eae78;for(let _0x25eebe=0x0;_0x25eebe<_0x491c0f[_0x70f6e(0x228)]-0x1;_0x25eebe++){_0x3ba902=_0x3ba902[_0x491c0f[_0x25eebe]]=_0x3ba902[_0x491c0f[_0x25eebe]]||{};}_0x3ba902[_0x491c0f[_0x491c0f[_0x70f6e(0x228)]-0x1]]=_0x3b2ff3;}),_0x3832bd[_0x11f494(0x302)](),!_0x4f579f&&(log(_0x11f494(0x332),'success'),toastr[_0x11f494(0x2d9)](_0x11f494(0x268),_0x11f494(0x2f8)));}function resetSettingsToUI(){const _0x2ba17f=_0x2981;confirm('您确定要将所有设定恢复为出厂默认值吗?')&&(_0x3832bd[_0x2ba17f(0x1c8)](),loadSettingsToUI(),toastr['info'](_0x2ba17f(0x281),'诏曰'));}async function updatePanelStatus(){const _0x37e132=_0x2981,_0x3d3d0a=_0x3832bd[_0x37e132(0x216)](),_0x3ae30f=document[_0x37e132(0x263)](_0x37e132(0x246)),_0x65e864=document['getElementById'](_0x37e132(0x2e3));if(_0x3d3d0a){const _0x184a2d=_0x3832bd[_0x37e132(0x2fe)]();_0x3ae30f[_0x37e132(0x2da)]=_0x37e132(0x21b),_0x65e864['textContent']=_0x184a2d['id'],_0x65e864[_0x37e132(0x26e)]=_0x37e132(0x2a1)+_0x184a2d['id'],_0x3ae30f[_0x37e132(0x1f1)]['add'](_0x37e132(0x259)),_0x65e864[_0x37e132(0x1f1)]['add']('hly-locked-status');}else _0x3ae30f[_0x37e132(0x2da)]=_0x523f73[_0x37e132(0x2c7)](),_0x65e864[_0x37e132(0x2da)]=_0x523f73['getChatId']()||'无',_0x65e864['title']='',_0x3ae30f[_0x37e132(0x1f1)][_0x37e132(0x1d1)]('hly-locked-status'),_0x65e864[_0x37e132(0x1f1)]['remove']('hly-locked-status');const _0x44eeb2=document[_0x37e132(0x263)](_0x37e132(0x2de));_0x44eeb2[_0x37e132(0x2da)]='...';try{const _0x5bfa86=await _0x3832bd[_0x37e132(0x248)]();_0x44eeb2['textContent']=_0x5bfa86;}catch(_0x548441){console['error'](_0x37e132(0x324),_0x548441),_0x44eeb2[_0x37e132(0x2da)]=_0x37e132(0x1e2),_0x44eeb2[_0x37e132(0x26e)]=_0x37e132(0x220)+_0x548441['message'];}const _0x42f4e8=document[_0x37e132(0x263)](_0x37e132(0x201));if(_0x42f4e8&&!_0x42f4e8[_0x37e132(0x1cb)][_0x37e132(0x236)]){const _0x1371a5=_0x3832bd[_0x37e132(0x209)](),_0x21c351=_0x3832bd[_0x37e132(0x31e)]();if(_0x1371a5[_0x37e132(0x2a6)]&&_0x1371a5[_0x37e132(0x2a6)][_0x21c351]){const _0x27c6bd=_0x1371a5[_0x37e132(0x2a6)][_0x21c351];_0x42f4e8[_0x37e132(0x2d5)]=_0x37e132(0x2c1)+_0x27c6bd[_0x37e132(0x29a)]+'\x20楼凝识至第\x20'+_0x27c6bd[_0x37e132(0x2e0)]+_0x37e132(0x2c9);}else _0x42f4e8[_0x37e132(0x2d5)]=_0x37e132(0x24d);}}async function testApi(){const _0x36ae09=_0x2981;toastr[_0x36ae09(0x1ea)](_0x36ae09(0x212),'圣旨');try{await _0x3832bd[_0x36ae09(0x2f4)](),toastr['success'](_0x36ae09(0x309),'圣意');}catch(_0x2c231b){toastr['error'](_0x36ae09(0x285)+_0x2c231b['message'],'警报');}}async function fetchHLYEmbeddingModels(){const _0x28a4c7=_0x2981,_0x1a0b83=document[_0x28a4c7(0x263)](_0x28a4c7(0x22f)),_0x49fdfa=_0x1a0b83[_0x28a4c7(0x2ed)];_0x1a0b83[_0x28a4c7(0x2d5)]='',_0x1a0b83[_0x28a4c7(0x1dd)]=!![];try{log(_0x28a4c7(0x23f),_0x28a4c7(0x1ea));const _0x34ca44=await _0x3832bd['fetchEmbeddingModels']();_0x1a0b83[_0x28a4c7(0x2d5)]='';if(_0x34ca44['length']===0x0){_0x1a0b83[_0x28a4c7(0x2d5)]=_0x28a4c7(0x1fd),toastr[_0x28a4c7(0x284)]('未能获取到任何模型。',_0x28a4c7(0x2b9)),log(_0x28a4c7(0x23a),_0x28a4c7(0x284));return;}_0x34ca44[_0x28a4c7(0x296)](_0x1a4813=>{const _0x29f674=new Option(_0x1a4813,_0x1a4813);_0x1a0b83['add'](_0x29f674);}),_0x34ca44[_0x28a4c7(0x2d0)](_0x49fdfa)?_0x1a0b83['value']=_0x49fdfa:_0x1a0b83['selectedIndex']=0x0,toastr[_0x28a4c7(0x2d9)](_0x28a4c7(0x326)+_0x34ca44[_0x28a4c7(0x228)]+_0x28a4c7(0x30c),'圣意'),log('成功获取\x20'+_0x34ca44[_0x28a4c7(0x228)]+'\x20个模型。','success');}catch(_0x4dd7e4){console[_0x28a4c7(0x303)]('[翰林院-枢纽]\x20获取模型列表失败:',_0x4dd7e4),toastr[_0x28a4c7(0x303)]('获取模型失败:\x20'+_0x4dd7e4[_0x28a4c7(0x252)],_0x28a4c7(0x2b4)),log(_0x28a4c7(0x230)+_0x4dd7e4['message'],_0x28a4c7(0x303)),_0x1a0b83[_0x28a4c7(0x2d5)]=_0x28a4c7(0x2a2);}finally{_0x1a0b83['disabled']=![];}}async function fetchHLYRerankModels(){const _0x1d8c91=_0x2981,_0x2fb56e=document['getElementById'](_0x1d8c91(0x243)),_0x5e53b6=_0x2fb56e[_0x1d8c91(0x2ed)];_0x2fb56e[_0x1d8c91(0x2d5)]=_0x1d8c91(0x1dc),_0x2fb56e['disabled']=!![];try{log('开始获取Rerank模型列表...',_0x1d8c91(0x1ea));const _0x5813c5=await _0x3832bd[_0x1d8c91(0x1de)]();_0x2fb56e[_0x1d8c91(0x2d5)]='';if(_0x5813c5[_0x1d8c91(0x228)]===0x0){_0x2fb56e[_0x1d8c91(0x2d5)]='',toastr[_0x1d8c91(0x284)](_0x1d8c91(0x307),'翰林院启奏'),log(_0x1d8c91(0x307),_0x1d8c91(0x284));return;}_0x5813c5[_0x1d8c91(0x296)](_0x5d21bc=>{const _0x487967=new Option(_0x5d21bc,_0x5d21bc);_0x2fb56e['add'](_0x487967);}),_0x5813c5[_0x1d8c91(0x2d0)](_0x5e53b6)?_0x2fb56e[_0x1d8c91(0x2ed)]=_0x5e53b6:_0x2fb56e['selectedIndex']=0x0,toastr['success']('成功获取\x20'+_0x5813c5['length']+_0x1d8c91(0x266),'圣意'),log(_0x1d8c91(0x326)+_0x5813c5[_0x1d8c91(0x228)]+_0x1d8c91(0x266),_0x1d8c91(0x2d9));}catch(_0x346faf){console[_0x1d8c91(0x303)](_0x1d8c91(0x1d4),_0x346faf),toastr['error'](_0x1d8c91(0x31a)+_0x346faf['message'],_0x1d8c91(0x2b4)),log('获取Rerank模型失败:\x20'+_0x346faf[_0x1d8c91(0x252)],_0x1d8c91(0x303)),_0x2fb56e['innerHTML']='';}finally{_0x2fb56e[_0x1d8c91(0x1dd)]=![];}}async function purgeStorage(){const _0x571f95=_0x2981;if(confirm('此操作将彻底清空当前角色的所有忆识(向量),且无法恢复。您确定要继续吗?')){toastr[_0x571f95(0x1ea)]('正在清空宝库...','圣旨');const _0xd8e3c=await _0x3832bd[_0x571f95(0x245)]();_0xd8e3c?toastr['success'](_0x571f95(0x1c5),'圣意'):toastr[_0x571f95(0x303)]('清空宝库失败。','警报'),await updatePanelStatus();}}async function startCondensation(){const _0x289a00=_0x2981,_0x2baed0=document[_0x289a00(0x263)](_0x289a00(0x201)),_0x165b09=_0x2baed0[_0x289a00(0x1cb)]['finalText'],_0x41f9e1=document[_0x289a00(0x263)](_0x289a00(0x1c1))[_0x289a00(0x2ed)],_0xe3dd10=document['getElementById'](_0x289a00(0x1e4))[_0x289a00(0x2ed)],_0x51e358={'start':parseInt(_0x41f9e1),'end':parseInt(_0xe3dd10)};try{if(_0x165b09&&_0x165b09[_0x289a00(0x1cd)]()){log(_0x289a00(0x2f0),_0x289a00(0x1ea)),toastr[_0x289a00(0x1ea)](_0x289a00(0x2c4),'圣旨'),_0x2baed0[_0x289a00(0x2da)]=_0x289a00(0x2e6);const _0x4429b9=await _0x3832bd[_0x289a00(0x26a)](_0x165b09,_0x289a00(0x1c2),_0x289a00(0x255)+_0x51e358[_0x289a00(0x29a)]+'-'+_0x51e358[_0x289a00(0x2e0)],()=>{},null,log,()=>{},null,0x0,_0x51e358);if(_0x4429b9[_0x289a00(0x2d9)]){toastr['success'](_0x289a00(0x25d)+_0x4429b9[_0x289a00(0x26c)]+'\x20条忆识。','大功告成'),log(_0x289a00(0x234)+_0x4429b9['count']+_0x289a00(0x214),_0x289a00(0x2d9));const _0x2cf0f6=_0x51e358['end']===0x0?getContext()['chat'][_0x289a00(0x228)]:_0x51e358[_0x289a00(0x2e0)];_0x2baed0[_0x289a00(0x2da)]=_0x289a00(0x294)+_0x51e358[_0x289a00(0x29a)]+_0x289a00(0x2d8)+_0x2cf0f6+_0x289a00(0x1ca)+_0x4429b9['count']+'\x20条忆识。',delete _0x2baed0['dataset'][_0x289a00(0x236)];}else throw new Error(_0x4429b9[_0x289a00(0x303)]||_0x289a00(0x2a0));}else{_0x2baed0[_0x289a00(0x2da)]=_0x289a00(0x249),toastr[_0x289a00(0x1ea)]('正在准备凝识...','圣旨'),log('未检测到预览文本,按标准流程采集消息...',_0x289a00(0x1ea));const _0x3b369b=_0x3832bd[_0x289a00(0x27b)]();if(!_0x3b369b||_0x3b369b['length']===0x0){toastr['warning'](_0x289a00(0x225),_0x289a00(0x2b9)),_0x2baed0['textContent']=_0x289a00(0x1bd);return;}_0x2baed0[_0x289a00(0x2da)]=_0x289a00(0x210)+_0x3b369b[_0x289a00(0x228)]+_0x289a00(0x27e),toastr[_0x289a00(0x1ea)](_0x289a00(0x210)+_0x3b369b[_0x289a00(0x228)]+_0x289a00(0x27e),_0x289a00(0x2b9));const _0x38d6a3=await _0x3832bd['processCondensation'](_0x3b369b,log,_0x51e358);if(_0x38d6a3['success']){toastr[_0x289a00(0x2d9)](_0x289a00(0x323)+_0x38d6a3['count']+_0x289a00(0x214),_0x289a00(0x1d5));const _0x2c2649=_0x51e358[_0x289a00(0x2e0)]===0x0?getContext()[_0x289a00(0x1d8)][_0x289a00(0x228)]:_0x51e358['end'];_0x2baed0[_0x289a00(0x2da)]='聊天记录从第\x20'+_0x51e358[_0x289a00(0x29a)]+'\x20楼到第\x20'+_0x2c2649+_0x289a00(0x1ca)+_0x38d6a3['count']+_0x289a00(0x214);}else throw new Error(_0x38d6a3[_0x289a00(0x303)]||_0x289a00(0x2a0));}}catch(_0x8b55d9){console[_0x289a00(0x303)]('[翰林院-枢纽]\x20凝识过程发生错误:',_0x8b55d9),toastr['error']('凝识失败:\x20'+_0x8b55d9[_0x289a00(0x252)],_0x289a00(0x2b4)),_0x2baed0['textContent']=_0x289a00(0x229)+_0x8b55d9[_0x289a00(0x252)];}finally{await updatePanelStatus();}}async function loadWorldbookList(){const _0x49657e=_0x2981,_0x115b0f=document['getElementById'](_0x49657e(0x2a5));if(!_0x115b0f)return;try{log('正在获取可用书库列表...',_0x49657e(0x1ea));const _0x878341=await _0x20bd86[_0x49657e(0x2ff)]();_0x115b0f[_0x49657e(0x2d5)]=_0x49657e(0x2d1);if(_0x878341['length']===0x0){_0x115b0f['innerHTML']='未找到任何书库';return;}_0x878341[_0x49657e(0x296)](_0x31bc28=>{const _0xce3a6a=_0x49657e,_0x15a3ed=new Option(_0x31bc28,_0x31bc28);_0x115b0f[_0xce3a6a(0x313)](_0x15a3ed);}),log(_0x49657e(0x27c)+_0x878341[_0x49657e(0x228)]+'\x20个书库。','success');}catch(_0x465c25){console[_0x49657e(0x303)](_0x49657e(0x241),_0x465c25),log(_0x49657e(0x275)+_0x465c25['message'],_0x49657e(0x303)),_0x115b0f[_0x49657e(0x2d5)]=_0x49657e(0x202);}}async function handleWorldbookSelectionChange(){const _0x5bac7b=_0x2981,_0x510825=document[_0x5bac7b(0x263)](_0x5bac7b(0x2a5)),_0x15bbd7=document[_0x5bac7b(0x263)](_0x5bac7b(0x20e)),_0x11e2c4=_0x510825['value'];_0x15bbd7[_0x5bac7b(0x2d5)]=_0x5bac7b(0x1f2),_0x15bbd7[_0x5bac7b(0x1dd)]=!![];if(!_0x11e2c4){_0x15bbd7['innerHTML']=_0x5bac7b(0x240);return;}try{log(_0x5bac7b(0x21d)+_0x11e2c4+_0x5bac7b(0x314),'info');const _0x1f8d9c=await _0x20bd86[_0x5bac7b(0x23d)](_0x11e2c4);_0x15bbd7[_0x5bac7b(0x2d5)]='请选择一个条目...';if(_0x1f8d9c['length']===0x0){_0x15bbd7[_0x5bac7b(0x2d5)]='此书库为空';return;}_0x1f8d9c[_0x5bac7b(0x296)](_0x134169=>{const _0x599f93=_0x5bac7b,_0x53f9ff=new Option(_0x134169['comment']+_0x599f93(0x2f6)+_0x134169[_0x599f93(0x305)]+')',_0x134169[_0x599f93(0x305)]);_0x15bbd7[_0x599f93(0x313)](_0x53f9ff);}),log(_0x5bac7b(0x27c)+_0x1f8d9c[_0x5bac7b(0x228)]+_0x5bac7b(0x1f5),_0x5bac7b(0x2d9));}catch(_0x2fe26b){console[_0x5bac7b(0x303)](_0x5bac7b(0x2e8)+_0x11e2c4+_0x5bac7b(0x32c),_0x2fe26b),log(_0x5bac7b(0x25e)+_0x2fe26b[_0x5bac7b(0x252)],'error'),_0x15bbd7['innerHTML']='加载失败';}finally{_0x15bbd7['disabled']=![];}}async function startHistoriography(){const _0x296757=_0x2981,_0x50cb85=document[_0x296757(0x263)](_0x296757(0x2a5))['value'],_0x45bce7=document[_0x296757(0x263)](_0x296757(0x20e))['value'],_0x3f3dfe=document[_0x296757(0x263)]('hly-historiography-results');if(!_0x50cb85||!_0x45bce7){toastr[_0x296757(0x23b)](_0x296757(0x316),_0x296757(0x242));return;}_0x3f3dfe[_0x296757(0x2da)]='准备对《'+_0x50cb85+_0x296757(0x295)+_0x45bce7+_0x296757(0x23c),toastr[_0x296757(0x1ea)](_0x296757(0x2bb),'圣旨'),log(_0x296757(0x239)+_0x50cb85+'》-'+_0x45bce7+_0x296757(0x21f),_0x296757(0x1ea));try{const _0x4beebd=await _0x20bd86[_0x296757(0x2ba)](_0x50cb85,_0x45bce7);if(_0x4beebd[_0x296757(0x2d9)]){const _0x380516=document['getElementById'](_0x296757(0x20e)),_0x21c535=_0x380516[_0x296757(0x22b)][_0x380516[_0x296757(0x1d7)]][_0x296757(0x2dd)],_0x51817f='《'+_0x50cb85+_0x296757(0x208)+_0x21c535+_0x296757(0x29f);_0x3f3dfe[_0x296757(0x2da)]=_0x51817f,toastr[_0x296757(0x2d9)](_0x296757(0x28e),_0x296757(0x1d5)),log('对《'+_0x50cb85+_0x296757(0x231)+_0x45bce7+')\x20的编纂任务已完成。',_0x296757(0x2d9));}else throw new Error(_0x4beebd[_0x296757(0x303)]||'未知的编纂错误');}catch(_0x49b920){console['error']('[翰林院-枢纽]\x20编纂过程发生错误:',_0x49b920),toastr[_0x296757(0x303)](_0x296757(0x2cf)+_0x49b920['message'],_0x296757(0x2b4)),_0x3f3dfe['textContent']='编纂失败:\x20'+_0x49b920[_0x296757(0x252)];}}async function showStats(){const _0xcca394=_0x2981;try{log(_0xcca394(0x32d),_0xcca394(0x1ea)),toastr['info'](_0xcca394(0x1fe),'圣旨');const _0x19a357=await _0x3832bd[_0xcca394(0x248)](),_0x32d3d4=_0x3832bd[_0xcca394(0x31e)](),_0x17cb42=_0x3832bd[_0xcca394(0x209)](),_0x57156f=_0xcca394(0x2c2)+_0x32d3d4+_0xcca394(0x265)+_0x19a357+_0xcca394(0x29c)+_0x17cb42['retrieval'][_0xcca394(0x2be)]+_0xcca394(0x25c)+_0x17cb42[_0xcca394(0x2b3)][_0xcca394(0x1f9)]+_0xcca394(0x1ee);toastr[_0xcca394(0x1ea)](_0x57156f,_0xcca394(0x1f7),{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log(_0xcca394(0x2f7)+_0x32d3d4+_0xcca394(0x22c)+_0x19a357,'success');}catch(_0x5c194e){console['error'](_0xcca394(0x1c0),_0x5c194e),toastr[_0xcca394(0x303)](_0xcca394(0x21e)+_0x5c194e['message'],_0xcca394(0x2b4)),log(_0xcca394(0x21e)+_0x5c194e[_0xcca394(0x252)],_0xcca394(0x303));}}function showExclusionRulesModal(){const _0x509139=_0x2981,_0x1570e2=_0x3832bd[_0x509139(0x209)](),_0x34f2a9=_0x1570e2['condensation']['exclusionRules']||[],_0x1f2144=(_0x87cabc={'start':'','end':''},_0x17a21b)=>_0x509139(0x2ee)+_0x17a21b+_0x509139(0x28a)+_0x87cabc[_0x509139(0x29a)]+_0x509139(0x28b)+_0x87cabc['end']+_0x509139(0x1be),_0x491de7=_0x34f2a9[_0x509139(0x1f4)](_0x1f2144)['join'](''),_0xe934c4=_0x509139(0x2c3)+_0x491de7+_0x509139(0x1f8);showHtmlModal('编辑内容排除规则',_0xe934c4,{'okText':'保存规则','onOk':_0x84ae1c=>{const _0x6f0627=_0x509139,_0x40a857=[];_0x84ae1c[_0x6f0627(0x256)](_0x6f0627(0x31c))[_0x6f0627(0x2af)](function(){const _0x2715a7=_0x6f0627,_0x5baace=$(this)['find']('input')['eq'](0x0)[_0x2715a7(0x30f)]()[_0x2715a7(0x1cd)](),_0xb6f3f3=$(this)[_0x2715a7(0x256)](_0x2715a7(0x321))['eq'](0x1)[_0x2715a7(0x30f)]()['trim']();_0x5baace&&_0xb6f3f3&&_0x40a857[_0x2715a7(0x30a)]({'start':_0x5baace,'end':_0xb6f3f3});}),updateAndSaveSetting('condensation.exclusionRules',_0x40a857),toastr[_0x6f0627(0x2d9)](_0x6f0627(0x327),_0x6f0627(0x2f8));}});const _0x5a197a=document[_0x509139(0x263)](_0x509139(0x1e3)),_0x5768b0=_0x5a197a[_0x509139(0x2cb)](_0x509139(0x2f3));_0x5a197a[_0x509139(0x2cb)](_0x509139(0x2a8))[_0x509139(0x325)](_0x509139(0x2b6),()=>{const _0x238ed4=_0x509139,_0x43493e=_0x5768b0[_0x238ed4(0x271)][_0x238ed4(0x228)],_0x57edb7=_0x1f2144({'start':'','end':''},_0x43493e);_0x5768b0['insertAdjacentHTML'](_0x238ed4(0x2fc),_0x57edb7);}),_0x5768b0[_0x509139(0x325)](_0x509139(0x2b6),_0x11ed82=>{const _0x52aa8c=_0x509139;_0x11ed82[_0x52aa8c(0x217)][_0x52aa8c(0x1f1)][_0x52aa8c(0x26f)]('hly-delete-rule-btn')&&_0x11ed82[_0x52aa8c(0x217)][_0x52aa8c(0x2fa)](_0x52aa8c(0x31c))['remove']();});}function previewCondensation(){const _0x3cafb1=_0x2981,_0x5a2b9a=document['getElementById'](_0x3cafb1(0x201));try{const _0x547990=_0x3832bd[_0x3cafb1(0x209)](),_0x29d004=_0x547990[_0x3cafb1(0x28d)]['exclusionRules']||[],_0xa81191={'user':document[_0x3cafb1(0x263)]('hly-include-user')[_0x3cafb1(0x298)],'ai':document[_0x3cafb1(0x263)](_0x3cafb1(0x2b7))[_0x3cafb1(0x298)]},_0x1f5597=document['getElementById'](_0x3cafb1(0x1ed))['checked'],_0x5bb49e=_0x1f5597?document[_0x3cafb1(0x263)](_0x3cafb1(0x1d2))[_0x3cafb1(0x2ed)][_0x3cafb1(0x20c)](',')[_0x3cafb1(0x1f4)](_0x4c190a=>_0x4c190a[_0x3cafb1(0x1cd)]())[_0x3cafb1(0x20d)](Boolean):[],_0x36aa47=_0x3832bd['getMessagesForCondensation'](_0xa81191);if(!_0x36aa47||_0x36aa47[_0x3cafb1(0x228)]===0x0){_0x5a2b9a[_0x3cafb1(0x2da)]=_0x3cafb1(0x200),toastr[_0x3cafb1(0x23b)](_0x3cafb1(0x1bd),_0x3cafb1(0x2b9));return;}const _0x2d88da=_0x36aa47[_0x3cafb1(0x1f4)]((_0x371e20,_0x29bf96)=>{const _0x5c2851=_0x3cafb1;let _0x17b39c;if(_0x371e20[_0x5c2851(0x2b2)])_0x17b39c=_0x371e20[_0x5c2851(0x1f6)];else{if(_0x1f5597&&_0x5bb49e[_0x5c2851(0x228)]>0x0){const _0x5b1a1d=extractBlocksByTags(_0x371e20[_0x5c2851(0x1f6)],_0x5bb49e);_0x17b39c=_0x5b1a1d['join']('\x0a\x0a');}else _0x17b39c=_0x371e20[_0x5c2851(0x1f6)];_0x17b39c=applyExclusionRules(_0x17b39c,_0x29d004);}return{'id':'preview-item-'+_0x29bf96,'name':_0x371e20['name'],'content':_0x17b39c[_0x5c2851(0x1cd)]()};})[_0x3cafb1(0x20d)](_0x10d5bb=>_0x10d5bb['content']);if(_0x2d88da['length']===0x0){_0x5a2b9a[_0x3cafb1(0x2da)]=_0x3cafb1(0x2b8),toastr[_0x3cafb1(0x23b)](_0x3cafb1(0x2b8),_0x3cafb1(0x2b9));return;}const _0x3f7948=_0x2d88da[_0x3cafb1(0x1f4)]((_0x46ba3f,_0x8c867b)=>'\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\x0a\x20\x20\x20\x20\x20\x20\x20\x20')[_0x3cafb1(0x29e)]('');showHtmlModal('预览并编辑凝识内容',_0x3cafb1(0x204)+_0x3f7948+_0x3cafb1(0x1bc),{'okText':'确认并更新预览','onOk':_0x24b0da=>{const _0x32d36a=_0x3cafb1,_0x13ef6a=[];_0x24b0da[_0x32d36a(0x256)](_0x32d36a(0x24c))[_0x32d36a(0x2af)](function(){const _0x32e552=_0x32d36a,_0x4aacd9=$(this)['find']('.hly-preview-textarea')['val']();_0x4aacd9[_0x32e552(0x1cd)]()&&_0x13ef6a[_0x32e552(0x30a)](_0x4aacd9);});const _0x423a08=_0x13ef6a[_0x32d36a(0x29e)](_0x32d36a(0x292)),_0x5aeb3a=document[_0x32d36a(0x263)](_0x32d36a(0x1c1))[_0x32d36a(0x2ed)],_0x3aec50=document[_0x32d36a(0x263)](_0x32d36a(0x1e4))[_0x32d36a(0x2ed)];_0x5a2b9a[_0x32d36a(0x2da)]=_0x32d36a(0x28f)+_0x5aeb3a+_0x32d36a(0x2e5)+_0x3aec50+_0x32d36a(0x310)+_0x13ef6a[_0x32d36a(0x228)]+'\x20条有效条目),请点击“开始凝识”进入自动向量化流程。',_0x5a2b9a[_0x32d36a(0x1cb)][_0x32d36a(0x236)]=_0x423a08,toastr[_0x32d36a(0x2d9)](_0x32d36a(0x1eb),_0x32d36a(0x2f8));}}),$('.hly-preview-delete-btn-v2')['on'](_0x3cafb1(0x2b6),function(_0x24008e){const _0x2b0ca4=_0x3cafb1;_0x24008e[_0x2b0ca4(0x222)]();const _0x9aa5c4=$(this)[_0x2b0ca4(0x244)](_0x2b0ca4(0x217));$('#'+_0x9aa5c4)[_0x2b0ca4(0x1d1)]();});}catch(_0x1eee67){console['error'](_0x3cafb1(0x1c3),_0x1eee67),_0x5a2b9a[_0x3cafb1(0x2da)]=_0x3cafb1(0x29d)+_0x1eee67[_0x3cafb1(0x252)],toastr['error'](_0x3cafb1(0x29d)+_0x1eee67['message'],_0x3cafb1(0x2b4));}}function log(_0x3ed637,_0x4f24ac='info'){const _0x177bd7=_0x2981,_0x5e3305=document[_0x177bd7(0x263)]('hly-log-output');if(!_0x5e3305)return;const _0xbb42e3=document['createElement']('p'),_0x3412ef=new Date()[_0x177bd7(0x2d7)]();let _0x39760d=_0x177bd7(0x262),_0x23f9fa=_0x177bd7(0x286);switch(_0x4f24ac){case _0x177bd7(0x2d9):_0x39760d=_0x177bd7(0x1c6),_0x23f9fa=_0x177bd7(0x1cf);break;case _0x177bd7(0x303):_0x39760d=_0x177bd7(0x31b),_0x23f9fa=_0x177bd7(0x330);break;case _0x177bd7(0x284):_0x39760d=_0x177bd7(0x2f9),_0x23f9fa=_0x177bd7(0x1bf);break;}_0xbb42e3[_0x177bd7(0x32f)]=_0x177bd7(0x207)+_0x23f9fa,_0xbb42e3[_0x177bd7(0x2d5)]=_0x177bd7(0x2f5)+_0x39760d+_0x177bd7(0x1f0)+_0x3412ef+']\x20'+_0x3ed637;const _0x454a50=_0x5e3305[_0x177bd7(0x2cb)](_0x177bd7(0x2b5));_0x454a50&&_0x454a50[_0x177bd7(0x1d1)](),_0x5e3305[_0x177bd7(0x1fc)](_0xbb42e3),_0x5e3305[_0x177bd7(0x1da)]=_0x5e3305['scrollHeight'];}async function ingestManualText(){const _0x556a77=_0x2981,_0xdbb88d=document[_0x556a77(0x263)](_0x556a77(0x322)),_0x39b9ef=_0xdbb88d[_0x556a77(0x2ed)][_0x556a77(0x1cd)]();if(!_0x39b9ef){toastr[_0x556a77(0x23b)]('录入内容不能为空。',_0x556a77(0x2b9)),log(_0x556a77(0x290),_0x556a77(0x284));return;}log(_0x556a77(0x278)+_0x39b9ef[_0x556a77(0x228)],_0x556a77(0x1ea)),toastr[_0x556a77(0x1ea)](_0x556a77(0x20f),'圣旨');try{const _0x31e1c4=await _0x3832bd[_0x556a77(0x26a)](_0x39b9ef,_0x556a77(0x21a),_0x556a77(0x30d));if(_0x31e1c4[_0x556a77(0x2d9)])toastr[_0x556a77(0x2d9)]('文书已成功录入宝库,新增\x20'+_0x31e1c4[_0x556a77(0x26c)]+_0x556a77(0x214),_0x556a77(0x1d5)),log(_0x556a77(0x1e8)+_0x31e1c4[_0x556a77(0x26c)]+_0x556a77(0x214),'success'),_0xdbb88d['value']='';else throw new Error(_0x31e1c4['error']||_0x556a77(0x2a0));}catch(_0x32a11f){console['error'](_0x556a77(0x27d),_0x32a11f),toastr[_0x556a77(0x303)]('文书录入失败:\x20'+_0x32a11f[_0x556a77(0x252)],_0x556a77(0x2b4)),log('手动录入失败:\x20'+_0x32a11f[_0x556a77(0x252)],'error');}finally{await updatePanelStatus();}}