Files
ST-Amily2-Chat-Optimisation/ui/hanlinyuan-bindings.js
2025-08-07 20:22:30 +08:00

2 lines
48 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(_0x4e6db2,_0x26f8b1){const _0x515e4a=_0x11ec,_0x2024d1=_0x4e6db2();while(!![]){try{const _0xc5d6da=parseInt(_0x515e4a(0x214))/0x1*(-parseInt(_0x515e4a(0x1de))/0x2)+parseInt(_0x515e4a(0x257))/0x3*(-parseInt(_0x515e4a(0x1e7))/0x4)+parseInt(_0x515e4a(0x202))/0x5+parseInt(_0x515e4a(0x1ac))/0x6*(-parseInt(_0x515e4a(0x26a))/0x7)+-parseInt(_0x515e4a(0x22f))/0x8+-parseInt(_0x515e4a(0x13d))/0x9+parseInt(_0x515e4a(0x118))/0xa;if(_0xc5d6da===_0x26f8b1)break;else _0x2024d1['push'](_0x2024d1['shift']());}catch(_0x3e56ca){_0x2024d1['push'](_0x2024d1['shift']());}}}(_0x4004,0x72964));import{getContext}from'/scripts/extensions.js';import*as _0x56313e from'../core/rag-processor.js';import*as _0x4b4d4f from'../core/historiographer.js';import*as _0x407f08 from'../core/utils/context-utils.js';import*as _0x4190f8 from'../core/ingestion-manager.js';import{showContentModal,showHtmlModal}from'./page-window.js';import{extractBlocksByTags,applyExclusionRules}from'../core/utils/rag-tag-extractor.js';'use\x20strict';function setupGlobalEventHandlers(){const _0x5a1726=_0x11ec;window[_0x5a1726(0x111)]=()=>saveSettingsFromUI(![]),window['resetHLYSettings']=resetSettingsToUI,window[_0x5a1726(0x193)]=testApi,window[_0x5a1726(0x1b4)]=fetchHLYEmbeddingModels,window[_0x5a1726(0x168)]=fetchHLYRerankModels,window['updateHLYMemoryCount']=updatePanelStatus,window[_0x5a1726(0x165)]=purgeStorage,window[_0x5a1726(0x1fe)]=startCondensation,window[_0x5a1726(0x13e)]=previewCondensation,window[_0x5a1726(0x142)]=ingestManualText,window[_0x5a1726(0x243)]=log,window[_0x5a1726(0x1b9)]=showStats,window[_0x5a1726(0x1c2)]=startHistoriography;}function updateAndSaveSetting(_0x56452b,_0x48f798){const _0x2b2445=_0x11ec,_0x47fccf=_0x56313e['getSettings']();if(!_0x47fccf)return;const _0x1cd221=_0x56452b['split']('.');let _0x1fa024=_0x47fccf;for(let _0x66905e=0x0;_0x66905e<_0x1cd221[_0x2b2445(0x215)]-0x1;_0x66905e++){_0x1fa024=_0x1fa024[_0x1cd221[_0x66905e]]=_0x1fa024[_0x1cd221[_0x66905e]]||{};}_0x1fa024[_0x1cd221[_0x1cd221[_0x2b2445(0x215)]-0x1]]=_0x48f798,_0x56313e[_0x2b2445(0x170)](),log(_0x2b2445(0x104)+_0x56452b+_0x2b2445(0x263)+JSON[_0x2b2445(0x124)](_0x48f798),_0x2b2445(0x115));}function bindAutoSaveEvents(){const _0x27f9b8=_0x11ec,_0x4abc70=document[_0x27f9b8(0x24a)]('hly-modal-container');if(!_0x4abc70)return;_0x4abc70[_0x27f9b8(0x144)]('change',_0x13eac3=>{const _0x3a7ab9=_0x27f9b8,_0x296910=_0x13eac3[_0x3a7ab9(0x1b0)],_0x4eb68d=_0x296910['dataset'][_0x3a7ab9(0x264)];if(!_0x4eb68d)return;let _0x40ab51;const _0x4d45f0=_0x296910['dataset'][_0x3a7ab9(0x1fa)]||_0x3a7ab9(0x19f);if(_0x296910[_0x3a7ab9(0x1fa)]==='checkbox')_0x40ab51=_0x296910[_0x3a7ab9(0x1d7)];else{if(_0x296910[_0x3a7ab9(0x1fa)]===_0x3a7ab9(0x275)){if(_0x296910[_0x3a7ab9(0x1d7)]){const _0x486922=_0x4abc70[_0x3a7ab9(0x1f3)](_0x3a7ab9(0x190)+_0x296910[_0x3a7ab9(0x16f)]+'\x22]'),_0x3fd116=Array[_0x3a7ab9(0x1bb)](_0x486922)[_0x3a7ab9(0x219)](_0x31515a=>_0x31515a[_0x3a7ab9(0x1d7)]);_0x40ab51=_0x3fd116[_0x3a7ab9(0x249)];}else return;}else _0x40ab51=_0x296910['value'];}switch(_0x4d45f0){case'integer':_0x40ab51=parseInt(_0x40ab51,0xa);break;case _0x3a7ab9(0x1dc):_0x40ab51=parseFloat(_0x40ab51);break;case _0x3a7ab9(0x136):typeof _0x40ab51!==_0x3a7ab9(0x136)&&(_0x40ab51=_0x40ab51===_0x3a7ab9(0x10a));break;}if(_0x296910['type']===_0x3a7ab9(0x275)&&!_0x296910[_0x3a7ab9(0x1d7)])return;updateAndSaveSetting(_0x4eb68d,_0x40ab51);});}export function bindHanlinyuanEvents(){const _0x48533e=_0x11ec,_0xd88b97=getContext();if(!_0xd88b97){console['error'](_0x48533e(0x1dd));return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents(),bindTutorialEvents(),bindAutoSaveEvents(),bindSessionLockEvent();if(_0x56313e[_0x48533e(0x198)])_0x56313e['initialize']();else{console[_0x48533e(0x1d6)](_0x48533e(0x1c0));return;}loadSettingsToUI(),loadWorldbookList(),log('[翰林院-枢纽]\x20已成功连接各部政令畅通。',_0x48533e(0x187));const _0x3e8751=document['getElementById'](_0x48533e(0x1ba)),_0x2f7e79=document[_0x48533e(0x24a)](_0x48533e(0x154)),_0x4b58bb=document['getElementById'](_0x48533e(0x26b)),_0x588e40=document[_0x48533e(0x24a)](_0x48533e(0x1ca)),_0x4f5820=document[_0x48533e(0x24a)]('hanlinyuan-ingest-progress-container'),_0xc43072=document[_0x48533e(0x24a)]('hanlinyuan-ingest-progress-bar'),_0x776f13=document[_0x48533e(0x24a)](_0x48533e(0x175)),_0x2ca7b0=document[_0x48533e(0x24a)]('hanlinyuan-ingest-novel-controls');let _0x47ef69=null,_0xc3bc46=null;_0x3e8751[_0x48533e(0x144)](_0x48533e(0x1ec),_0x51b4b3=>{const _0x5414c0=_0x48533e;_0x47ef69=_0x51b4b3[_0x5414c0(0x1b0)][_0x5414c0(0x197)][0x0],_0x47ef69?(_0x2f7e79[_0x5414c0(0x107)]=_0x47ef69[_0x5414c0(0x16f)],_0x2f7e79[_0x5414c0(0x1cc)]=_0x47ef69[_0x5414c0(0x16f)]):_0x2f7e79[_0x5414c0(0x107)]=_0x5414c0(0x1a2);}),_0x4b58bb['addEventListener'](_0x48533e(0x1e9),async()=>{const _0x3518b1=_0x48533e;if(!_0x47ef69){toastr[_0x3518b1(0x254)](_0x3518b1(0x22e));return;}let _0x2661f5=0x0;const _0x1d0448=_0x4190f8['generateJobId'](_0x47ef69),_0x4dba9a=_0x4190f8['loadProgress'](_0x1d0448);if(_0x4dba9a){const _0x149eb7=(_0x4dba9a['processedChunks']/_0x4dba9a[_0x3518b1(0x228)]*0x64)[_0x3518b1(0x25b)](0x1),_0x13a9ad=confirm(_0x3518b1(0x1c7)+_0x149eb7+_0x3518b1(0x105));_0x13a9ad?(_0x2661f5=_0x4dba9a[_0x3518b1(0x250)],toastr[_0x3518b1(0x187)]('遵命,将从第\x20'+(_0x2661f5+0x1)+_0x3518b1(0x24e),'圣旨已达'),log(_0x3518b1(0x1c5)+_0x1d0448+',从第\x20'+_0x2661f5+_0x3518b1(0x1f7),_0x3518b1(0x187))):(_0x4190f8['clearJob'](_0x1d0448),toastr[_0x3518b1(0x187)]('遵命,将从头开始录入此书。',_0x3518b1(0x1f2)),log(_0x3518b1(0x11e)+_0x1d0448+_0x3518b1(0x239),_0x3518b1(0x191)));}_0xc3bc46=new AbortController();const _0x1f32e0=_0xc3bc46[_0x3518b1(0x1e5)];_0x2ca7b0['style']['display']=_0x3518b1(0x262),_0x4f5820[_0x3518b1(0x1cf)][_0x3518b1(0x1db)]=_0x3518b1(0x256),_0x776f13[_0x3518b1(0x107)]=_0x3518b1(0x171),_0xc43072[_0x3518b1(0x249)]=0x0;try{const _0x59a34d=await _0x47ef69[_0x3518b1(0x24d)](),_0x5b5ca0=_0x7d349b=>{const _0x1e7b99=_0x3518b1;_0x776f13[_0x1e7b99(0x107)]=_0x1e7b99(0x1f0)+_0x7d349b['message']+'\x20('+_0x7d349b[_0x1e7b99(0x1ee)]+'/'+_0x7d349b[_0x1e7b99(0x16e)]+')',_0xc43072['value']=_0x7d349b[_0x1e7b99(0x1ee)]/_0x7d349b[_0x1e7b99(0x16e)]*0x64;},_0x1b057c=()=>{const _0x35ef4f=_0x3518b1;updatePanelStatus(),log(_0x35ef4f(0x140),_0x35ef4f(0x187));},_0x3e417f=await _0x56313e[_0x3518b1(0x108)](_0x59a34d,_0x3518b1(0x252),_0x47ef69[_0x3518b1(0x16f)],_0x5b5ca0,_0x1f32e0,log,_0x1b057c,_0x1d0448,_0x2661f5);if(_0x3e417f[_0x3518b1(0x115)])toastr[_0x3518b1(0x115)](_0x3518b1(0x1e3)+_0x3e417f[_0x3518b1(0x220)]+'\x20个知识块'),_0x776f13[_0x3518b1(0x107)]=_0x3518b1(0x1d9)+_0x3e417f[_0x3518b1(0x220)]+_0x3518b1(0x259),_0xc43072[_0x3518b1(0x249)]=0x64,updatePanelStatus();else throw new Error(_0x3e417f[_0x3518b1(0x1d6)]||_0x3518b1(0x1ef));}catch(_0x1f31f8){_0x1f31f8[_0x3518b1(0x16f)]===_0x3518b1(0x1a9)?(toastr[_0x3518b1(0x187)](_0x3518b1(0x19e)),_0x776f13[_0x3518b1(0x107)]=_0x3518b1(0x200)):(toastr[_0x3518b1(0x1d6)](_0x3518b1(0xff)+_0x1f31f8[_0x3518b1(0x22a)]+_0x3518b1(0x24c)),_0x776f13[_0x3518b1(0x107)]=_0x3518b1(0x1cd)+_0x1f31f8[_0x3518b1(0x22a)]);}finally{setTimeout(()=>{const _0x56e8c1=_0x3518b1;_0x2ca7b0[_0x56e8c1(0x1cf)]['display']='flex',_0x4f5820['style'][_0x56e8c1(0x1db)]=_0x56e8c1(0x262),_0x3e8751[_0x56e8c1(0x249)]='',_0x47ef69=null,_0x2f7e79['textContent']=_0x56e8c1(0x1a2);},0xbb8);}}),_0x588e40['addEventListener'](_0x48533e(0x1e9),()=>{const _0x194032=_0x48533e;_0xc3bc46&&_0xc3bc46[_0x194032(0x26c)]();});}function bindSessionLockEvent(){const _0x22277b=_0x11ec,_0x246ace=document['getElementById']('hly-session-lock-btn');if(!_0x246ace)return;_0x246ace[_0x22277b(0x144)]('click',async()=>{const _0x43d9bd=_0x22277b,_0x27b13e=await _0x56313e[_0x43d9bd(0x156)]();updateSessionLockUI(_0x27b13e);if(_0x27b13e){const _0x542f71=_0x56313e[_0x43d9bd(0x236)]();_0x542f71&&(toastr['success']('会话已锁定到:\x20'+_0x542f71['id'],'圣旨已下'),log(_0x43d9bd(0x222)+_0x542f71['id'],'success'));}else toastr[_0x43d9bd(0x187)]('会话已解锁,将跟随当前角色。','诏曰'),log(_0x43d9bd(0x1c9),_0x43d9bd(0x187));updatePanelStatus();}),updateSessionLockUI(_0x56313e[_0x22277b(0x1bf)]());}function updateSessionLockUI(_0x5be282){const _0xaae47f=_0x11ec,_0x1caa75=document[_0xaae47f(0x24a)](_0xaae47f(0x21d));if(!_0x1caa75)return;const _0x1d0b63=_0x1caa75['querySelector']('i'),_0x14bb54=_0x1caa75[_0xaae47f(0x273)](_0xaae47f(0x246));_0x5be282?(_0x1caa75['classList'][_0xaae47f(0x217)](_0xaae47f(0x1f4)),_0x1d0b63[_0xaae47f(0x15d)]=_0xaae47f(0x260),_0x14bb54[_0xaae47f(0x107)]=_0xaae47f(0x24b),_0x1caa75[_0xaae47f(0x1cc)]=_0xaae47f(0x109)):(_0x1caa75[_0xaae47f(0x106)]['remove']('active'),_0x1d0b63[_0xaae47f(0x15d)]=_0xaae47f(0x12d),_0x14bb54[_0xaae47f(0x107)]=_0xaae47f(0x1e8),_0x1caa75[_0xaae47f(0x1cc)]=_0xaae47f(0x10d));}function bindPanelToggleEvents(){const _0x29f1d6=_0x11ec,_0x5d27af=document[_0x29f1d6(0x24a)](_0x29f1d6(0x155));if(_0x5d27af){}}function bindTutorialEvents(){const _0x27ff6b=_0x11ec,_0x48a4bf=document[_0x27ff6b(0x24a)](_0x27ff6b(0x270));_0x48a4bf&&_0x48a4bf['addEventListener'](_0x27ff6b(0x1e9),()=>{const _0x5720a6=_0x27ff6b;showContentModal(_0x5720a6(0x266),_0x5720a6(0x148));});}function bindInternalUIEvents(){const _0x1c403a=_0x11ec,_0x1d27e6=document[_0x1c403a(0x1f3)](_0x1c403a(0x1fc));_0x1d27e6[_0x1c403a(0x238)](_0x1cddc8=>{const _0x48db4c=_0x1c403a;_0x1cddc8[_0x48db4c(0x144)](_0x48db4c(0x1e9),()=>{const _0x52b5b6=_0x48db4c,_0x2976ac=_0x1cddc8[_0x52b5b6(0x19c)][_0x52b5b6(0x129)],_0x1ccad5='hly-'+_0x2976ac+_0x52b5b6(0x265);document['querySelectorAll'](_0x52b5b6(0x23e))['forEach'](_0xcedfe0=>{const _0x519aa9=_0x52b5b6;_0xcedfe0['classList'][_0x519aa9(0x26e)]('active',_0xcedfe0['id']===_0x1ccad5);}),_0x1d27e6[_0x52b5b6(0x238)](_0x2faf1c=>_0x2faf1c['classList'][_0x52b5b6(0x26e)](_0x52b5b6(0x1f4),_0x2faf1c===_0x1cddc8));});});const _0x28c675=document[_0x1c403a(0x24a)]('hly-api-endpoint');_0x28c675&&_0x28c675[_0x1c403a(0x144)](_0x1c403a(0x1ec),toggleCustomEndpointDocket);const _0x18ac1e=document[_0x1c403a(0x1f3)](_0x1c403a(0x21f));_0x18ac1e[_0x1c403a(0x238)](_0x5ee7b8=>{const _0x4751fc=_0x1c403a;_0x5ee7b8[_0x4751fc(0x144)](_0x4751fc(0x1ec),toggleInjectionDetails);});const _0x16b263=document['getElementById'](_0x1c403a(0x1e4)),_0x5b725e=document[_0x1c403a(0x24a)](_0x1c403a(0x1ea));_0x16b263&&_0x5b725e&&_0x16b263['addEventListener'](_0x1c403a(0x1ec),()=>{const _0x43b2f8=_0x1c403a;_0x5b725e[_0x43b2f8(0x1cf)]['display']=_0x16b263[_0x43b2f8(0x1d7)]?_0x43b2f8(0x256):_0x43b2f8(0x262);});const _0x5505b9=document[_0x1c403a(0x24a)]('hly-hist-select-library');_0x5505b9&&_0x5505b9[_0x1c403a(0x144)](_0x1c403a(0x1ec),handleWorldbookSelectionChange);const _0x144d93=document[_0x1c403a(0x24a)](_0x1c403a(0x1c3));_0x144d93&&_0x144d93['addEventListener'](_0x1c403a(0x1e9),showExclusionRulesModal);}function toggleInjectionDetails(){const _0x4d53f3=_0x11ec,_0x519945=document[_0x4d53f3(0x273)]('input[name=\x22hly-injection-position\x22]:checked')[_0x4d53f3(0x249)],_0x4bd0fc=document[_0x4d53f3(0x24a)]('hly-injection-depth'),_0x1819e0=document[_0x4d53f3(0x24a)](_0x4d53f3(0x1c6)),_0x47e96e=_0x519945==='1';_0x4bd0fc[_0x4d53f3(0x19a)]=!_0x47e96e,_0x1819e0[_0x4d53f3(0x19a)]=!_0x47e96e;}function toggleCustomEndpointDocket(){const _0x151d43=_0x11ec,_0x1b5c67=document[_0x151d43(0x24a)](_0x151d43(0x1b3))[_0x151d43(0x249)],_0x4b1df9=document[_0x151d43(0x24a)](_0x151d43(0x11f));_0x4b1df9&&(_0x4b1df9[_0x151d43(0x1cf)][_0x151d43(0x1db)]=_0x1b5c67===_0x151d43(0x1c4)||_0x1b5c67===_0x151d43(0x174)?_0x151d43(0x256):'none');}function loadSettingsToUI(){const _0x547a05=_0x11ec,_0x2c3be4=_0x56313e[_0x547a05(0x1b7)]();if(!_0x2c3be4)return;document[_0x547a05(0x24a)](_0x547a05(0x272))[_0x547a05(0x1d7)]=_0x2c3be4[_0x547a05(0x216)][_0x547a05(0x1bd)],document[_0x547a05(0x24a)](_0x547a05(0x1b3))[_0x547a05(0x249)]=_0x2c3be4['retrieval'][_0x547a05(0x1aa)],document[_0x547a05(0x24a)]('hly-custom-api-url')[_0x547a05(0x249)]=_0x2c3be4['retrieval'][_0x547a05(0x1ae)],document[_0x547a05(0x24a)](_0x547a05(0x10b))['value']=_0x2c3be4[_0x547a05(0x216)][_0x547a05(0x207)];const _0x48086d=document[_0x547a05(0x24a)](_0x547a05(0x225));if(_0x48086d[_0x547a05(0x18a)][_0x547a05(0x215)]===0x0){const _0x4d3b38=_0x2c3be4[_0x547a05(0x216)][_0x547a05(0x255)],_0x4838bc=new Option(_0x4d3b38,_0x4d3b38,!![],!![]);_0x48086d[_0x547a05(0x217)](_0x4838bc);}_0x48086d['value']=_0x2c3be4['retrieval']['embeddingModel'],document[_0x547a05(0x24a)](_0x547a05(0x130))['checked']=_0x2c3be4['retrieval'][_0x547a05(0x24f)],document[_0x547a05(0x24a)](_0x547a05(0x251))['value']=_0x2c3be4[_0x547a05(0x123)][_0x547a05(0x244)],document[_0x547a05(0x24a)](_0x547a05(0x1b5))[_0x547a05(0x249)]=_0x2c3be4[_0x547a05(0x123)][_0x547a05(0x1f9)],document[_0x547a05(0x24a)](_0x547a05(0x201))[_0x547a05(0x249)]=_0x2c3be4['advanced'][_0x547a05(0x1a7)],document[_0x547a05(0x24a)](_0x547a05(0x22c))['value']=_0x2c3be4[_0x547a05(0x123)]['queryMessageCount'],document[_0x547a05(0x24a)]('hly-max-results')[_0x547a05(0x249)]=_0x2c3be4[_0x547a05(0x123)]['maxResults'],document[_0x547a05(0x24a)](_0x547a05(0x188))['value']=_0x2c3be4[_0x547a05(0x216)][_0x547a05(0x114)],document[_0x547a05(0x24a)](_0x547a05(0x172))[_0x547a05(0x249)]=_0x2c3be4['injection'][_0x547a05(0x137)];const _0x4bb5fc=document[_0x547a05(0x273)]('input[name=\x22hly-injection-position\x22][value=\x22'+_0x2c3be4[_0x547a05(0x12b)][_0x547a05(0x1a5)]+'\x22]');_0x4bb5fc&&(_0x4bb5fc['checked']=!![]);document[_0x547a05(0x24a)](_0x547a05(0x17a))[_0x547a05(0x249)]=_0x2c3be4[_0x547a05(0x12b)][_0x547a05(0x1b6)],document[_0x547a05(0x24a)](_0x547a05(0x1c6))['value']=_0x2c3be4[_0x547a05(0x12b)]['depth_role'],toggleInjectionDetails(),document[_0x547a05(0x24a)](_0x547a05(0x226))[_0x547a05(0x1d7)]=_0x2c3be4[_0x547a05(0x1ad)]['enabled'],document[_0x547a05(0x24a)]('hly-layer-start')['value']=_0x2c3be4[_0x547a05(0x1ad)]['layerStart'],document[_0x547a05(0x24a)](_0x547a05(0x14e))[_0x547a05(0x249)]=_0x2c3be4['condensation'][_0x547a05(0x242)],document[_0x547a05(0x24a)](_0x547a05(0x1af))[_0x547a05(0x1d7)]=_0x2c3be4[_0x547a05(0x1ad)]['messageTypes'][_0x547a05(0x20b)],document[_0x547a05(0x24a)](_0x547a05(0x16b))[_0x547a05(0x1d7)]=_0x2c3be4[_0x547a05(0x1ad)][_0x547a05(0x229)]['ai'];const _0x378c01=document[_0x547a05(0x24a)](_0x547a05(0x1e4)),_0x21ef72=document['getElementById']('hly-tag-input'),_0x13beac=document[_0x547a05(0x24a)](_0x547a05(0x1ea));_0x378c01[_0x547a05(0x1d7)]=_0x2c3be4[_0x547a05(0x1ad)][_0x547a05(0x1f1)],_0x21ef72['value']=_0x2c3be4[_0x547a05(0x1ad)]['tags'],_0x13beac[_0x547a05(0x1cf)]['display']=_0x378c01[_0x547a05(0x1d7)]?_0x547a05(0x256):_0x547a05(0x262),document['getElementById'](_0x547a05(0x1ab))['checked']=_0x2c3be4[_0x547a05(0x12c)][_0x547a05(0x1bd)],document[_0x547a05(0x24a)](_0x547a05(0x1df))[_0x547a05(0x249)]=_0x2c3be4[_0x547a05(0x12c)]['url'],document['getElementById'](_0x547a05(0x1bc))[_0x547a05(0x249)]=_0x2c3be4[_0x547a05(0x12c)][_0x547a05(0x207)];const _0xfb4f57=document[_0x547a05(0x24a)](_0x547a05(0x203));if(_0xfb4f57['options'][_0x547a05(0x215)]===0x0){const _0x1f5d08=_0x2c3be4[_0x547a05(0x12c)][_0x547a05(0x1d8)];if(_0x1f5d08){const _0x4335fb=new Option(_0x1f5d08,_0x1f5d08,!![],!![]);_0xfb4f57[_0x547a05(0x217)](_0x4335fb);}}_0xfb4f57[_0x547a05(0x249)]=_0x2c3be4[_0x547a05(0x12c)][_0x547a05(0x1d8)],document['getElementById'](_0x547a05(0x18f))[_0x547a05(0x249)]=_0x2c3be4[_0x547a05(0x12c)]['top_n'],document[_0x547a05(0x24a)]('hly-rerank-hybrid-alpha')[_0x547a05(0x249)]=_0x2c3be4[_0x547a05(0x12c)][_0x547a05(0x268)],document[_0x547a05(0x24a)]('hly-rerank-notify')['checked']=_0x2c3be4[_0x547a05(0x12c)][_0x547a05(0x24f)],toggleCustomEndpointDocket();}function saveSettingsFromUI(_0x30f154=!![]){const _0x1f6d4d=_0x11ec,_0x1a713c=document[_0x1f6d4d(0x24a)]('hly-modal-container');if(!_0x1a713c)return;const _0x4982d7=_0x1a713c[_0x1f6d4d(0x1f3)](_0x1f6d4d(0x17c));_0x4982d7['forEach'](_0x47cf8f=>{const _0x4f8371=_0x1f6d4d,_0x27f43d=_0x47cf8f[_0x4f8371(0x19c)][_0x4f8371(0x264)];if(!_0x27f43d)return;let _0x591e66;const _0x2a4b09=_0x47cf8f[_0x4f8371(0x19c)][_0x4f8371(0x1fa)]||_0x4f8371(0x19f);if(_0x47cf8f[_0x4f8371(0x1fa)]===_0x4f8371(0x195))_0x591e66=_0x47cf8f[_0x4f8371(0x1d7)];else{if(_0x47cf8f['type']===_0x4f8371(0x275)){if(!_0x47cf8f[_0x4f8371(0x1d7)])return;_0x591e66=_0x47cf8f['value'];}else _0x591e66=_0x47cf8f[_0x4f8371(0x249)];}switch(_0x2a4b09){case _0x4f8371(0x23a):_0x591e66=parseInt(_0x591e66,0xa);break;case _0x4f8371(0x1dc):_0x591e66=parseFloat(_0x591e66);break;case _0x4f8371(0x136):if(typeof _0x591e66!==_0x4f8371(0x136))_0x591e66=_0x591e66===_0x4f8371(0x10a);break;}const _0xd20a6f=_0x56313e['getSettings'](),_0x1bbe33=_0x27f43d[_0x4f8371(0x1a4)]('.');let _0x35cca3=_0xd20a6f;for(let _0x25f1d4=0x0;_0x25f1d4<_0x1bbe33['length']-0x1;_0x25f1d4++){_0x35cca3=_0x35cca3[_0x1bbe33[_0x25f1d4]]=_0x35cca3[_0x1bbe33[_0x25f1d4]]||{};}_0x35cca3[_0x1bbe33[_0x1bbe33[_0x4f8371(0x215)]-0x1]]=_0x591e66;}),_0x56313e[_0x1f6d4d(0x170)](),!_0x30f154&&(log('【手动存档】所有设定已存档封印。',_0x1f6d4d(0x115)),toastr[_0x1f6d4d(0x115)](_0x1f6d4d(0x247),_0x1f6d4d(0x1f2)));}function resetSettingsToUI(){const _0x5ad8f6=_0x11ec;confirm(_0x5ad8f6(0x1fb))&&(_0x56313e[_0x5ad8f6(0x21e)](),loadSettingsToUI(),toastr['info']('翰林院设定已重置为初始状态。','诏曰'));}async function updatePanelStatus(){const _0xa81e66=_0x11ec,_0x50cd30=_0x56313e[_0xa81e66(0x1bf)](),_0x5fc5a0=document['getElementById']('hly-current-character-name'),_0x84ab81=document[_0xa81e66(0x24a)](_0xa81e66(0x1a8));if(_0x50cd30){const _0x4282c0=_0x56313e[_0xa81e66(0x236)]();_0x4282c0&&(_0x5fc5a0[_0xa81e66(0x107)]='会话已锁定',_0x84ab81['textContent']=_0x4282c0['id'],_0x84ab81['title']=_0xa81e66(0x178)+_0x4282c0['id'],_0x5fc5a0[_0xa81e66(0x106)][_0xa81e66(0x217)](_0xa81e66(0x253)),_0x84ab81[_0xa81e66(0x106)]['add'](_0xa81e66(0x253)));}else _0x5fc5a0[_0xa81e66(0x107)]=_0x407f08[_0xa81e66(0x23d)](),_0x84ab81[_0xa81e66(0x107)]=_0x407f08[_0xa81e66(0x149)]()||'无',_0x84ab81['title']='',_0x5fc5a0['classList'][_0xa81e66(0x185)](_0xa81e66(0x253)),_0x84ab81['classList']['remove'](_0xa81e66(0x253));const _0xa201fb=document[_0xa81e66(0x24a)](_0xa81e66(0x181));_0xa201fb[_0xa81e66(0x107)]=_0xa81e66(0x126);try{const _0x32a2d2=await _0x56313e[_0xa81e66(0x101)]();_0xa201fb[_0xa81e66(0x107)]=_0x32a2d2;}catch(_0x5703a6){console['error'](_0xa81e66(0x176),_0x5703a6),_0xa201fb[_0xa81e66(0x107)]=_0xa81e66(0x183),_0xa201fb[_0xa81e66(0x1cc)]=_0xa81e66(0x25d)+_0x5703a6[_0xa81e66(0x22a)];}const _0x3f68c3=document[_0xa81e66(0x24a)](_0xa81e66(0x14c));if(_0x3f68c3&&!_0x3f68c3['dataset'][_0xa81e66(0x1ff)]){const _0x578088=_0x56313e[_0xa81e66(0x1b7)](),_0xa116a5=await _0x56313e['getCollectionId']();if(_0x578088['condensationHistory']&&_0x578088[_0xa81e66(0x1f5)][_0xa116a5]){const _0x11d381=_0x578088[_0xa81e66(0x1f5)][_0xa116a5];_0x3f68c3[_0xa81e66(0x151)]=_0xa81e66(0x110)+_0x11d381['start']+_0xa81e66(0xfe)+_0x11d381[_0xa81e66(0x112)]+_0xa81e66(0x125);}else _0x3f68c3['innerHTML']=_0xa81e66(0x158);}}async function testApi(){const _0x100741=_0x11ec;toastr['info'](_0x100741(0x240),'圣旨');try{await _0x56313e[_0x100741(0x212)](),toastr[_0x100741(0x115)](_0x100741(0x161),'圣意');}catch(_0x4b3071){toastr[_0x100741(0x1d6)](_0x100741(0x192)+_0x4b3071[_0x100741(0x22a)],'警报');}}async function fetchHLYEmbeddingModels(){const _0x146ed9=_0x11ec,_0x3ef17c=document[_0x146ed9(0x24a)]('hly-embedding-model'),_0x223ea5=_0x3ef17c[_0x146ed9(0x249)];_0x3ef17c[_0x146ed9(0x151)]='<option>正在获取...</option>',_0x3ef17c[_0x146ed9(0x19a)]=!![];try{log(_0x146ed9(0x18c),'info');const _0xca34dc=await _0x56313e['fetchEmbeddingModels']();_0x3ef17c['innerHTML']='';if(_0xca34dc[_0x146ed9(0x215)]===0x0){_0x3ef17c[_0x146ed9(0x151)]=_0x146ed9(0x119),toastr[_0x146ed9(0x191)](_0x146ed9(0x11c),_0x146ed9(0x1e6)),log('未能获取到任何模型。',_0x146ed9(0x191));return;}_0xca34dc[_0x146ed9(0x238)](_0x4dabad=>{const _0x1a219c=new Option(_0x4dabad,_0x4dabad);_0x3ef17c['add'](_0x1a219c);}),_0xca34dc['includes'](_0x223ea5)?_0x3ef17c['value']=_0x223ea5:_0x3ef17c['selectedIndex']=0x0,toastr[_0x146ed9(0x115)](_0x146ed9(0x1d4)+_0xca34dc[_0x146ed9(0x215)]+_0x146ed9(0x10c),'圣意'),log('成功获取\x20'+_0xca34dc[_0x146ed9(0x215)]+'\x20个模型。',_0x146ed9(0x115));}catch(_0x13efdb){console[_0x146ed9(0x1d6)](_0x146ed9(0x271),_0x13efdb),toastr['error'](_0x146ed9(0x121)+_0x13efdb['message'],_0x146ed9(0x15e)),log(_0x146ed9(0x121)+_0x13efdb[_0x146ed9(0x22a)],_0x146ed9(0x1d6)),_0x3ef17c['innerHTML']=_0x146ed9(0x1d1);}finally{_0x3ef17c[_0x146ed9(0x19a)]=![];}}async function fetchHLYRerankModels(){const _0xd2b635=_0x11ec,_0x54939b=document[_0xd2b635(0x24a)]('hly-rerank-model'),_0x14a291=_0x54939b[_0xd2b635(0x249)];_0x54939b[_0xd2b635(0x151)]='<option>正在获取...</option>',_0x54939b[_0xd2b635(0x19a)]=!![];try{log(_0xd2b635(0x143),_0xd2b635(0x187));const _0x1c4e78=await _0x56313e[_0xd2b635(0x1d3)]();_0x54939b[_0xd2b635(0x151)]='';if(_0x1c4e78[_0xd2b635(0x215)]===0x0){_0x54939b['innerHTML']=_0xd2b635(0x119),toastr[_0xd2b635(0x191)](_0xd2b635(0x274),_0xd2b635(0x1e6)),log('未能获取到任何Rerank模型。',_0xd2b635(0x191));return;}_0x1c4e78[_0xd2b635(0x238)](_0x2bc03a=>{const _0x3f1bf5=_0xd2b635,_0x155f52=new Option(_0x2bc03a,_0x2bc03a);_0x54939b[_0x3f1bf5(0x217)](_0x155f52);}),_0x1c4e78[_0xd2b635(0x1f8)](_0x14a291)?_0x54939b[_0xd2b635(0x249)]=_0x14a291:_0x54939b[_0xd2b635(0x15b)]=0x0,toastr[_0xd2b635(0x115)]('成功获取\x20'+_0x1c4e78[_0xd2b635(0x215)]+_0xd2b635(0x16c),'圣意'),log(_0xd2b635(0x1d4)+_0x1c4e78['length']+_0xd2b635(0x16c),_0xd2b635(0x115));}catch(_0x53ff64){console[_0xd2b635(0x1d6)](_0xd2b635(0x267),_0x53ff64),toastr[_0xd2b635(0x1d6)](_0xd2b635(0x22d)+_0x53ff64[_0xd2b635(0x22a)],_0xd2b635(0x15e)),log('获取Rerank模型失败:\x20'+_0x53ff64[_0xd2b635(0x22a)],_0xd2b635(0x1d6)),_0x54939b[_0xd2b635(0x151)]=_0xd2b635(0x1d1);}finally{_0x54939b[_0xd2b635(0x19a)]=![];}}async function purgeStorage(){const _0x8a2a99=_0x11ec;if(confirm(_0x8a2a99(0x150))){toastr[_0x8a2a99(0x187)](_0x8a2a99(0x1a1),'圣旨');const _0x56ae77=await _0x56313e[_0x8a2a99(0x134)]();_0x56ae77?toastr[_0x8a2a99(0x115)](_0x8a2a99(0x1b8),'圣意'):toastr[_0x8a2a99(0x1d6)]('清空宝库失败。','警报'),await updatePanelStatus();}}async function startCondensation(){const _0x4efb22=_0x11ec,_0x2b0b92=document[_0x4efb22(0x24a)](_0x4efb22(0x14c)),_0xc623bf=_0x2b0b92[_0x4efb22(0x19c)][_0x4efb22(0x20c)],_0x4d72d4=document[_0x4efb22(0x24a)](_0x4efb22(0x184))[_0x4efb22(0x249)],_0x1a8aea=document[_0x4efb22(0x24a)](_0x4efb22(0x14e))[_0x4efb22(0x249)],_0x26e1d2={'start':parseInt(_0x4d72d4),'end':parseInt(_0x1a8aea)};try{let _0x1ae054;_0xc623bf?(log(_0x4efb22(0x241),_0x4efb22(0x187)),toastr['info']('正在处理您确认后的文书...','圣旨'),_0x1ae054=JSON[_0x4efb22(0x194)](_0xc623bf),delete _0x2b0b92['dataset'][_0x4efb22(0x20c)]):(log(_0x4efb22(0x22b),'info'),toastr[_0x4efb22(0x187)](_0x4efb22(0x12a),'圣旨'),_0x1ae054=_0x56313e[_0x4efb22(0x157)]());if(!_0x1ae054||_0x1ae054[_0x4efb22(0x215)]===0x0){toastr[_0x4efb22(0x254)](_0x4efb22(0x160),'翰林院启奏'),_0x2b0b92[_0x4efb22(0x107)]='未找到符合条件的消息。';return;}_0x2b0b92[_0x4efb22(0x107)]=_0x4efb22(0x1d5)+_0x1ae054[_0x4efb22(0x215)]+_0x4efb22(0x25c),toastr[_0x4efb22(0x187)]('已采集\x20'+_0x1ae054[_0x4efb22(0x215)]+_0x4efb22(0x25c),_0x4efb22(0x1e6));const _0x45d345=await _0x56313e[_0x4efb22(0x1d2)](_0x1ae054,log,_0x26e1d2);if(_0x45d345[_0x4efb22(0x115)]){toastr[_0x4efb22(0x115)](_0x4efb22(0x14b)+_0x45d345[_0x4efb22(0x220)]+'\x20条忆识。','大功告成');const _0x3568e7=_0x26e1d2[_0x4efb22(0x112)]===0x0?getContext()[_0x4efb22(0x26f)]['length']:_0x26e1d2['end'];_0x2b0b92[_0x4efb22(0x107)]=_0x4efb22(0x196)+_0x26e1d2[_0x4efb22(0x17e)]+_0x4efb22(0x15a)+_0x3568e7+_0x4efb22(0x17f)+_0x45d345[_0x4efb22(0x220)]+_0x4efb22(0x1f6);}else throw new Error(_0x45d345[_0x4efb22(0x1d6)]||'未知错误');}catch(_0x4f5982){console['error'](_0x4efb22(0x14d),_0x4f5982),toastr[_0x4efb22(0x1d6)]('凝识失败:\x20'+_0x4f5982[_0x4efb22(0x22a)],_0x4efb22(0x15e)),_0x2b0b92[_0x4efb22(0x107)]=_0x4efb22(0x1b2)+_0x4f5982[_0x4efb22(0x22a)];}finally{await updatePanelStatus();}}async function loadWorldbookList(){const _0x50f7fc=_0x11ec,_0x3f5f1e=document['getElementById'](_0x50f7fc(0x233));if(!_0x3f5f1e)return;try{log(_0x50f7fc(0x11d),'info');const _0x4c1e9d=await _0x4b4d4f[_0x50f7fc(0x208)]();_0x3f5f1e[_0x50f7fc(0x151)]='<option\x20value=\x22\x22>请选择一个书库...</option>';if(_0x4c1e9d[_0x50f7fc(0x215)]===0x0){_0x3f5f1e['innerHTML']=_0x50f7fc(0x12f);return;}_0x4c1e9d[_0x50f7fc(0x238)](_0x291eb4=>{const _0x443e18=_0x50f7fc,_0x154ea1=new Option(_0x291eb4,_0x291eb4);_0x3f5f1e[_0x443e18(0x217)](_0x154ea1);}),log(_0x50f7fc(0x11b)+_0x4c1e9d[_0x50f7fc(0x215)]+_0x50f7fc(0x248),'success');}catch(_0x9242a0){console['error'](_0x50f7fc(0x237),_0x9242a0),log(_0x50f7fc(0x102)+_0x9242a0[_0x50f7fc(0x22a)],_0x50f7fc(0x1d6)),_0x3f5f1e[_0x50f7fc(0x151)]=_0x50f7fc(0x18e);}}function _0x4004(){const _0x5e6b42=['正在准备凝识...','injection','rerank','fas\x20fa-lock-open','hly-exclusion-rules-container','<option\x20value=\x22\x22>未找到任何书库</option>','hly-retrieval-notify','findIndex','录入内容不能为空。','children','purgeStorage','insertAdjacentHTML','boolean','template','\x22></i>\x20[','正在查询宝库状态...','文书录入失败:\x20','exclusionRules','文书已成功录入宝库,新增\x20','5082363gzwsnj','previewHLYCondensation','\x22\x20placeholder=\x22开始字符,\x20如\x20<!--\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>到</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20class=\x22hly-imperial-brush\x22\x20value=\x22','[实时刷新]\x20批次完成忆识总数已更新。','hly-delete-rule-btn','ingestHLYManualText','开始获取Rerank模型列表...','addEventListener','宝库状态','val','<i\x20class=\x22fa-solid\x20','scripts/extensions/third-party/ST-Amily2-Chat-Optimisation/HanLin.md','getChatId','.hly-exclusion-rule-row','凝识完成!新增\x20','hly-condensation-results','[翰林院-枢纽]\x20凝识过程发生错误:','hly-layer-end','createElement','此操作将彻底清空当前角色的所有忆识(向量),且无法恢复。您确定要继续吗?','innerHTML','hly-hist-select-entry','\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22hly-exclusion-rules-container\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<p\x20class=\x22hly-notes\x22>在这里定义需要从提取内容中排除的文本片段。例如排除HTML注释可以设置开始字符为\x20`<!--`,结束字符为\x20`-->`。</p>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22hly-rules-list\x22>','hanlinyuan-ingest-novel-file-name','amily2_open_rag_palace','toggleSessionLock','getMessagesForCondensation','<p\x20class=\x22hly-record-hint\x22>可在此预览凝识结果。</p>','[翰林院-枢纽]\x20加载《','\x20楼到第\x20','selectedIndex','根据标签提取或内容排除条件,未找到任何有效内容。','className','严重错误','send_date','未找到符合条件的消息可供凝识。','神力连接通畅!','condensation.exclusionRules','toLocaleTimeString','data','purgeHLYStorage','hly-log-entry\x20','</div>','fetchHLYRerankModels',',\x20忆识总数=','map','hly-include-ai','\x20个Rerank模型。','加载条目失败:\x20','total','name','saveSettings','正在读取文件...','hly-injection-template','preventDefault','azure','hanlinyuan-ingest-status','[翰林院-枢纽]\x20更新忆识数量失败:',']\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</summary>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-preview-content\x22>\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<textarea\x20class=\x22hly-preview-textarea\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-floor=\x22','当前所有操作都将指向这个锁定的宝库:','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-preview-item-v2\x22\x20id=\x22','hly-injection-depth','未知的编纂错误','[data-setting-key]','<option\x20value=\x22\x22>请先选择书库</option>','start','\x20楼已成功凝识新增\x20','手动录入失败:\x20','hly-current-vector-count','预览失败:\x20','N/A','hly-layer-start','remove','floor','info','hly-batch-size','.hly-preview-delete-btn-v2','options','trim','开始获取模型列表...','input','<option\x20value=\x22\x22>加载失败</option>','hly-rerank-top-n','input[name=\x22','warn','神力连接失败:\x20','testHLYApi','parse','checkbox','聊天记录从第\x20','files','initialize','each','disabled','\x0a</pre>\x0a\x20\x20\x20\x20\x20\x20\x20\x20','dataset','is_user','任务已由用户中止。进度已保存,可随时继续。','string','.hly-preview-item-v2','正在清空宝库...','未选择文件','\x0a<pre>\x0a翰林院宝库状态\x0a--------------------\x0a集合ID:\x20','split','position',')\x20的编纂任务已完成。','matchThreshold','hly-current-chat-id','AbortError','apiEndpoint','hly-rerank-enabled','12426dbFPLV','condensation','customApiUrl','hly-include-user','target','已选择\x20','凝识失败:\x20','hly-api-endpoint','fetchHLYEmbeddingModels','hly-overlap-size','depth','getSettings','宝库已清空。','showHLYStats','hanlinyuan-ingest-novel-file-input','from','hly-rerank-api-key','enabled','》中的条目\x20(Key:\x20','isSessionLocked','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨','\x20进行编纂...','startHLYHistoriography','hly-exclusion-rules-btn','custom','[断点续传]\x20用户选择继续任务\x20','hly-injection-role','启禀大人,发现此书上次录入已完成\x20','\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20class=\x22hly-imperial-brush\x22\x20value=\x22','会话已解锁。','hanlinyuan-ingest-abort','准备对《','title','错误:\x20','is-user','style','contains','<option>获取失败</option>','processCondensation','fetchRerankModels','成功获取\x20','已采集\x20','error','checked','model','任务完成!成功录入\x20','】已成功编纂入库。','display','float','[翰林院-枢纽]\x20未能获取SillyTavern上下文绑定失败。','6XVFDsH','hly-rerank-url','join','内容排除规则已保存。','fa-exclamation-triangle','成功录入\x20','hly-tag-extraction-toggle','signal','翰林院启奏','691228naoPyk','锁定会话','click','hly-tag-input-container','用户请求查看宝库状态。','change','appendChild','processed','未知错误','处理中:\x20','tagExtractionEnabled','圣旨已达','querySelectorAll','active','condensationHistory','\x20条忆识。','\x20块开始。','includes','overlap','type','您确定要将所有设定恢复为出厂默认值吗?','.hly-nav-item','\x0a忆识总数:\x20','startHLYCondensation','finalText','任务已中止。','hly-match-threshold','4590530MIcWqr','hly-rerank-model','大功告成','.hly-log-placeholder','closest','apiKey','getAvailableWorldbooks','getLoresForWorldbook','log-error','user','finalMessages','<div\x20class=\x22hly-preview-container-v2\x22>','收到手动录入请求,文本长度:\x20','编纂任务已完成。','编纂失败:\x20','编纂任务已开始...','testApiConnection','.hly-preview-textarea','298097HGmeVQ','length','retrieval','add','根据当前勾选条件,未找到符合的消息可供预览。','find','\x22\x20placeholder=\x22结束字符,\x20如\x20-->\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22hly-delete-rule-btn\x22\x20title=\x22删除此规则\x22>&times;</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20','开始对《','\x20个条目。','hly-session-lock-btn','resetSettings','input[name=\x22hly-injection-position\x22]','count','content','会话已锁定到宝库:\x20','filter','\x0a所用模型:\x20','hly-embedding-model','hly-condensation-enabled','key','totalChunks','messageTypes','message','未检测到预览文本,按标准流程采集消息...','hly-query-message-count','获取Rerank模型失败:\x20','请先选择一个\x20.txt\x20文件','6293104ZepSKq','》中条目\x20(Key:\x20','mes','查看宝库状态成功集合ID=','hly-hist-select-library','<option\x20value=\x22\x22>请选择一个条目...</option>','hly-log-output','getLockedSessionInfo','[翰林院-枢纽]\x20加载书库列表失败:','forEach',',重新开始。','integer','预览内容已更新,可随时开始凝识。','\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','getCharacterName','.hly-tab-pane','手动录入','正在测试神力连接...','检测到预览后待处理的消息对象,开始精确凝识...','layerEnd','hlyLog','chunkSize','查询宝库状态失败:\x20','span','翰林院设定已存档封印。','\x20个书库。','value','getElementById','解锁会话','。进度已保存,可稍后重试。','text','\x20块继续录入。','notify','processedChunks','hly-chunk-size','novel','hly-locked-status','warning','embeddingModel','block','15vCPVeb','preview-item-','\x20个知识块。','push','toFixed','\x20条消息开始凝识...','无法获取总数:\x20','\x0a--------------------\x0aAPI端点:\x20',')\x20进行编纂...','fas\x20fa-lock','comment','none','\x27\x20已更新为:\x20','settingKey','-tab','翰林院使用教程','[翰林院-枢纽]\x20获取Rerank模型列表失败:','hybrid_alpha','log-info','1757kFbAgG','hanlinyuan-ingest-novel-start','abort','\x22\x20title=\x22删除此条\x22>&times;</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20','toggle','chat','amily2_open_hanlin_tutorial','[翰林院-枢纽]\x20获取模型列表失败:','hly-retrieval-enabled','querySelector','未能获取到任何Rerank模型。','radio','\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-send-date=\x22','getVectorCount','加载书库列表失败:\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-exclusion-rule-row\x22\x20data-index=\x22','[自动保存]\x20设置项\x20\x27','%。是否从上次中断之处继续?','classList','textContent','ingestTextToHanlinyuan','点击以解锁,让翰林院跟随当前角色','true','hly-api-key','\x20个模型。','点击以锁定,让翰林院固定操作当前角色的宝库','getCollectionId','hly-manual-text','<p\x20class=\x22hly-record-hint\x22><i>上次已从第\x20','saveHLYSettings','end','log-warn','batchSize','success','保存规则','用户尝试录入空文本。','31807340HrFVJo','<option>未找到模型</option>','\x20(Key:\x20','成功加载\x20','未能获取到任何模型。','正在获取可用书库列表...','[断点续传]\x20用户选择放弃旧任务\x20','hly-custom-endpoint-docket','圣谕不明','获取模型失败:\x20','fa-times-circle','advanced','stringify','\x20楼。</i></p>','...','beforeend','确认并更新预览','tab'];_0x4004=function(){return _0x5e6b42;};return _0x4004();}async function handleWorldbookSelectionChange(){const _0x284a2a=_0x11ec,_0x4938ce=document['getElementById'](_0x284a2a(0x233)),_0x3dac29=document['getElementById'](_0x284a2a(0x152)),_0x2fe063=_0x4938ce['value'];_0x3dac29['innerHTML']='<option\x20value=\x22\x22>正在加载条目...</option>',_0x3dac29[_0x284a2a(0x19a)]=!![];if(!_0x2fe063){_0x3dac29[_0x284a2a(0x151)]=_0x284a2a(0x17d);return;}try{log('正在为《'+_0x2fe063+'》获取条目列表...',_0x284a2a(0x187));const _0x624f57=await _0x4b4d4f[_0x284a2a(0x209)](_0x2fe063);_0x3dac29['innerHTML']=_0x284a2a(0x234);if(_0x624f57[_0x284a2a(0x215)]===0x0){_0x3dac29[_0x284a2a(0x151)]='<option\x20value=\x22\x22>此书库为空</option>';return;}_0x624f57[_0x284a2a(0x238)](_0x5af1ea=>{const _0x36f93b=_0x284a2a,_0x216d6c=new Option(_0x5af1ea[_0x36f93b(0x261)]+_0x36f93b(0x11a)+_0x5af1ea[_0x36f93b(0x227)]+')',_0x5af1ea[_0x36f93b(0x227)]);_0x3dac29[_0x36f93b(0x217)](_0x216d6c);}),log(_0x284a2a(0x11b)+_0x624f57[_0x284a2a(0x215)]+_0x284a2a(0x21c),_0x284a2a(0x115));}catch(_0x32d233){console[_0x284a2a(0x1d6)](_0x284a2a(0x159)+_0x2fe063+'》的条目失败:',_0x32d233),log(_0x284a2a(0x16d)+_0x32d233[_0x284a2a(0x22a)],'error'),_0x3dac29['innerHTML']=_0x284a2a(0x18e);}finally{_0x3dac29['disabled']=![];}}async function startHistoriography(){const _0x4f4309=_0x11ec,_0x146172=document[_0x4f4309(0x24a)](_0x4f4309(0x233))[_0x4f4309(0x249)],_0x1a404c=document[_0x4f4309(0x24a)](_0x4f4309(0x152))[_0x4f4309(0x249)],_0x86886b=document[_0x4f4309(0x24a)]('hly-historiography-results');if(!_0x146172||!_0x1a404c){toastr[_0x4f4309(0x254)]('请先选择一个书库和要编纂的条目。',_0x4f4309(0x120));return;}_0x86886b[_0x4f4309(0x107)]=_0x4f4309(0x1cb)+_0x146172+_0x4f4309(0x1be)+_0x1a404c+_0x4f4309(0x25f),toastr[_0x4f4309(0x187)](_0x4f4309(0x211),'圣旨'),log(_0x4f4309(0x21b)+_0x146172+'》-'+_0x1a404c+_0x4f4309(0x1c1),_0x4f4309(0x187));try{const _0x1e01e8=await _0x4b4d4f['executeCompilation'](_0x146172,_0x1a404c);if(_0x1e01e8[_0x4f4309(0x115)]){const _0x2f304b=document[_0x4f4309(0x24a)](_0x4f4309(0x152)),_0x5bc2b1=_0x2f304b['options'][_0x2f304b[_0x4f4309(0x15b)]][_0x4f4309(0x24d)],_0x904c07='《'+_0x146172+'》中的条目【'+_0x5bc2b1+_0x4f4309(0x1da);_0x86886b[_0x4f4309(0x107)]=_0x904c07,toastr['success'](_0x4f4309(0x20f),_0x4f4309(0x204)),log('对《'+_0x146172+_0x4f4309(0x230)+_0x1a404c+_0x4f4309(0x1a6),_0x4f4309(0x115));}else throw new Error(_0x1e01e8[_0x4f4309(0x1d6)]||_0x4f4309(0x17b));}catch(_0x5ae9c7){console[_0x4f4309(0x1d6)]('[翰林院-枢纽]\x20编纂过程发生错误:',_0x5ae9c7),toastr['error']('编纂失败:\x20'+_0x5ae9c7[_0x4f4309(0x22a)],_0x4f4309(0x15e)),_0x86886b[_0x4f4309(0x107)]=_0x4f4309(0x210)+_0x5ae9c7['message'];}}function _0x11ec(_0xd207dd,_0x47a492){const _0x4004a1=_0x4004();return _0x11ec=function(_0x11ec62,_0x5bf668){_0x11ec62=_0x11ec62-0xfe;let _0x2140a1=_0x4004a1[_0x11ec62];return _0x2140a1;},_0x11ec(_0xd207dd,_0x47a492);}async function showStats(){const _0x4c123a=_0x11ec;try{log(_0x4c123a(0x1eb),_0x4c123a(0x187)),toastr['info'](_0x4c123a(0x139),'圣旨');const _0x13f9ac=await _0x56313e[_0x4c123a(0x101)](),_0x51a974=await _0x56313e[_0x4c123a(0x10e)](),_0x1129f8=_0x56313e[_0x4c123a(0x1b7)](),_0x4f8998=_0x4c123a(0x1a3)+_0x51a974+_0x4c123a(0x1fd)+_0x13f9ac+_0x4c123a(0x25e)+_0x1129f8[_0x4c123a(0x216)][_0x4c123a(0x1aa)]+_0x4c123a(0x224)+_0x1129f8[_0x4c123a(0x216)]['embeddingModel']+_0x4c123a(0x19b);toastr[_0x4c123a(0x187)](_0x4f8998,_0x4c123a(0x145),{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log(_0x4c123a(0x232)+_0x51a974+_0x4c123a(0x169)+_0x13f9ac,'success');}catch(_0x53cd6){console['error']('[翰林院-枢纽]\x20查询宝库状态失败:',_0x53cd6),toastr[_0x4c123a(0x1d6)](_0x4c123a(0x245)+_0x53cd6[_0x4c123a(0x22a)],_0x4c123a(0x15e)),log(_0x4c123a(0x245)+_0x53cd6['message'],_0x4c123a(0x1d6));}}function showExclusionRulesModal(){const _0x2d4463=_0x11ec,_0x3c89e7=_0x56313e[_0x2d4463(0x1b7)](),_0x168f45=_0x3c89e7[_0x2d4463(0x1ad)][_0x2d4463(0x13b)]||[],_0x33c2da=(_0xcddc20={'start':'','end':''},_0xcf62f4)=>_0x2d4463(0x103)+_0xcf62f4+_0x2d4463(0x1c8)+_0xcddc20['start']+_0x2d4463(0x13f)+_0xcddc20[_0x2d4463(0x112)]+_0x2d4463(0x21a),_0x35b60b=_0x168f45[_0x2d4463(0x16a)](_0x33c2da)[_0x2d4463(0x1e0)](''),_0x30bc95=_0x2d4463(0x153)+_0x35b60b+'</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20id=\x22hly-add-rule-btn\x22\x20class=\x22hly-action-button\x22\x20style=\x22margin-top:\x2010px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<i\x20class=\x22fas\x20fa-plus\x22></i>\x20添加新规则\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<style>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.hly-exclusion-rule-row\x20{\x20display:\x20flex;\x20align-items:\x20center;\x20gap:\x2010px;\x20margin-bottom:\x2010px;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.hly-exclusion-rule-row\x20input\x20{\x20flex-grow:\x201;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.hly-delete-rule-btn\x20{\x20background:\x20#c0392b;\x20color:\x20white;\x20border:\x20none;\x20border-radius:\x2050%;\x20width:\x2024px;\x20height:\x2024px;\x20cursor:\x20pointer;\x20font-size:\x2016px;\x20line-height:\x2024px;\x20text-align:\x20center;\x20padding:\x200;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20</style>\x0a\x20\x20\x20\x20';showHtmlModal('编辑内容排除规则',_0x30bc95,{'okText':_0x2d4463(0x116),'onOk':_0xf63251=>{const _0x20ff72=_0x2d4463,_0x32f4fe=[];_0xf63251[_0x20ff72(0x219)]('.hly-exclusion-rule-row')[_0x20ff72(0x199)](function(){const _0x595da5=_0x20ff72,_0x2e6f2c=$(this)['find']('input')['eq'](0x0)['val']()[_0x595da5(0x18b)](),_0x23f60b=$(this)[_0x595da5(0x219)](_0x595da5(0x18d))['eq'](0x1)[_0x595da5(0x146)]()[_0x595da5(0x18b)]();_0x2e6f2c&&_0x23f60b&&_0x32f4fe[_0x595da5(0x25a)]({'start':_0x2e6f2c,'end':_0x23f60b});}),updateAndSaveSetting(_0x20ff72(0x162),_0x32f4fe),toastr[_0x20ff72(0x115)](_0x20ff72(0x1e1),_0x20ff72(0x1f2));}});const _0x399567=document[_0x2d4463(0x24a)](_0x2d4463(0x12e)),_0x478f3c=_0x399567['querySelector']('#hly-rules-list');_0x399567['querySelector']('#hly-add-rule-btn')[_0x2d4463(0x144)]('click',()=>{const _0x21d857=_0x2d4463,_0x54cffc=_0x478f3c[_0x21d857(0x133)][_0x21d857(0x215)],_0x48a7eb=_0x33c2da({'start':'','end':''},_0x54cffc);_0x478f3c[_0x21d857(0x135)](_0x21d857(0x127),_0x48a7eb);}),_0x478f3c[_0x2d4463(0x144)](_0x2d4463(0x1e9),_0xcb3287=>{const _0x1c83a4=_0x2d4463;_0xcb3287[_0x1c83a4(0x1b0)]['classList'][_0x1c83a4(0x1d0)](_0x1c83a4(0x141))&&_0xcb3287['target'][_0x1c83a4(0x206)](_0x1c83a4(0x14a))['remove']();});}function previewCondensation(){const _0x423b35=_0x11ec,_0x5768c0=document[_0x423b35(0x24a)]('hly-condensation-results');try{const _0xc47deb=_0x56313e[_0x423b35(0x1b7)](),_0x60f934=_0xc47deb[_0x423b35(0x1ad)][_0x423b35(0x13b)]||[],_0x2fa6c9={'user':document[_0x423b35(0x24a)](_0x423b35(0x1af))['checked'],'ai':document[_0x423b35(0x24a)](_0x423b35(0x16b))[_0x423b35(0x1d7)]},_0x12b970=document[_0x423b35(0x24a)](_0x423b35(0x1e4))[_0x423b35(0x1d7)],_0x208aca=_0x12b970?document['getElementById']('hly-tag-input')[_0x423b35(0x249)][_0x423b35(0x1a4)](',')[_0x423b35(0x16a)](_0xc2cff9=>_0xc2cff9[_0x423b35(0x18b)]())[_0x423b35(0x223)](Boolean):[],_0x1d5950=_0x56313e['getMessagesForCondensation'](_0x2fa6c9);if(!_0x1d5950||_0x1d5950[_0x423b35(0x215)]===0x0){_0x5768c0[_0x423b35(0x107)]=_0x423b35(0x218),toastr[_0x423b35(0x254)]('未找到符合条件的消息。',_0x423b35(0x1e6));return;}const _0x1d5e18=getContext()[_0x423b35(0x26f)],_0x2cd0c8=_0x1d5950['map']((_0x42dfb6,_0x3019af)=>{const _0x15f79e=_0x423b35;let _0x1572be;if(_0x42dfb6[_0x15f79e(0x19d)])_0x1572be=_0x42dfb6['mes'];else{if(_0x12b970&&_0x208aca[_0x15f79e(0x215)]>0x0){const _0x10eb09=extractBlocksByTags(_0x42dfb6[_0x15f79e(0x231)],_0x208aca);_0x1572be=_0x10eb09['join']('\x0a\x0a');}else _0x1572be=_0x42dfb6[_0x15f79e(0x231)];_0x1572be=applyExclusionRules(_0x1572be,_0x60f934);}const _0x21ac8f=_0x1d5e18[_0x15f79e(0x131)](_0x3d8730=>_0x3d8730===_0x42dfb6),_0x25a8c6=_0x21ac8f!==-0x1?_0x21ac8f+0x1:-0x1;return{'id':_0x15f79e(0x258)+_0x3019af,'name':_0x42dfb6[_0x15f79e(0x16f)],'content':_0x1572be[_0x15f79e(0x18b)](),'floor':_0x25a8c6,'is_user':_0x42dfb6[_0x15f79e(0x19d)],'send_date':_0x42dfb6[_0x15f79e(0x15f)]};})[_0x423b35(0x223)](_0x177217=>_0x177217[_0x423b35(0x221)]);if(_0x2cd0c8[_0x423b35(0x215)]===0x0){_0x5768c0['textContent']=_0x423b35(0x15c),toastr['warning'](_0x423b35(0x15c),_0x423b35(0x1e6));return;}const _0xcf6fb8=_0x2cd0c8['map']((_0x336d5,_0x4b50b7)=>_0x423b35(0x179)+_0x336d5['id']+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<details\x20class=\x22hly-preview-details\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<summary\x20class=\x22hly-preview-summary\x22>\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'+_0x336d5[_0x423b35(0x186)]+'\x20楼:\x20['+_0x336d5[_0x423b35(0x16f)]+_0x423b35(0x177)+_0x336d5[_0x423b35(0x186)]+_0x423b35(0x23c)+_0x336d5['is_user']+_0x423b35(0x100)+_0x336d5[_0x423b35(0x15f)]+'\x22>'+_0x336d5[_0x423b35(0x221)]+'</textarea>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</details>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22hly-preview-delete-btn-v2\x22\x20data-target=\x22'+_0x336d5['id']+_0x423b35(0x26d))[_0x423b35(0x1e0)]('');showHtmlModal('预览并编辑凝识内容',_0x423b35(0x20d)+_0xcf6fb8+_0x423b35(0x167),{'okText':_0x423b35(0x128),'onOk':_0x407dbe=>{const _0x847834=_0x423b35,_0x398f9d=[];_0x407dbe[_0x847834(0x219)](_0x847834(0x1a0))['each'](function(){const _0x3ce8e2=_0x847834,_0x4937a4=$(this)[_0x3ce8e2(0x219)](_0x3ce8e2(0x213)),_0x529518=_0x4937a4[_0x3ce8e2(0x146)]();_0x529518[_0x3ce8e2(0x18b)]()&&_0x398f9d[_0x3ce8e2(0x25a)]({'mes':_0x529518,'is_user':_0x4937a4[_0x3ce8e2(0x164)](_0x3ce8e2(0x1ce)),'send_date':_0x4937a4[_0x3ce8e2(0x164)]('send-date'),'floor':_0x4937a4[_0x3ce8e2(0x164)]('floor')});}),_0x5768c0[_0x847834(0x19c)]['finalMessages']=JSON['stringify'](_0x398f9d);const _0x22b912=document['getElementById']('hly-layer-start')['value'],_0x4a5ef5=document['getElementById'](_0x847834(0x14e))[_0x847834(0x249)];_0x5768c0[_0x847834(0x107)]=_0x847834(0x1b1)+_0x22b912+'\x20楼到\x20'+_0x4a5ef5+'\x20楼的内容共\x20'+_0x398f9d['length']+'\x20条有效条目请点击“开始凝识”进入自动向量化流程。',toastr['success'](_0x847834(0x23b),_0x847834(0x1f2));}}),$(_0x423b35(0x189))['on'](_0x423b35(0x1e9),function(_0x25f450){const _0x13f9d8=_0x423b35;_0x25f450[_0x13f9d8(0x173)]();const _0x529d91=$(this)[_0x13f9d8(0x164)](_0x13f9d8(0x1b0));$('#'+_0x529d91)['remove']();});}catch(_0x241d30){console[_0x423b35(0x1d6)]('[翰林院-枢纽]\x20预览过程发生错误:',_0x241d30),_0x5768c0['textContent']=_0x423b35(0x182)+_0x241d30[_0x423b35(0x22a)],toastr[_0x423b35(0x1d6)](_0x423b35(0x182)+_0x241d30['message'],_0x423b35(0x15e));}}function log(_0x5f24bf,_0x58ae8a='info'){const _0x5e1411=_0x11ec,_0x5490dc=document['getElementById'](_0x5e1411(0x235));if(!_0x5490dc)return;const _0x51f3fa=document[_0x5e1411(0x14f)]('p'),_0x4781a9=new Date()[_0x5e1411(0x163)]();let _0x185020='fa-circle-info',_0x4067fc=_0x5e1411(0x269);switch(_0x58ae8a){case'success':_0x185020='fa-check-circle',_0x4067fc='log-success';break;case _0x5e1411(0x1d6):_0x185020=_0x5e1411(0x122),_0x4067fc=_0x5e1411(0x20a);break;case _0x5e1411(0x191):_0x185020=_0x5e1411(0x1e2),_0x4067fc=_0x5e1411(0x113);break;}_0x51f3fa[_0x5e1411(0x15d)]=_0x5e1411(0x166)+_0x4067fc,_0x51f3fa[_0x5e1411(0x151)]=_0x5e1411(0x147)+_0x185020+_0x5e1411(0x138)+_0x4781a9+']\x20'+_0x5f24bf;const _0xbb631b=_0x5490dc[_0x5e1411(0x273)](_0x5e1411(0x205));_0xbb631b&&_0xbb631b[_0x5e1411(0x185)](),_0x5490dc[_0x5e1411(0x1ed)](_0x51f3fa),_0x5490dc['scrollTop']=_0x5490dc['scrollHeight'];}async function ingestManualText(){const _0x366589=_0x11ec,_0x97af80=document[_0x366589(0x24a)](_0x366589(0x10f)),_0x422f42=_0x97af80['value'][_0x366589(0x18b)]();if(!_0x422f42){toastr['warning'](_0x366589(0x132),'翰林院启奏'),log(_0x366589(0x117),_0x366589(0x191));return;}log(_0x366589(0x20e)+_0x422f42[_0x366589(0x215)],'info'),toastr['info']('正在处理您提交的文书...','圣旨');try{const _0x3c2665=await _0x56313e[_0x366589(0x108)](_0x422f42,'manual',_0x366589(0x23f));if(_0x3c2665[_0x366589(0x115)])toastr[_0x366589(0x115)](_0x366589(0x13c)+_0x3c2665[_0x366589(0x220)]+_0x366589(0x1f6),_0x366589(0x204)),log('手动录入成功,新增\x20'+_0x3c2665['count']+'\x20条忆识。',_0x366589(0x115)),_0x97af80['value']='';else throw new Error(_0x3c2665[_0x366589(0x1d6)]||_0x366589(0x1ef));}catch(_0x1bea8a){console[_0x366589(0x1d6)]('[翰林院-枢纽]\x20手动录入过程发生错误:',_0x1bea8a),toastr[_0x366589(0x1d6)](_0x366589(0x13a)+_0x1bea8a[_0x366589(0x22a)],_0x366589(0x15e)),log(_0x366589(0x180)+_0x1bea8a[_0x366589(0x22a)],'error');}finally{await updatePanelStatus();}}