Files
ST-Amily2-Chat-Optimisation…/ui/hanlinyuan-bindings.js
2025-09-17 20:45:41 +08:00

2 lines
62 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const _0x1cfca3=_0x3813;(function(_0x39bbf3,_0x5b21fc){const _0x1fdd76=_0x3813,_0x55f706=_0x39bbf3();while(!![]){try{const _0x33b1bd=parseInt(_0x1fdd76(0x171))/0x1*(parseInt(_0x1fdd76(0x1be))/0x2)+parseInt(_0x1fdd76(0x2d3))/0x3*(-parseInt(_0x1fdd76(0x2bd))/0x4)+parseInt(_0x1fdd76(0x136))/0x5*(parseInt(_0x1fdd76(0x2ab))/0x6)+parseInt(_0x1fdd76(0x2e3))/0x7*(parseInt(_0x1fdd76(0x279))/0x8)+-parseInt(_0x1fdd76(0x2d6))/0x9+parseInt(_0x1fdd76(0x16f))/0xa*(parseInt(_0x1fdd76(0x15b))/0xb)+-parseInt(_0x1fdd76(0x1cd))/0xc;if(_0x33b1bd===_0x5b21fc)break;else _0x55f706['push'](_0x55f706['shift']());}catch(_0x15b88b){_0x55f706['push'](_0x55f706['shift']());}}}(_0x4621,0xc37a8));import{getContext}from'/scripts/extensions.js';import*as _0x589651 from'../core/rag-processor.js';import*as _0x3b2ead from'../core/historiographer.js';import*as _0x1e2c21 from'../core/utils/context-utils.js';function _0x3813(_0x4d2163,_0x47d3c5){const _0x462170=_0x4621();return _0x3813=function(_0x3813dc,_0x3f82d2){_0x3813dc=_0x3813dc-0x122;let _0x453ea5=_0x462170[_0x3813dc];return _0x453ea5;},_0x3813(_0x4d2163,_0x47d3c5);}import*as _0x481a58 from'../core/ingestion-manager.js';import{showContentModal,showHtmlModal}from'./page-window.js';import{extractBlocksByTags,applyExclusionRules}from'../core/utils/rag-tag-extractor.js';_0x1cfca3(0x27f);function setupGlobalEventHandlers(){const _0x32c806=_0x1cfca3;window[_0x32c806(0x18b)]=()=>saveSettingsFromUI(![]),window[_0x32c806(0x1c4)]=resetSettingsToUI,window[_0x32c806(0x123)]=testApi,window['fetchHLYEmbeddingModels']=fetchHLYEmbeddingModels,window[_0x32c806(0x1ad)]=fetchHLYRerankModels,window[_0x32c806(0x159)]=updatePanelStatus,window['purgeHLYStorage']=purgeStorage,window[_0x32c806(0x133)]=startCondensation,window[_0x32c806(0x15a)]=previewCondensation,window[_0x32c806(0x2eb)]=ingestManualText,window[_0x32c806(0x28a)]=log,window[_0x32c806(0x1fb)]=showStats,window[_0x32c806(0x154)]=startHistoriography;}function updateAndSaveSetting(_0x27b996,_0x21858f){const _0x49727a=_0x1cfca3,_0x4a961c=_0x589651[_0x49727a(0x2dc)]();if(!_0x4a961c)return;const _0x57cdcc=_0x27b996['split']('.');let _0x3187d7=_0x4a961c;for(let _0x5e83c7=0x0;_0x5e83c7<_0x57cdcc['length']-0x1;_0x5e83c7++){_0x3187d7=_0x3187d7[_0x57cdcc[_0x5e83c7]]=_0x3187d7[_0x57cdcc[_0x5e83c7]]||{};}_0x3187d7[_0x57cdcc[_0x57cdcc[_0x49727a(0x262)]-0x1]]=_0x21858f,_0x589651[_0x49727a(0x1f4)](),log(_0x49727a(0x1ef)+_0x27b996+_0x49727a(0x2c9)+JSON['stringify'](_0x21858f),_0x49727a(0x1c8));}function bindAutoSaveEvents(){const _0x4148d5=_0x1cfca3,_0x3cadc8=document[_0x4148d5(0x23a)](_0x4148d5(0x12e));if(!_0x3cadc8)return;_0x3cadc8[_0x4148d5(0x206)](_0x4148d5(0x263),_0x126da7=>{const _0x54aa71=_0x4148d5,_0x42022e=_0x126da7['target'],_0x2e72b8=_0x42022e[_0x54aa71(0x2da)][_0x54aa71(0x1d5)];if(!_0x2e72b8)return;let _0x80ebb;const _0x5d440a=_0x42022e['dataset'][_0x54aa71(0x149)]||_0x54aa71(0x26b);if(_0x42022e['type']==='checkbox')_0x80ebb=_0x42022e[_0x54aa71(0x2ec)];else{if(_0x42022e['type']===_0x54aa71(0x1fd)){if(_0x42022e[_0x54aa71(0x2ec)]){const _0x4db12e=_0x3cadc8[_0x54aa71(0x214)](_0x54aa71(0x197)+_0x42022e['name']+'\x22]'),_0x25aeab=Array[_0x54aa71(0x1e8)](_0x4db12e)[_0x54aa71(0x1b1)](_0x15eefc=>_0x15eefc[_0x54aa71(0x2ec)]);_0x80ebb=_0x25aeab[_0x54aa71(0x27d)];}else return;}else _0x80ebb=_0x42022e[_0x54aa71(0x27d)];}switch(_0x5d440a){case _0x54aa71(0x1cc):_0x80ebb=parseInt(_0x80ebb,0xa);break;case _0x54aa71(0x2f1):_0x80ebb=parseFloat(_0x80ebb);break;case _0x54aa71(0x2ea):typeof _0x80ebb!=='boolean'&&(_0x80ebb=_0x80ebb===_0x54aa71(0x2fa));break;}if(_0x42022e['type']===_0x54aa71(0x1fd)&&!_0x42022e[_0x54aa71(0x2ec)])return;updateAndSaveSetting(_0x2e72b8,_0x80ebb);});}export function bindHanlinyuanEvents(){const _0x4f32cd=_0x1cfca3,_0x377810=getContext();if(!_0x377810){console[_0x4f32cd(0x1f3)](_0x4f32cd(0x16c));return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents(),bindTutorialEvents(),bindAutoSaveEvents(),bindSessionLockEvent();if(_0x589651['initialize'])_0x589651[_0x4f32cd(0x165)]();else{console['error'](_0x4f32cd(0x162));return;}loadSettingsToUI(),loadWorldbookList(),log(_0x4f32cd(0x167),_0x4f32cd(0x202));const _0x21b849=document['getElementById'](_0x4f32cd(0x1e5)),_0x3baef1=document['getElementById']('hanlinyuan-ingest-novel-file-name'),_0x2b14cd=document[_0x4f32cd(0x23a)]('hanlinyuan-ingest-novel-start'),_0x509a5e=document[_0x4f32cd(0x23a)]('hanlinyuan-ingest-abort'),_0x27aa56=document[_0x4f32cd(0x23a)]('hanlinyuan-ingest-progress-container'),_0x2af0ef=document[_0x4f32cd(0x23a)](_0x4f32cd(0x195)),_0x40abc9=document[_0x4f32cd(0x23a)](_0x4f32cd(0x2c8)),_0x9f78c7=document[_0x4f32cd(0x23a)](_0x4f32cd(0x23c));let _0x5597a6=null,_0x44ce63=null;_0x21b849['addEventListener'](_0x4f32cd(0x263),_0x48786a=>{const _0x349e84=_0x4f32cd;_0x5597a6=_0x48786a[_0x349e84(0x1ed)][_0x349e84(0x252)][0x0],_0x5597a6?(_0x3baef1[_0x349e84(0x24f)]=_0x5597a6['name'],_0x3baef1['title']=_0x5597a6[_0x349e84(0x2ac)]):_0x3baef1[_0x349e84(0x24f)]=_0x349e84(0x1e1);}),_0x2b14cd[_0x4f32cd(0x206)](_0x4f32cd(0x1cf),async()=>{const _0x4792ee=_0x4f32cd;if(!_0x5597a6){toastr[_0x4792ee(0x17f)](_0x4792ee(0x2b4));return;}let _0x522c50=0x0;const _0x46e810=_0x481a58[_0x4792ee(0x2b2)](_0x5597a6),_0x567b26=_0x481a58[_0x4792ee(0x1a1)](_0x46e810);if(_0x567b26){const _0x54d69b=(_0x567b26[_0x4792ee(0x1c6)]/_0x567b26['totalChunks']*0x64)[_0x4792ee(0x260)](0x1),_0x100872=confirm(_0x4792ee(0x1b2)+_0x54d69b+_0x4792ee(0x1bc));_0x100872?(_0x522c50=_0x567b26[_0x4792ee(0x1c6)],toastr['info']('遵命,将从第\x20'+(_0x522c50+0x1)+_0x4792ee(0x1f1),_0x4792ee(0x192)),log(_0x4792ee(0x2e2)+_0x46e810+_0x4792ee(0x2cf)+_0x522c50+_0x4792ee(0x2ed),_0x4792ee(0x202))):(_0x481a58[_0x4792ee(0x2f6)](_0x46e810),toastr[_0x4792ee(0x202)]('遵命,将从头开始录入此书。','圣旨已达'),log(_0x4792ee(0x218)+_0x46e810+_0x4792ee(0x2b3),_0x4792ee(0x13e)));}_0x44ce63=new AbortController();const _0x1a4849=_0x44ce63[_0x4792ee(0x29e)];_0x9f78c7['style']['display']='none',_0x27aa56['style'][_0x4792ee(0x28e)]=_0x4792ee(0x222),_0x40abc9['textContent']=_0x4792ee(0x138),_0x2af0ef[_0x4792ee(0x27d)]=0x0;try{const _0xad5e02=await _0x5597a6['text'](),_0x270e94=_0x291db5=>{const _0x249bec=_0x4792ee;_0x40abc9['textContent']='处理中:\x20'+_0x291db5['message']+'\x20('+_0x291db5[_0x249bec(0x1ca)]+'/'+_0x291db5[_0x249bec(0x25e)]+')',_0x2af0ef[_0x249bec(0x27d)]=_0x291db5[_0x249bec(0x1ca)]/_0x291db5['total']*0x64;},_0x105b93=()=>{const _0x3a398c=_0x4792ee;updatePanelStatus(),log(_0x3a398c(0x1b8),_0x3a398c(0x202));},_0x1987b4=await _0x589651[_0x4792ee(0x1a2)](_0xad5e02,'novel',{'sourceName':_0x5597a6['name']},_0x270e94,_0x1a4849,log,_0x105b93,_0x46e810,_0x522c50);if(_0x1987b4[_0x4792ee(0x1c8)])toastr['success'](_0x4792ee(0x157)+_0x1987b4['count']+_0x4792ee(0x180)),_0x40abc9['textContent']=_0x4792ee(0x1ba)+_0x1987b4[_0x4792ee(0x1de)]+_0x4792ee(0x2e1),_0x2af0ef[_0x4792ee(0x27d)]=0x64,updatePanelStatus();else throw new Error(_0x1987b4[_0x4792ee(0x1f3)]||'未知错误');}catch(_0x4dceef){_0x4dceef[_0x4792ee(0x2ac)]===_0x4792ee(0x29a)?(toastr[_0x4792ee(0x202)](_0x4792ee(0x289)),_0x40abc9['textContent']=_0x4792ee(0x18a)):(toastr['error'](_0x4792ee(0x2b6)+_0x4dceef[_0x4792ee(0x12d)]+_0x4792ee(0x17b)),_0x40abc9[_0x4792ee(0x24f)]=_0x4792ee(0x205)+_0x4dceef[_0x4792ee(0x12d)]);}finally{setTimeout(()=>{const _0xcbd8ad=_0x4792ee;_0x9f78c7[_0xcbd8ad(0x132)]['display']=_0xcbd8ad(0x1ee),_0x27aa56[_0xcbd8ad(0x132)][_0xcbd8ad(0x28e)]='none',_0x21b849[_0xcbd8ad(0x27d)]='',_0x5597a6=null,_0x3baef1[_0xcbd8ad(0x24f)]=_0xcbd8ad(0x1e1);},0xbb8);}}),_0x509a5e[_0x4f32cd(0x206)](_0x4f32cd(0x1cf),()=>{const _0x31c250=_0x4f32cd;_0x44ce63&&_0x44ce63[_0x31c250(0x17d)]();});}function bindSessionLockEvent(){const _0xa5742d=_0x1cfca3,_0x39a2dd=document[_0xa5742d(0x23a)]('hly-session-lock-btn');if(!_0x39a2dd)return;_0x39a2dd[_0xa5742d(0x206)](_0xa5742d(0x1cf),async()=>{const _0x1ad5f3=_0xa5742d,_0x3e6a89=await _0x589651[_0x1ad5f3(0x1d0)]();updateSessionLockUI(_0x3e6a89);if(_0x3e6a89){const _0x3e70a4=_0x589651['getLockedSessionInfo']();_0x3e70a4&&(toastr[_0x1ad5f3(0x1c8)](_0x1ad5f3(0x26a)+_0x3e70a4['id'],'圣旨已下'),log('会话已锁定到宝库:\x20'+_0x3e70a4['id'],'success'));}else toastr[_0x1ad5f3(0x202)](_0x1ad5f3(0x1ae),'诏曰'),log(_0x1ad5f3(0x1c1),_0x1ad5f3(0x202));updatePanelStatus();}),updateSessionLockUI(_0x589651[_0xa5742d(0x2be)]());}function updateSessionLockUI(_0x39c283){const _0x2947f3=_0x1cfca3,_0x155199=document['getElementById'](_0x2947f3(0x2ce));if(!_0x155199)return;const _0x4be774=_0x155199[_0x2947f3(0x198)]('i'),_0x1df3b4=_0x155199[_0x2947f3(0x198)]('span');_0x39c283?(_0x155199[_0x2947f3(0x18d)][_0x2947f3(0x15d)](_0x2947f3(0x19b)),_0x4be774[_0x2947f3(0x21a)]=_0x2947f3(0x26e),_0x1df3b4[_0x2947f3(0x24f)]=_0x2947f3(0x227),_0x155199[_0x2947f3(0x1a4)]=_0x2947f3(0x272)):(_0x155199['classList']['remove'](_0x2947f3(0x19b)),_0x4be774[_0x2947f3(0x21a)]=_0x2947f3(0x1b5),_0x1df3b4[_0x2947f3(0x24f)]=_0x2947f3(0x20a),_0x155199[_0x2947f3(0x1a4)]='点击以锁定,让翰林院固定操作当前角色的宝库');}function bindPanelToggleEvents(){const _0x4f2e5d=_0x1cfca3,_0x58a412=document[_0x4f2e5d(0x23a)]('amily2_open_rag_palace');if(_0x58a412){}}function bindTutorialEvents(){const _0x2f6abe=_0x1cfca3,_0x44ba6c=document['getElementById'](_0x2f6abe(0x23f));_0x44ba6c&&_0x44ba6c[_0x2f6abe(0x206)](_0x2f6abe(0x1cf),()=>{const _0x5c8ced=_0x2f6abe;showContentModal(_0x5c8ced(0x251),_0x5c8ced(0x18c));});}function bindInternalUIEvents(){const _0x520f13=_0x1cfca3,_0xb30ae7=document[_0x520f13(0x214)](_0x520f13(0x2e8));_0xb30ae7[_0x520f13(0x236)](_0x2f08ee=>{const _0x1dd859=_0x520f13;_0x2f08ee[_0x1dd859(0x206)](_0x1dd859(0x1cf),()=>{const _0x99f76d=_0x1dd859,_0x342d62=_0x2f08ee[_0x99f76d(0x2da)][_0x99f76d(0x2a1)],_0x50cec0=_0x99f76d(0x298)+_0x342d62+_0x99f76d(0x125);document[_0x99f76d(0x214)](_0x99f76d(0x2f0))[_0x99f76d(0x236)](_0x4fd458=>{const _0x392f5c=_0x99f76d;_0x4fd458[_0x392f5c(0x18d)]['toggle'](_0x392f5c(0x19b),_0x4fd458['id']===_0x50cec0);}),_0xb30ae7['forEach'](_0x285300=>_0x285300[_0x99f76d(0x18d)]['toggle'](_0x99f76d(0x19b),_0x285300===_0x2f08ee));});});const _0x39dfaa=document['getElementById'](_0x520f13(0x175));_0x39dfaa&&_0x39dfaa[_0x520f13(0x206)]('change',handleApiModeChange);const _0x3c7ddf=document[_0x520f13(0x214)](_0x520f13(0x282));_0x3c7ddf[_0x520f13(0x236)](_0x187009=>{const _0x10f919=_0x520f13;_0x187009[_0x10f919(0x206)](_0x10f919(0x263),toggleInjectionDetails);});const _0x281f84=document[_0x520f13(0x23a)](_0x520f13(0x143)),_0x5d5b37=document[_0x520f13(0x23a)](_0x520f13(0x2f7));_0x281f84&&_0x5d5b37&&_0x281f84[_0x520f13(0x206)]('change',()=>{const _0x2b4778=_0x520f13;_0x5d5b37[_0x2b4778(0x132)][_0x2b4778(0x28e)]=_0x281f84[_0x2b4778(0x2ec)]?_0x2b4778(0x222):_0x2b4778(0x259);});const _0x2774e8=document['getElementById'](_0x520f13(0x217));_0x2774e8&&_0x2774e8['addEventListener']('change',handleWorldbookSelectionChange);const _0x46a5fe=document[_0x520f13(0x23a)](_0x520f13(0x21f));_0x46a5fe&&_0x46a5fe[_0x520f13(0x206)](_0x520f13(0x1cf),showExclusionRulesModal);const _0x431384=document[_0x520f13(0x23a)](_0x520f13(0x20c)),_0x233b3c=document[_0x520f13(0x23a)]('hly-hist-entry-multiselect-options');_0x431384&&_0x233b3c&&(_0x431384['addEventListener'](_0x520f13(0x1cf),_0x3d401f=>{const _0x2b26e7=_0x520f13;_0x3d401f[_0x2b26e7(0x12b)]();const _0x38a136=_0x233b3c['style'][_0x2b26e7(0x28e)]==='block';_0x233b3c['style'][_0x2b26e7(0x28e)]=_0x38a136?_0x2b26e7(0x259):_0x2b26e7(0x222);}),_0x233b3c[_0x520f13(0x206)]('change',_0x5d89cf=>{const _0x15dca3=_0x520f13,_0x9fd002=_0x5d89cf[_0x15dca3(0x1ed)];if(_0x9fd002['type']!==_0x15dca3(0x234))return;const _0x2032b3=_0x233b3c[_0x15dca3(0x214)](_0x15dca3(0x12c)),_0x1d34ae=document[_0x15dca3(0x23a)](_0x15dca3(0x1a5));if(_0x9fd002['id']===_0x15dca3(0x1a5))_0x2032b3['forEach'](_0x425825=>_0x425825[_0x15dca3(0x2ec)]=_0x9fd002['checked']);else{const _0x4a7ab5=Array['from'](_0x2032b3)[_0x15dca3(0x2ef)](_0x5c7246=>_0x5c7246['checked']);_0x1d34ae['checked']=_0x4a7ab5;}const _0x579f9c=_0x233b3c[_0x15dca3(0x214)](_0x15dca3(0x188))[_0x15dca3(0x262)],_0x3f3ee7=_0x2032b3[_0x15dca3(0x262)];_0x431384[_0x15dca3(0x198)](_0x15dca3(0x22a))[_0x15dca3(0x24f)]=_0x15dca3(0x266)+_0x579f9c+'\x20/\x20'+_0x3f3ee7+_0x15dca3(0x24b);}),document[_0x520f13(0x206)](_0x520f13(0x1cf),_0x4860cb=>{const _0x39ea35=_0x520f13;!_0x431384[_0x39ea35(0x19e)](_0x4860cb[_0x39ea35(0x1ed)])&&!_0x233b3c['contains'](_0x4860cb[_0x39ea35(0x1ed)])&&(_0x233b3c[_0x39ea35(0x132)][_0x39ea35(0x28e)]=_0x39ea35(0x259));}));const _0x177e08=document[_0x520f13(0x23a)](_0x520f13(0x231));_0x177e08&&_0x177e08[_0x520f13(0x206)](_0x520f13(0x1cf),deleteAllLocalKnowledgeBases);const _0x408865=document[_0x520f13(0x23a)](_0x520f13(0x25d));_0x408865&&_0x408865['addEventListener'](_0x520f13(0x1cf),()=>moveAllKnowledgeBases(_0x520f13(0x211)));const _0x1917e7=document[_0x520f13(0x23a)]('hly-kb-move-all-to-global');_0x1917e7&&_0x1917e7[_0x520f13(0x206)](_0x520f13(0x1cf),()=>moveAllKnowledgeBases(_0x520f13(0x2a3)));const _0x28a065=[_0x520f13(0x246),_0x520f13(0x2ca)];_0x28a065[_0x520f13(0x236)](_0x12db29=>{const _0x19a67f=_0x520f13,_0x3265a0=document[_0x19a67f(0x23a)](_0x12db29);_0x3265a0&&(_0x3265a0[_0x19a67f(0x206)](_0x19a67f(0x1cf),handleKbAction),_0x3265a0[_0x19a67f(0x206)](_0x19a67f(0x263),handleKbAction));});}function toggleInjectionDetails(){const _0x1db702=_0x1cfca3,_0x65c6fa=document['querySelector'](_0x1db702(0x18e))[_0x1db702(0x27d)],_0x18c6f3=document['getElementById'](_0x1db702(0x182)),_0x2ce743=document['getElementById']('hly-injection-role'),_0x55a64e=_0x65c6fa==='1';_0x18c6f3['disabled']=!_0x55a64e,_0x2ce743[_0x1db702(0x2bf)]=!_0x55a64e;}function handleApiModeChange(){const _0x1323d3=_0x1cfca3,_0x4f96b5=document[_0x1323d3(0x23a)](_0x1323d3(0x175))[_0x1323d3(0x27d)],_0x2459f3=document[_0x1323d3(0x23a)](_0x1323d3(0x135)),_0x2d399c=document[_0x1323d3(0x23a)](_0x1323d3(0x230)),_0x29b1d8=document[_0x1323d3(0x23a)](_0x1323d3(0x142)),_0x5d94e7=_0x29b1d8[_0x1323d3(0x2d4)];if(!_0x2459f3||!_0x2d399c)return;_0x2459f3[_0x1323d3(0x132)]['display']='block',_0x2d399c[_0x1323d3(0x132)][_0x1323d3(0x28e)]=_0x1323d3(0x222);switch(_0x4f96b5){case'google_direct':_0x2459f3[_0x1323d3(0x132)][_0x1323d3(0x28e)]='none',_0x2d399c[_0x1323d3(0x198)](_0x1323d3(0x1e0))['textContent']=_0x1323d3(0x245),_0x2d399c[_0x1323d3(0x198)](_0x1323d3(0x23e))[_0x1323d3(0x12f)]=_0x1323d3(0x2b7);break;case _0x1323d3(0x15e):_0x2459f3[_0x1323d3(0x198)](_0x1323d3(0x1e0))[_0x1323d3(0x24f)]=_0x1323d3(0x168),_0x2459f3[_0x1323d3(0x198)](_0x1323d3(0x23e))[_0x1323d3(0x12f)]='例如\x20http://127.0.0.1:8000/v1',_0x2d399c[_0x1323d3(0x132)][_0x1323d3(0x28e)]=_0x1323d3(0x259);break;case _0x1323d3(0x220):default:_0x2459f3[_0x1323d3(0x198)](_0x1323d3(0x1e0))['textContent']=_0x1323d3(0x26f),_0x2459f3[_0x1323d3(0x198)](_0x1323d3(0x23e))['placeholder']=_0x1323d3(0x14d),_0x2d399c[_0x1323d3(0x198)](_0x1323d3(0x1e0))[_0x1323d3(0x24f)]='通行令牌\x20(API\x20Key):';break;}}function loadSettingsToUI(){const _0x10669c=_0x1cfca3,_0xecec8c=_0x589651[_0x10669c(0x2dc)]();if(!_0xecec8c)return;document['getElementById']('hly-retrieval-enabled')['checked']=_0xecec8c[_0x10669c(0x1ab)][_0x10669c(0x1c3)],document['getElementById'](_0x10669c(0x175))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x1ab)]['apiEndpoint'],document['getElementById']('hly-custom-api-url')[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x1ab)][_0x10669c(0x2a7)],document[_0x10669c(0x23a)](_0x10669c(0x1db))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x1ab)][_0x10669c(0x153)];const _0x4eb2c1=document[_0x10669c(0x23a)](_0x10669c(0x142));if(_0x4eb2c1[_0x10669c(0x27c)]['length']===0x0){const _0x3fd18f=_0xecec8c[_0x10669c(0x1ab)][_0x10669c(0x29f)],_0x2678be=new Option(_0x3fd18f,_0x3fd18f,!![],!![]);_0x4eb2c1[_0x10669c(0x15d)](_0x2678be);}_0x4eb2c1[_0x10669c(0x27d)]=_0xecec8c['retrieval'][_0x10669c(0x29f)],document[_0x10669c(0x23a)](_0x10669c(0x233))[_0x10669c(0x2ec)]=_0xecec8c[_0x10669c(0x1ab)][_0x10669c(0x19d)],document[_0x10669c(0x23a)](_0x10669c(0x1bd))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x17e)][_0x10669c(0x164)],document[_0x10669c(0x23a)](_0x10669c(0x249))[_0x10669c(0x27d)]=_0xecec8c['advanced'][_0x10669c(0x281)],document[_0x10669c(0x23a)]('hly-match-threshold')[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x17e)][_0x10669c(0x223)],document[_0x10669c(0x23a)](_0x10669c(0x141))[_0x10669c(0x27d)]=_0xecec8c['advanced'][_0x10669c(0x2af)],document[_0x10669c(0x23a)](_0x10669c(0x291))['value']=_0xecec8c[_0x10669c(0x17e)]['maxResults'],document[_0x10669c(0x23a)]('hly-batch-size')['value']=_0xecec8c[_0x10669c(0x1ab)][_0x10669c(0x187)],document['getElementById'](_0x10669c(0x16d))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x2a5)][_0x10669c(0x1a0)];const _0x53e561=document['querySelector'](_0x10669c(0x200)+_0xecec8c[_0x10669c(0x2a5)][_0x10669c(0x1ac)]+'\x22]');_0x53e561&&(_0x53e561[_0x10669c(0x2ec)]=!![]);document[_0x10669c(0x23a)](_0x10669c(0x182))[_0x10669c(0x27d)]=_0xecec8c['injection'][_0x10669c(0x208)],document[_0x10669c(0x23a)](_0x10669c(0x17c))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x2a5)][_0x10669c(0x196)],toggleInjectionDetails(),handleApiModeChange(),document['getElementById']('hly-condensation-enabled')[_0x10669c(0x2ec)]=_0xecec8c[_0x10669c(0x24e)][_0x10669c(0x1c3)],document[_0x10669c(0x23a)](_0x10669c(0x1e3))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x24e)][_0x10669c(0x224)],document[_0x10669c(0x23a)](_0x10669c(0x1fc))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x24e)][_0x10669c(0x1a7)],document['getElementById'](_0x10669c(0x193))[_0x10669c(0x2ec)]=_0xecec8c[_0x10669c(0x24e)]['messageTypes'][_0x10669c(0x264)],document[_0x10669c(0x23a)](_0x10669c(0x1c2))[_0x10669c(0x2ec)]=_0xecec8c[_0x10669c(0x24e)][_0x10669c(0x23d)]['ai'];const _0x4c80b4=document[_0x10669c(0x23a)](_0x10669c(0x143)),_0x55dcbf=document['getElementById'](_0x10669c(0x1a6)),_0x24905=document[_0x10669c(0x23a)](_0x10669c(0x2f7));_0x4c80b4[_0x10669c(0x2ec)]=_0xecec8c[_0x10669c(0x24e)][_0x10669c(0x28b)],_0x55dcbf[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x24e)]['tags'],_0x24905[_0x10669c(0x132)]['display']=_0x4c80b4[_0x10669c(0x2ec)]?_0x10669c(0x222):_0x10669c(0x259),document[_0x10669c(0x23a)](_0x10669c(0x2f5))[_0x10669c(0x2ec)]=_0xecec8c[_0x10669c(0x20e)][_0x10669c(0x1c3)],document['getElementById'](_0x10669c(0x145))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x20e)]['url'],document[_0x10669c(0x23a)](_0x10669c(0x1d6))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x20e)][_0x10669c(0x153)];const _0x434475=document['getElementById'](_0x10669c(0x134));if(_0x434475['options'][_0x10669c(0x262)]===0x0){const _0x72b34f=_0xecec8c[_0x10669c(0x20e)][_0x10669c(0x1b0)];if(_0x72b34f){const _0x4ca76b=new Option(_0x72b34f,_0x72b34f,!![],!![]);_0x434475[_0x10669c(0x15d)](_0x4ca76b);}}_0x434475['value']=_0xecec8c[_0x10669c(0x20e)][_0x10669c(0x1b0)],document['getElementById'](_0x10669c(0x160))[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x20e)]['top_n'],document[_0x10669c(0x23a)]('hly-rerank-hybrid-alpha')[_0x10669c(0x27d)]=_0xecec8c[_0x10669c(0x20e)][_0x10669c(0x241)],document[_0x10669c(0x23a)](_0x10669c(0x2c4))[_0x10669c(0x2ec)]=_0xecec8c['rerank']['notify'];}function saveSettingsFromUI(_0x26902f=!![]){const _0x32859f=_0x1cfca3,_0x339442=document[_0x32859f(0x23a)](_0x32859f(0x12e));if(!_0x339442)return;const _0x2b288c=_0x339442[_0x32859f(0x214)]('[data-setting-key]');_0x2b288c[_0x32859f(0x236)](_0x25bb68=>{const _0x3131a7=_0x32859f,_0x1b7346=_0x25bb68[_0x3131a7(0x2da)][_0x3131a7(0x1d5)];if(!_0x1b7346)return;let _0x426288;const _0xde81b6=_0x25bb68['dataset'][_0x3131a7(0x149)]||_0x3131a7(0x26b);if(_0x25bb68[_0x3131a7(0x149)]==='checkbox')_0x426288=_0x25bb68[_0x3131a7(0x2ec)];else{if(_0x25bb68[_0x3131a7(0x149)]==='radio'){if(!_0x25bb68['checked'])return;_0x426288=_0x25bb68[_0x3131a7(0x27d)];}else _0x426288=_0x25bb68[_0x3131a7(0x27d)];}switch(_0xde81b6){case _0x3131a7(0x1cc):_0x426288=parseInt(_0x426288,0xa);break;case _0x3131a7(0x2f1):_0x426288=parseFloat(_0x426288);break;case _0x3131a7(0x2ea):if(typeof _0x426288!==_0x3131a7(0x2ea))_0x426288=_0x426288===_0x3131a7(0x2fa);break;}const _0x1d6a52=_0x589651[_0x3131a7(0x2dc)](),_0x20a8f2=_0x1b7346[_0x3131a7(0x140)]('.');let _0x649d2c=_0x1d6a52;for(let _0x55671d=0x0;_0x55671d<_0x20a8f2[_0x3131a7(0x262)]-0x1;_0x55671d++){_0x649d2c=_0x649d2c[_0x20a8f2[_0x55671d]]=_0x649d2c[_0x20a8f2[_0x55671d]]||{};}_0x649d2c[_0x20a8f2[_0x20a8f2[_0x3131a7(0x262)]-0x1]]=_0x426288;}),_0x589651[_0x32859f(0x1f4)](),!_0x26902f&&(log(_0x32859f(0x172),_0x32859f(0x1c8)),toastr['success'](_0x32859f(0x122),_0x32859f(0x192)));}function resetSettingsToUI(){const _0x34c589=_0x1cfca3;confirm(_0x34c589(0x1ea))&&(_0x589651[_0x34c589(0x1f0)](),loadSettingsToUI(),toastr[_0x34c589(0x202)](_0x34c589(0x1af),'诏曰'));}async function updatePanelStatus(){const _0xb0f66b=_0x1cfca3,_0x43d846=_0x589651[_0xb0f66b(0x2be)](),_0x4e431c=document[_0xb0f66b(0x23a)](_0xb0f66b(0x2cd)),_0x4d8b31=document['getElementById'](_0xb0f66b(0x2df));if(_0x43d846){const _0x157793=_0x589651[_0xb0f66b(0x166)]();_0x157793&&(_0x4e431c[_0xb0f66b(0x24f)]=_0xb0f66b(0x209),_0x4d8b31[_0xb0f66b(0x24f)]=_0x157793['id'],_0x4d8b31[_0xb0f66b(0x1a4)]=_0xb0f66b(0x204)+_0x157793['id'],_0x4e431c[_0xb0f66b(0x18d)][_0xb0f66b(0x15d)](_0xb0f66b(0x1a9)),_0x4d8b31[_0xb0f66b(0x18d)][_0xb0f66b(0x15d)]('hly-locked-status'));}else _0x4e431c['textContent']=_0x1e2c21[_0xb0f66b(0x26c)](),_0x4d8b31['textContent']=_0x1e2c21[_0xb0f66b(0x2c1)]()||'无',_0x4d8b31[_0xb0f66b(0x1a4)]='',_0x4e431c[_0xb0f66b(0x18d)][_0xb0f66b(0x1b9)](_0xb0f66b(0x1a9)),_0x4d8b31[_0xb0f66b(0x18d)][_0xb0f66b(0x1b9)](_0xb0f66b(0x1a9));const _0x5f0f0d=document[_0xb0f66b(0x23a)]('hly-current-vector-count');_0x5f0f0d[_0xb0f66b(0x24f)]='...';try{const _0x1cb475=await _0x589651['getVectorCount']();_0x5f0f0d[_0xb0f66b(0x24f)]=_0x1cb475;}catch(_0x3624c1){console[_0xb0f66b(0x1f3)]('[翰林院-枢纽]\x20更新忆识数量失败:',_0x3624c1),_0x5f0f0d[_0xb0f66b(0x24f)]=_0xb0f66b(0x194),_0x5f0f0d[_0xb0f66b(0x1a4)]=_0xb0f66b(0x2c2)+_0x3624c1[_0xb0f66b(0x12d)];}const _0x3ed7eb=document[_0xb0f66b(0x23a)](_0xb0f66b(0x2e4));if(_0x3ed7eb&&!_0x3ed7eb[_0xb0f66b(0x2da)]['finalText']){const _0x3f8fd9=_0x589651['getSettings'](),_0x56e56a=await _0x589651[_0xb0f66b(0x288)]();if(_0x3f8fd9['condensationHistory']&&_0x3f8fd9[_0xb0f66b(0x13b)][_0x56e56a]){const _0x36db0f=_0x3f8fd9[_0xb0f66b(0x13b)][_0x56e56a];_0x3ed7eb[_0xb0f66b(0x235)]='<p\x20class=\x22hly-record-hint\x22><i>上次已从第\x20'+_0x36db0f[_0xb0f66b(0x1f5)]+_0xb0f66b(0x1dc)+_0x36db0f[_0xb0f66b(0x184)]+'\x20楼。</i></p>';}else _0x3ed7eb[_0xb0f66b(0x235)]=_0xb0f66b(0x1fe);}renderKnowledgeBases();}async function moveAllKnowledgeBases(_0x194588){const _0x44590f=_0x1cfca3,_0x1a975e=_0x194588===_0x44590f(0x211),_0x2e3fee=_0x1a975e?_0x44590f(0x14a):_0x44590f(0x253),_0x350070=_0x1a975e?'局部':'全局',_0x51ba02=_0x1a975e?_0x589651[_0x44590f(0x1e6)]():_0x589651[_0x44590f(0x2aa)](),_0x2bcdef=Object['keys'](_0x51ba02);if(_0x2bcdef[_0x44590f(0x262)]===0x0){toastr[_0x44590f(0x202)]('源区域('+(_0x1a975e?'全局':'局部')+_0x44590f(0x1fa),'圣谕');return;}if(!confirm(_0x44590f(0x131)+_0x2bcdef['length']+'\x20个知识库从【'+(_0x1a975e?'全局':'局部')+_0x44590f(0x24a)+_0x350070+_0x44590f(0x210)))return;log(_0x44590f(0x2db)+_0x2bcdef[_0x44590f(0x262)]+'\x20个知识库从\x20'+_0x2e3fee+'\x20移动到\x20'+(_0x1a975e?'local':_0x44590f(0x14a))+_0x44590f(0x287),_0x44590f(0x202));const _0x53bef5=_0x2bcdef[_0x44590f(0x185)](_0x12f590=>_0x589651[_0x44590f(0x14b)](_0x12f590,_0x2e3fee));try{await Promise[_0x44590f(0x2a2)](_0x53bef5),toastr[_0x44590f(0x1c8)](_0x44590f(0x278)+_0x2bcdef[_0x44590f(0x262)]+_0x44590f(0x21b),'大功告成'),log(_0x44590f(0x265),_0x44590f(0x1c8));}catch(_0x3ccf12){toastr['error']('批量移动过程中发生错误:\x20'+_0x3ccf12[_0x44590f(0x12d)],'警报'),log(_0x44590f(0x2c5)+_0x3ccf12[_0x44590f(0x12d)],_0x44590f(0x1f3));}finally{await updatePanelStatus();}}async function deleteAllLocalKnowledgeBases(){const _0x477c36=_0x1cfca3,_0x267832=_0x589651[_0x477c36(0x2aa)](),_0x3e915c=Object[_0x477c36(0x2f8)](_0x267832);if(_0x3e915c[_0x477c36(0x262)]===0x0){toastr[_0x477c36(0x202)](_0x477c36(0x179),'圣谕');return;}if(!confirm(_0x477c36(0x207)+_0x3e915c[_0x477c36(0x262)]+'\x20个局部知识库吗此操作无法恢复'))return;toastr[_0x477c36(0x202)]('正在删除\x20'+_0x3e915c[_0x477c36(0x262)]+'\x20个局部知识库...','圣旨'),log(_0x477c36(0x239)+_0x3e915c[_0x477c36(0x262)]+_0x477c36(0x275),_0x477c36(0x13e));let _0x127d2b=0x0,_0x1b732d=0x0;for(const _0x431c5a of _0x3e915c){try{await _0x589651[_0x477c36(0x1f9)](_0x431c5a,_0x477c36(0x253)),_0x127d2b++;}catch(_0x4d7fc2){_0x1b732d++,log(_0x477c36(0x258)+_0x431c5a+_0x477c36(0x2c6)+_0x4d7fc2['message'],_0x477c36(0x1f3));}}_0x1b732d>0x0?toastr[_0x477c36(0x1f3)]('操作完成,但有\x20'+_0x1b732d+_0x477c36(0x16b),'警报'):toastr[_0x477c36(0x1c8)](_0x477c36(0x278)+_0x127d2b+'\x20个局部知识库均已成功删除。','大功告成'),log(_0x477c36(0x284)+_0x127d2b+_0x477c36(0x22f)+_0x1b732d,_0x477c36(0x202)),await updatePanelStatus();}async function renderKnowledgeBases(){const _0x4518f7=_0x1cfca3,_0x3074aa=document[_0x4518f7(0x23a)](_0x4518f7(0x246)),_0x47f7c3=document[_0x4518f7(0x23a)](_0x4518f7(0x2ca)),_0x2b244c=document[_0x4518f7(0x23a)](_0x4518f7(0x2ad));if(!_0x3074aa||!_0x47f7c3||!_0x2b244c)return;_0x2b244c[_0x4518f7(0x24f)]=_0x1e2c21[_0x4518f7(0x26c)]()||_0x4518f7(0x29d);try{const _0x3c70e1=_0x589651[_0x4518f7(0x2aa)](),_0x3b0225=_0x589651[_0x4518f7(0x1e6)]();await _renderKbList(_0x3c70e1,_0x3074aa,_0x4518f7(0x253),_0x4518f7(0x148)),await _renderKbList(_0x3b0225,_0x47f7c3,_0x4518f7(0x14a),_0x4518f7(0x243));}catch(_0x23342f){console[_0x4518f7(0x1f3)]('[翰林院-枢纽]\x20渲染知识库列表失败:',_0x23342f),_0x3074aa['innerHTML']='<p\x20class=\x22hly-notes\x20log-error\x22><i>加载失败:\x20'+_0x23342f[_0x4518f7(0x12d)]+_0x4518f7(0x1b4),_0x47f7c3['innerHTML']=_0x4518f7(0x128)+_0x23342f[_0x4518f7(0x12d)]+_0x4518f7(0x1b4);}}async function _renderKbList(_0x5adc0c,_0x4f7eb5,_0x327fb4,_0x1ceb8e){const _0x1deab1=_0x1cfca3,_0x804198=document[_0x1deab1(0x23a)](_0x1ceb8e);_0x4f7eb5[_0x1deab1(0x235)]='',_0x4f7eb5['appendChild'](_0x804198);if(Object[_0x1deab1(0x2f8)](_0x5adc0c)[_0x1deab1(0x262)]===0x0){_0x804198[_0x1deab1(0x132)][_0x1deab1(0x28e)]='block';return;}_0x804198[_0x1deab1(0x132)][_0x1deab1(0x28e)]=_0x1deab1(0x259);for(const [_0x236e1b,_0x1dd398]of Object['entries'](_0x5adc0c)){const _0x2ba54c=document[_0x1deab1(0x225)](_0x1deab1(0x212));_0x2ba54c['className']=_0x1deab1(0x1a3),_0x2ba54c[_0x1deab1(0x2da)]['kbId']=_0x236e1b,_0x2ba54c[_0x1deab1(0x2da)][_0x1deab1(0x151)]=_0x327fb4;const _0x586150=await _0x589651['getVectorCount'](_0x236e1b,_0x327fb4),_0x1b55e7=_0x327fb4==='local'?'<button\x20class=\x22hly-kb-move-btn\x22\x20title=\x22上移到全局\x22><i\x20class=\x22fas\x20fa-arrow-up\x22></i></button>':_0x1deab1(0x293);_0x2ba54c[_0x1deab1(0x235)]=_0x1deab1(0x270)+_0x236e1b+'\x22>'+_0x1dd398['name']+'\x20('+_0x586150+_0x1deab1(0x277)+_0x1b55e7+_0x1deab1(0x250)+(_0x1dd398[_0x1deab1(0x1c3)]?'checked':'')+_0x1deab1(0x2b5),_0x4f7eb5[_0x1deab1(0x13f)](_0x2ba54c);}}async function handleKbAction(_0x520cc6){const _0x123a2c=_0x1cfca3,_0xa35950=_0x520cc6[_0x123a2c(0x1ed)],_0x189b73=_0xa35950[_0x123a2c(0x177)]('.hly-kb-list-item');if(!_0x189b73)return;const _0x3b86b2=_0x189b73['dataset'][_0x123a2c(0x295)],_0x11c0cb=_0x189b73[_0x123a2c(0x2da)]['kbScope'],_0x139295=_0x189b73[_0x123a2c(0x198)](_0x123a2c(0x16e))['textContent'][_0x123a2c(0x140)]('\x20(')[0x0];if(_0xa35950['classList'][_0x123a2c(0x19e)](_0x123a2c(0x2d0))){if(confirm(_0x123a2c(0x285)+_0x139295+_0x123a2c(0x290)))try{await _0x589651['removeKnowledgeBase'](_0x3b86b2,_0x11c0cb),log(_0x123a2c(0x237)+_0x139295+_0x123a2c(0x1c5)+_0x3b86b2+')\x20已被删除',_0x123a2c(0x1c8)),toastr[_0x123a2c(0x1c8)](_0x123a2c(0x146)+_0x139295+'】已删除。'),await updatePanelStatus();}catch(_0x508d8f){log('删除知识库\x20'+_0x139295+_0x123a2c(0x2c6)+_0x508d8f[_0x123a2c(0x12d)],_0x123a2c(0x1f3)),toastr['error']('删除失败:\x20'+_0x508d8f[_0x123a2c(0x12d)]);}}if(_0xa35950['closest'](_0x123a2c(0x170))){const _0x9ca293=_0x11c0cb===_0x123a2c(0x253)?'全局':'局部';if(confirm('您确定要将知识库【'+_0x139295+_0x123a2c(0x24a)+_0x9ca293+'】吗?'))try{await _0x589651[_0x123a2c(0x14b)](_0x3b86b2,_0x11c0cb),await updatePanelStatus();}catch(_0x39fd9c){log('移动知识库\x20'+_0x139295+'\x20失败:\x20'+_0x39fd9c[_0x123a2c(0x12d)],'error'),toastr[_0x123a2c(0x1f3)](_0x123a2c(0x255)+_0x39fd9c[_0x123a2c(0x12d)]);}}if(_0xa35950[_0x123a2c(0x18d)][_0x123a2c(0x19e)](_0x123a2c(0x1b7))&&_0x520cc6[_0x123a2c(0x149)]===_0x123a2c(0x263))try{await _0x589651[_0x123a2c(0x22e)](_0x3b86b2,_0x11c0cb),log(_0x123a2c(0x237)+_0x139295+_0x123a2c(0x2b1),'success'),await updatePanelStatus();}catch(_0x42a6ae){log(_0x123a2c(0x190)+_0x139295+'\x20状态失败:\x20'+_0x42a6ae[_0x123a2c(0x12d)],'error'),toastr[_0x123a2c(0x1f3)](_0x123a2c(0x1d3)+_0x42a6ae['message']);}}async function testApi(){const _0x4c55d9=_0x1cfca3;toastr[_0x4c55d9(0x202)](_0x4c55d9(0x161),'圣旨');try{await _0x589651[_0x4c55d9(0x15c)](),toastr[_0x4c55d9(0x1c8)](_0x4c55d9(0x240),'圣意');}catch(_0x2d4423){toastr[_0x4c55d9(0x1f3)](_0x4c55d9(0x2c0)+_0x2d4423[_0x4c55d9(0x12d)],'警报');}}async function fetchHLYEmbeddingModels(){const _0x40b4d5=_0x1cfca3,_0x55f100=document[_0x40b4d5(0x23a)](_0x40b4d5(0x142)),_0x376b08=_0x55f100['value'];_0x55f100[_0x40b4d5(0x235)]='<option>正在获取...</option>',_0x55f100[_0x40b4d5(0x2bf)]=!![];try{log(_0x40b4d5(0x213),_0x40b4d5(0x202));const _0x18cac0=await _0x589651[_0x40b4d5(0x219)]();_0x55f100['innerHTML']='';if(_0x18cac0[_0x40b4d5(0x262)]===0x0){_0x55f100[_0x40b4d5(0x235)]=_0x40b4d5(0x1e4),toastr[_0x40b4d5(0x13e)]('未能获取到任何模型。',_0x40b4d5(0x2e0)),log(_0x40b4d5(0x1d4),_0x40b4d5(0x13e));return;}_0x18cac0['forEach'](_0x4dcfe8=>{const _0x3ee7b3=_0x40b4d5,_0x46a20e=new Option(_0x4dcfe8,_0x4dcfe8);_0x55f100[_0x3ee7b3(0x15d)](_0x46a20e);}),_0x18cac0[_0x40b4d5(0x1bf)](_0x376b08)?_0x55f100[_0x40b4d5(0x27d)]=_0x376b08:_0x55f100[_0x40b4d5(0x13c)]=0x0,toastr[_0x40b4d5(0x1c8)]('成功获取\x20'+_0x18cac0[_0x40b4d5(0x262)]+_0x40b4d5(0x189),'圣意'),log(_0x40b4d5(0x147)+_0x18cac0[_0x40b4d5(0x262)]+_0x40b4d5(0x189),_0x40b4d5(0x1c8));}catch(_0x5c2ccd){console[_0x40b4d5(0x1f3)](_0x40b4d5(0x156),_0x5c2ccd),toastr[_0x40b4d5(0x1f3)](_0x40b4d5(0x126)+_0x5c2ccd[_0x40b4d5(0x12d)],_0x40b4d5(0x129)),log(_0x40b4d5(0x126)+_0x5c2ccd['message'],_0x40b4d5(0x1f3)),_0x55f100['innerHTML']=_0x40b4d5(0x19a);}finally{_0x55f100[_0x40b4d5(0x2bf)]=![];}}async function fetchHLYRerankModels(){const _0x591edd=_0x1cfca3,_0x344a60=document[_0x591edd(0x23a)](_0x591edd(0x134)),_0x126f79=_0x344a60[_0x591edd(0x27d)];_0x344a60[_0x591edd(0x235)]=_0x591edd(0x216),_0x344a60[_0x591edd(0x2bf)]=!![];try{log('开始获取Rerank模型列表...',_0x591edd(0x202));const _0x5af42b=await _0x589651[_0x591edd(0x23b)]();_0x344a60[_0x591edd(0x235)]='';if(_0x5af42b[_0x591edd(0x262)]===0x0){_0x344a60[_0x591edd(0x235)]=_0x591edd(0x1e4),toastr[_0x591edd(0x13e)]('未能获取到任何Rerank模型。',_0x591edd(0x2e0)),log(_0x591edd(0x2e6),'warn');return;}_0x5af42b[_0x591edd(0x236)](_0x4dfe83=>{const _0x52683c=_0x591edd,_0x45da6f=new Option(_0x4dfe83,_0x4dfe83);_0x344a60[_0x52683c(0x15d)](_0x45da6f);}),_0x5af42b['includes'](_0x126f79)?_0x344a60['value']=_0x126f79:_0x344a60[_0x591edd(0x13c)]=0x0,toastr[_0x591edd(0x1c8)](_0x591edd(0x147)+_0x5af42b['length']+_0x591edd(0x2d1),'圣意'),log(_0x591edd(0x147)+_0x5af42b[_0x591edd(0x262)]+_0x591edd(0x2d1),'success');}catch(_0x8b1089){console[_0x591edd(0x1f3)](_0x591edd(0x2f9),_0x8b1089),toastr['error']('获取Rerank模型失败:\x20'+_0x8b1089[_0x591edd(0x12d)],_0x591edd(0x129)),log(_0x591edd(0x24c)+_0x8b1089[_0x591edd(0x12d)],'error'),_0x344a60[_0x591edd(0x235)]='<option>获取失败</option>';}finally{_0x344a60[_0x591edd(0x2bf)]=![];}}async function purgeStorage(){const _0x1250f8=_0x1cfca3;if(confirm(_0x1250f8(0x173))){toastr[_0x1250f8(0x202)](_0x1250f8(0x169),'圣旨');const _0x35d1cf=await _0x589651['purgeStorage']();_0x35d1cf?toastr['success'](_0x1250f8(0x1c9),'圣意'):toastr[_0x1250f8(0x1f3)]('清空宝库失败。','警报'),await updatePanelStatus();}}async function startCondensation(){const _0x3fd563=_0x1cfca3,_0x4fe47c=document[_0x3fd563(0x23a)]('hly-condensation-results'),_0x565ecf=_0x4fe47c[_0x3fd563(0x2da)][_0x3fd563(0x1f8)],_0x5d24d3=document[_0x3fd563(0x23a)](_0x3fd563(0x1e3))[_0x3fd563(0x27d)],_0x5aaa80=document[_0x3fd563(0x23a)](_0x3fd563(0x1fc))['value'],_0xce2a04={'start':parseInt(_0x5d24d3),'end':parseInt(_0x5aaa80)};try{let _0x386b18;_0x565ecf?(log(_0x3fd563(0x1da),_0x3fd563(0x202)),toastr[_0x3fd563(0x202)](_0x3fd563(0x261),'圣旨'),_0x386b18=JSON[_0x3fd563(0x2d2)](_0x565ecf),delete _0x4fe47c['dataset'][_0x3fd563(0x1f8)]):(log(_0x3fd563(0x276),_0x3fd563(0x202)),toastr[_0x3fd563(0x202)]('正在准备凝识...','圣旨'),_0x386b18=_0x589651['getMessagesForCondensation']());if(!_0x386b18||_0x386b18['length']===0x0){toastr[_0x3fd563(0x17f)]('未找到符合条件的消息可供凝识。',_0x3fd563(0x2e0)),_0x4fe47c[_0x3fd563(0x24f)]=_0x3fd563(0x25b);return;}_0x4fe47c[_0x3fd563(0x24f)]=_0x3fd563(0x29b)+_0x386b18[_0x3fd563(0x262)]+_0x3fd563(0x271),toastr[_0x3fd563(0x202)](_0x3fd563(0x29b)+_0x386b18[_0x3fd563(0x262)]+_0x3fd563(0x271),_0x3fd563(0x2e0));const _0x139c00=await _0x589651['processCondensation'](_0x386b18,log,_0xce2a04);if(_0x139c00[_0x3fd563(0x1c8)]){toastr[_0x3fd563(0x1c8)](_0x3fd563(0x2d7)+_0x139c00[_0x3fd563(0x1de)]+_0x3fd563(0x1df),_0x3fd563(0x2f2));const _0x3b3dcf=_0xce2a04[_0x3fd563(0x184)]===0x0?getContext()[_0x3fd563(0x226)][_0x3fd563(0x262)]:_0xce2a04[_0x3fd563(0x184)];_0x4fe47c[_0x3fd563(0x24f)]=_0x3fd563(0x13d)+_0xce2a04[_0x3fd563(0x1f5)]+_0x3fd563(0x24d)+_0x3b3dcf+_0x3fd563(0x191)+_0x139c00[_0x3fd563(0x1de)]+'\x20条忆识。';}else throw new Error(_0x139c00[_0x3fd563(0x1f3)]||_0x3fd563(0x28d));}catch(_0x4374f1){console['error'](_0x3fd563(0x127),_0x4374f1),toastr[_0x3fd563(0x1f3)](_0x3fd563(0x2e5)+_0x4374f1[_0x3fd563(0x12d)],_0x3fd563(0x129)),_0x4fe47c[_0x3fd563(0x24f)]=_0x3fd563(0x2e5)+_0x4374f1[_0x3fd563(0x12d)];}finally{await updatePanelStatus();}}async function loadWorldbookList(){const _0x5069fd=_0x1cfca3,_0x451d3d=document[_0x5069fd(0x23a)]('hly-hist-select-library');if(!_0x451d3d)return;try{log('正在获取可用书库列表...',_0x5069fd(0x202));const _0x5d2273=await _0x3b2ead[_0x5069fd(0x178)]();_0x451d3d[_0x5069fd(0x235)]=_0x5069fd(0x244);if(_0x5d2273[_0x5069fd(0x262)]===0x0){_0x451d3d[_0x5069fd(0x235)]='<option\x20value=\x22\x22>未找到任何书库</option>';return;}_0x5d2273[_0x5069fd(0x236)](_0x3ed5a5=>{const _0x23760b=new Option(_0x3ed5a5,_0x3ed5a5);_0x451d3d['add'](_0x23760b);}),log(_0x5069fd(0x2a4)+_0x5d2273[_0x5069fd(0x262)]+_0x5069fd(0x2cc),_0x5069fd(0x1c8));}catch(_0x5f01d2){console['error'](_0x5069fd(0x2ee),_0x5f01d2),log(_0x5069fd(0x2de)+_0x5f01d2[_0x5069fd(0x12d)],'error'),_0x451d3d[_0x5069fd(0x235)]=_0x5069fd(0x1f2);}}async function handleWorldbookSelectionChange(){const _0x19ac71=_0x1cfca3,_0x33d84f=document[_0x19ac71(0x23a)]('hly-hist-select-library'),_0x1aeb94=document[_0x19ac71(0x23a)]('hly-hist-entry-multiselect-btn'),_0x295f7d=document[_0x19ac71(0x23a)](_0x19ac71(0x28f)),_0x1c3668=_0x33d84f['value'];_0x1aeb94[_0x19ac71(0x2bf)]=!![],_0x1aeb94['querySelector']('span')[_0x19ac71(0x24f)]='正在加载条目...',_0x295f7d[_0x19ac71(0x235)]='',_0x295f7d['style'][_0x19ac71(0x28e)]=_0x19ac71(0x259);if(!_0x1c3668){_0x1aeb94[_0x19ac71(0x198)](_0x19ac71(0x22a))[_0x19ac71(0x24f)]=_0x19ac71(0x137);return;}try{log(_0x19ac71(0x25a)+_0x1c3668+_0x19ac71(0x1c7),'info');const _0xaa901d=await _0x3b2ead[_0x19ac71(0x13a)](_0x1c3668);if(_0xaa901d[_0x19ac71(0x262)]===0x0){_0x1aeb94['querySelector'](_0x19ac71(0x22a))[_0x19ac71(0x24f)]=_0x19ac71(0x1d8);return;}const _0x25d78e='\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22hly-multiselect-option\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20id=\x22hly-hist-select-all-entries\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<strong>全选/全不选</strong>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>';_0x295f7d[_0x19ac71(0x274)]('beforeend',_0x25d78e),_0xaa901d['forEach'](_0x5d2ade=>{const _0x1a64b8=_0x19ac71,_0x4e771c='\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22hly-multiselect-option\x22\x20title=\x22'+_0x5d2ade[_0x1a64b8(0x20b)]+_0x1a64b8(0x16a)+_0x5d2ade[_0x1a64b8(0x2a8)]+')\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20class=\x22hly-hist-entry-checkbox\x22\x20value=\x22'+_0x5d2ade[_0x1a64b8(0x2a8)]+_0x1a64b8(0x1eb)+_0x5d2ade['comment']+_0x1a64b8(0x27a);_0x295f7d[_0x1a64b8(0x274)]('beforeend',_0x4e771c);}),log(_0x19ac71(0x2a4)+_0xaa901d['length']+'\x20个条目。',_0x19ac71(0x1c8)),_0x1aeb94[_0x19ac71(0x198)](_0x19ac71(0x22a))[_0x19ac71(0x24f)]=_0x19ac71(0x158)+_0xaa901d[_0x19ac71(0x262)]+_0x19ac71(0x24b);}catch(_0x3c9a9b){console[_0x19ac71(0x1f3)](_0x19ac71(0x29c)+_0x1c3668+_0x19ac71(0x155),_0x3c9a9b),log(_0x19ac71(0x2dd)+_0x3c9a9b[_0x19ac71(0x12d)],_0x19ac71(0x1f3)),_0x1aeb94[_0x19ac71(0x198)](_0x19ac71(0x22a))[_0x19ac71(0x24f)]=_0x19ac71(0x1d1);}finally{_0x1aeb94[_0x19ac71(0x2bf)]=![];}}function _0x4621(){const _0xd025d4=['hly-rerank-model','hly-custom-endpoint-docket','435WudiWo','请先选择书库','正在读取文件...','\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','getLoresForWorldbook','condensationHistory','selectedIndex','聊天记录从第\x20','warn','appendChild','split','hly-query-message-count','hly-embedding-model','hly-tag-extraction-toggle','fa-exclamation-triangle','hly-rerank-url','知识库【','成功获取\x20','hly-kb-list-local-placeholder','type','global','moveKnowledgeBase','executeCompilation','输入兼容OpenAI的embeddings端点','scrollTop','log-success','.hly-exclusion-rule-row','kbScope','编辑内容排除规则','apiKey','startHLYHistoriography','》的条目失败:','[翰林院-枢纽]\x20获取模型列表失败:','成功录入\x20','已选择\x200\x20/\x20','updateHLYMemoryCount','previewHLYCondensation','451zUPpHc','testApiConnection','add','local_proxy','\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-exclusion-rule-row\x22\x20data-index=\x22','hly-rerank-top-n','正在测试神力连接...','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨','\x20楼:\x20[','chunkSize','initialize','getLockedSessionInfo','[翰林院-枢纽]\x20已成功连接各部政令畅通。','本地代理地址:','正在清空宝库...','\x20(Key:\x20','\x20个知识库删除失败。','[翰林院-枢纽]\x20未能获取SillyTavern上下文绑定失败。','hly-injection-template','.hly-kb-name','197590FOUDqr','.hly-kb-move-btn','1LPspSh','【手动存档】所有设定已存档封印。','此操作将彻底清空当前角色的所有忆识(向量),且无法恢复。您确定要继续吗?','getMessagesForCondensation','hly-api-endpoint','\x20楼到\x20','closest','getAvailableWorldbooks','当前角色没有任何局部知识库可供删除。',']\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','。进度已保存,可稍后重试。','hly-injection-role','abort','advanced','warning','\x20个知识块','[翰林院-枢纽]\x20预览过程发生错误:','hly-injection-depth','</div>','end','map','children','batchSize','.hly-hist-entry-checkbox:checked','\x20个模型。','任务已中止。','saveHLYSettings','scripts/extensions/third-party/ST-Amily2-Chat-Optimisation/HanLin.md','classList','input[name=\x22hly-injection-position\x22]:checked','preventDefault','切换知识库\x20','\x20楼已成功凝识新增\x20','圣旨已达','hly-include-user','N/A','hanlinyuan-ingest-progress-bar','depth_role','input[name=\x22','querySelector','.hly-preview-item-v2','<option>获取失败</option>','active','》中的\x20','notify','contains','宝库状态','template','loadProgress','ingestTextToHanlinyuan','hly-kb-list-item','title','hly-hist-select-all-entries','hly-tag-input','layerEnd','<div\x20class=\x22hly-preview-container-v2\x22>','hly-locked-status','.hly-preview-textarea','retrieval','position','fetchHLYRerankModels','会话已解锁,将跟随当前角色。','翰林院设定已重置为初始状态。','model','find','启禀大人,发现此书上次录入已完成\x20','预览内容已更新,可随时开始凝识。','</i></p>','fas\x20fa-lock-open','收到手动录入请求,文本长度:\x20','hly-kb-toggle','[实时刷新]\x20批次完成忆识总数已更新。','remove','任务完成!成功录入\x20','hly-log-output','%。是否从上次中断之处继续?','hly-chunk-size','1108402kzouFC','includes','\x20楼的内容共\x20','会话已解锁。','hly-include-ai','enabled','resetHLYSettings','\x20(ID:\x20','processedChunks','》获取条目列表...','success','宝库已清空。','processed','hly-exclusion-rules-container','integer','13563180KKOiHe','is_user','click','toggleSessionLock','加载失败','content','切换状态失败:\x20','未能获取到任何模型。','settingKey','hly-rerank-api-key','push','此书库为空','用户请求查看宝库状态。','检测到预览后待处理的消息对象,开始精确凝识...','hly-api-key','\x20楼凝识至第\x20','\x22></i>\x20[','count','\x20条忆识。','label','未选择文件','批量编纂任务已开始...','hly-layer-start','<option>未找到模型</option>','hanlinyuan-ingest-novel-file-input','getGlobalKnowledgeBases','hly-delete-rule-btn','from','filter','您确定要将所有设定恢复为出厂默认值吗?','\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>','\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','target','flex','[自动保存]\x20设置项\x20\x27','resetSettings','\x20块继续录入。','<option\x20value=\x22\x22>加载失败</option>','error','saveSettings','start','确认并更新预览','val','finalMessages','removeKnowledgeBase',')没有任何知识库可供移动。','showHLYStats','hly-layer-end','radio','<p\x20class=\x22hly-record-hint\x22>可在此预览凝识结果。</p>','预览失败:\x20','input[name=\x22hly-injection-position\x22][value=\x22','保存规则','info','totalVectors','当前所有操作都将指向这个锁定的宝库:','错误:\x20','addEventListener','您确定要永久删除【当前角色】的全部\x20','depth','会话已锁定','锁定会话','comment','hly-hist-entry-multiselect-btn','批量编纂任务已完成。','rerank','文书已成功录入宝库,新增\x20','】吗?','globalToLocal','div','开始获取模型列表...','querySelectorAll','findIndex','<option>正在获取...</option>','hly-hist-select-library','[断点续传]\x20用户选择放弃旧任务\x20','fetchEmbeddingModels','className','\x20个知识库均已成功移动。','编纂失败:\x20','开始对《','\x20条有效条目请点击“开始凝识”进入自动向量化流程。','hly-exclusion-rules-btn','custom','[翰林院-枢纽]\x20手动录入过程发生错误:','block','matchThreshold','layerStart','createElement','chat','解锁会话','trim','totalSuccess','span','预览并编辑凝识内容','[翰林院-枢纽]\x20编纂过程发生严重错误:','手动录入成功,新增\x20','toggleKnowledgeBase',',\x20失败:\x20','hly-api-key-group','hly-kb-delete-local-btn','根据当前勾选条件,未找到符合的消息可供预览。','hly-retrieval-notify','checkbox','innerHTML','forEach','知识库\x20','send_date','开始批量删除\x20','getElementById','fetchRerankModels','hanlinyuan-ingest-novel-controls','messageTypes','input','amily2_open_hanlin_tutorial','神力连接通畅!','hybrid_alpha','beforeend','hly-kb-list-global-placeholder','<option\x20value=\x22\x22>请选择一个书库...</option>','Google\x20API\x20Key:','hly-kb-list-local','preview-item-','fa-times-circle','hly-overlap-size','】移动到【','\x20个条目','获取Rerank模型失败:\x20','\x20楼到第\x20','condensation','textContent','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22hly-toggle-switch\x22\x20title=\x22启用/禁用此知识库\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20class=\x22hly-kb-toggle\x22\x20','翰林院使用教程','files','local','根据标签提取或内容排除条件,未找到任何有效内容。','移动失败:\x20','文书录入失败:\x20','hly-log-entry\x20','删除局部知识库\x20','none','正在为《','未找到符合条件的消息。','fa-circle-info','hly-kb-move-all-to-local','total','</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','toFixed','正在处理您确认后的文书...','length','change','user','批量移动完成。','已选择\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','hly-historiography-results','apiEndpoint','会话已锁定到:\x20','string','getCharacterName','.hly-preview-delete-btn-v2','fas\x20fa-lock','自定义路径:','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22hly-kb-name\x22\x20title=\x22ID:\x20','\x20条消息开始凝识...','点击以解锁,让翰林院跟随当前角色','查看宝库状态成功集合ID=','insertAdjacentHTML','\x20个局部知识库...','未检测到预览文本,按标准流程采集消息...','条)</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-kb-actions\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','所有\x20','4077296XeFdNH','</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>','正在查询宝库状态...','options','value','手动录入','use\x20strict','mes','overlap','input[name=\x22hly-injection-position\x22]','log-warn','局部知识库批量删除完成。成功:\x20','您确定要永久删除知识库【','condensation.exclusionRules','...','getCollectionId','任务已由用户中止。进度已保存,可随时继续。','hlyLog','tagExtractionEnabled','\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','未知错误','display','hly-hist-entry-multiselect-options','】吗?此操作无法恢复!','hly-max-results','[翰林院-枢纽]\x20查询宝库状态失败:','<button\x20class=\x22hly-kb-move-btn\x22\x20title=\x22下移到局部\x22><i\x20class=\x22fas\x20fa-arrow-down\x22></i></button>','正在处理您提交的文书...','kbId','join','》的批量编纂任务已完成。成功:\x20','hly-','批量编纂任务已完成,但有部分错误。','AbortError','已采集\x20','[翰林院-枢纽]\x20加载《','当前角色','signal','embeddingModel','圣谕不明','tab','all','localToGlobal','成功加载\x20','injection','#hly-rules-list','customApiUrl','key',',\x20向量:\x20','getLocalKnowledgeBases','90666voQqgq','name','hly-local-kb-char-name','.hly-log-placeholder','queryMessageCount','\x0a--------------------\x0aAPI端点:\x20','\x20的状态已切换','generateJobId',',重新开始。','请先选择一个\x20.txt\x20文件','>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22hly-toggle-slider\x22></span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22hly-kb-delete-btn\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','录入失败:\x20','请输入您的Google\x20API\x20Key','hly-manual-text','data','fa-check-circle','send-date','查询宝库状态失败:\x20','12AdNByh','isSessionLocked','disabled','神力连接失败:\x20','getChatId','无法获取总数:\x20','manual','hly-rerank-notify','批量移动失败:\x20','\x20失败:\x20','\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','hanlinyuan-ingest-status','\x27\x20已更新为:\x20','hly-kb-list-global','scrollHeight','\x20个书库。','hly-current-character-name','hly-session-lock-btn',',从第\x20','hly-kb-delete-btn','\x20个Rerank模型。','parse','193353TcJyel','previousElementSibling','</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','9579069MuhidK','凝识完成!新增\x20','floor','log-info','dataset','开始将\x20','getSettings','加载条目失败:\x20','加载书库列表失败:\x20','hly-current-chat-id','翰林院启奏','\x20个知识块。','[断点续传]\x20用户选择继续任务\x20','7MDSzZG','hly-condensation-results','凝识失败:\x20','未能获取到任何Rerank模型。','toLocaleTimeString','.hly-nav-item','准备对《','boolean','ingestHLYManualText','checked','\x20块开始。','[翰林院-枢纽]\x20加载书库列表失败:','every','.hly-tab-pane','float','大功告成','#hly-add-rule-btn','stringify','hly-rerank-enabled','clearJob','hly-tag-input-container','keys','[翰林院-枢纽]\x20获取Rerank模型列表失败:','true','翰林院设定已存档封印。','testHLYApi','getVectorCount','-tab','获取模型失败:\x20','[翰林院-枢纽]\x20凝识过程发生错误:','<p\x20class=\x22hly-notes\x20log-error\x22><i>加载失败:\x20','严重错误','\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-is-user=\x22','stopPropagation','.hly-hist-entry-checkbox','message','hly-modal-container','placeholder','exclusionRules','您确定要将\x20','style','startHLYCondensation'];_0x4621=function(){return _0xd025d4;};return _0x4621();}async function startHistoriography(){const _0x3ac60e=_0x1cfca3,_0x11e7c8=document['getElementById']('hly-hist-select-library')[_0x3ac60e(0x27d)],_0x504f66=document['getElementById'](_0x3ac60e(0x28f)),_0xc2df22=document[_0x3ac60e(0x23a)](_0x3ac60e(0x268)),_0x4af4f3=Array['from'](_0x504f66[_0x3ac60e(0x214)](_0x3ac60e(0x188)))[_0x3ac60e(0x185)](_0x2333be=>_0x2333be[_0x3ac60e(0x27d)]);if(!_0x11e7c8||_0x4af4f3[_0x3ac60e(0x262)]===0x0){toastr[_0x3ac60e(0x17f)]('请先选择一个书库并至少选择一个要编纂的条目。',_0x3ac60e(0x2a0));return;}_0xc2df22[_0x3ac60e(0x24f)]=_0x3ac60e(0x2e9)+_0x11e7c8+_0x3ac60e(0x19c)+_0x4af4f3[_0x3ac60e(0x262)]+'\x20个条目进行批量编纂...',toastr[_0x3ac60e(0x202)](_0x3ac60e(0x1e2),'圣旨'),log(_0x3ac60e(0x21d)+_0x11e7c8+'》中的\x20'+_0x4af4f3['length']+'\x20个条目进行编纂...',_0x3ac60e(0x202));try{const _0x3c173f=await _0x3b2ead[_0x3ac60e(0x14c)](_0x11e7c8,_0x4af4f3);_0xc2df22[_0x3ac60e(0x24f)]=_0x3c173f[_0x3ac60e(0x1d2)],_0x3c173f[_0x3ac60e(0x1c8)]?toastr[_0x3ac60e(0x1c8)](_0x3ac60e(0x20d),'大功告成'):toastr[_0x3ac60e(0x17f)](_0x3ac60e(0x299),'圣谕'),log('对《'+_0x11e7c8+_0x3ac60e(0x297)+_0x3c173f[_0x3ac60e(0x229)]+_0x3ac60e(0x2a9)+_0x3c173f[_0x3ac60e(0x203)],_0x3ac60e(0x1c8));}catch(_0x4b318a){console[_0x3ac60e(0x1f3)](_0x3ac60e(0x22c),_0x4b318a),toastr['error'](_0x3ac60e(0x21c)+_0x4b318a[_0x3ac60e(0x12d)],'严重错误'),_0xc2df22[_0x3ac60e(0x24f)]=_0x3ac60e(0x21c)+_0x4b318a[_0x3ac60e(0x12d)];}finally{await updatePanelStatus();}}async function showStats(){const _0x33df22=_0x1cfca3;try{log(_0x33df22(0x1d9),_0x33df22(0x202)),toastr[_0x33df22(0x202)](_0x33df22(0x27b),'圣旨');const _0xb44131=await _0x589651[_0x33df22(0x124)](),_0x4b8209=await _0x589651[_0x33df22(0x288)](),_0x4e4e55=_0x589651[_0x33df22(0x2dc)](),_0x285563='\x0a<pre>\x0a翰林院宝库状态\x0a--------------------\x0a集合ID:\x20'+_0x4b8209+'\x0a忆识总数:\x20'+_0xb44131+_0x33df22(0x2b0)+_0x4e4e55['retrieval'][_0x33df22(0x269)]+'\x0a所用模型:\x20'+_0x4e4e55[_0x33df22(0x1ab)]['embeddingModel']+'\x0a</pre>\x0a\x20\x20\x20\x20\x20\x20\x20\x20';toastr[_0x33df22(0x202)](_0x285563,_0x33df22(0x19f),{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log(_0x33df22(0x273)+_0x4b8209+',\x20忆识总数='+_0xb44131,'success');}catch(_0x444290){console['error'](_0x33df22(0x292),_0x444290),toastr[_0x33df22(0x1f3)](_0x33df22(0x2bc)+_0x444290[_0x33df22(0x12d)],_0x33df22(0x129)),log('查询宝库状态失败:\x20'+_0x444290[_0x33df22(0x12d)],_0x33df22(0x1f3));}}function showExclusionRulesModal(){const _0x371704=_0x1cfca3,_0x7cfcb8=_0x589651[_0x371704(0x2dc)](),_0x52dd31=_0x7cfcb8['condensation'][_0x371704(0x130)]||[],_0x182994=(_0x46ac87={'start':'','end':''},_0x16df7b)=>_0x371704(0x15f)+_0x16df7b+_0x371704(0x139)+_0x46ac87[_0x371704(0x1f5)]+'\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'+_0x46ac87[_0x371704(0x184)]+_0x371704(0x28c),_0x375d0e=_0x52dd31[_0x371704(0x185)](_0x182994)[_0x371704(0x296)](''),_0xeaa44='\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>'+_0x375d0e+_0x371704(0x2d5);showHtmlModal(_0x371704(0x152),_0xeaa44,{'okText':_0x371704(0x201),'onOk':_0x349667=>{const _0x1426e5=_0x371704,_0x3fc77d=[];_0x349667['find'](_0x1426e5(0x150))['each'](function(){const _0x315ef8=_0x1426e5,_0x349349=$(this)['find'](_0x315ef8(0x23e))['eq'](0x0)[_0x315ef8(0x1f7)]()[_0x315ef8(0x228)](),_0x13a843=$(this)[_0x315ef8(0x1b1)](_0x315ef8(0x23e))['eq'](0x1)[_0x315ef8(0x1f7)]()['trim']();_0x349349&&_0x13a843&&_0x3fc77d[_0x315ef8(0x1d7)]({'start':_0x349349,'end':_0x13a843});}),updateAndSaveSetting(_0x1426e5(0x286),_0x3fc77d),toastr[_0x1426e5(0x1c8)]('内容排除规则已保存。',_0x1426e5(0x192));}});const _0x135730=document['getElementById'](_0x371704(0x1cb)),_0x899319=_0x135730[_0x371704(0x198)](_0x371704(0x2a6));_0x135730[_0x371704(0x198)](_0x371704(0x2f3))[_0x371704(0x206)](_0x371704(0x1cf),()=>{const _0x347de0=_0x371704,_0x4dca2c=_0x899319[_0x347de0(0x186)][_0x347de0(0x262)],_0x3abf2f=_0x182994({'start':'','end':''},_0x4dca2c);_0x899319['insertAdjacentHTML'](_0x347de0(0x242),_0x3abf2f);}),_0x899319[_0x371704(0x206)](_0x371704(0x1cf),_0x13e73a=>{const _0x51d3e2=_0x371704;_0x13e73a[_0x51d3e2(0x1ed)][_0x51d3e2(0x18d)][_0x51d3e2(0x19e)](_0x51d3e2(0x1e7))&&_0x13e73a['target'][_0x51d3e2(0x177)](_0x51d3e2(0x150))[_0x51d3e2(0x1b9)]();});}function previewCondensation(){const _0x555b7f=_0x1cfca3,_0x3489c8=document['getElementById'](_0x555b7f(0x2e4));try{const _0x4d09da=_0x589651[_0x555b7f(0x2dc)](),_0x31b855=_0x4d09da[_0x555b7f(0x24e)][_0x555b7f(0x130)]||[],_0x37793d={'user':document['getElementById'](_0x555b7f(0x193))[_0x555b7f(0x2ec)],'ai':document[_0x555b7f(0x23a)](_0x555b7f(0x1c2))[_0x555b7f(0x2ec)]},_0x14b578=document[_0x555b7f(0x23a)]('hly-tag-extraction-toggle')['checked'],_0x5e7568=_0x14b578?document[_0x555b7f(0x23a)](_0x555b7f(0x1a6))['value'][_0x555b7f(0x140)](',')[_0x555b7f(0x185)](_0x2d9262=>_0x2d9262[_0x555b7f(0x228)]())[_0x555b7f(0x1e9)](Boolean):[],_0x10d289=_0x589651[_0x555b7f(0x174)](_0x37793d);if(!_0x10d289||_0x10d289[_0x555b7f(0x262)]===0x0){_0x3489c8[_0x555b7f(0x24f)]=_0x555b7f(0x232),toastr['warning'](_0x555b7f(0x25b),_0x555b7f(0x2e0));return;}const _0x5a2660=getContext()['chat'],_0x5b88db=_0x10d289[_0x555b7f(0x185)]((_0x150a8b,_0x430b6f)=>{const _0x4cd741=_0x555b7f;let _0x35f679;if(_0x150a8b[_0x4cd741(0x1ce)])_0x35f679=_0x150a8b[_0x4cd741(0x280)];else{if(_0x14b578&&_0x5e7568[_0x4cd741(0x262)]>0x0){const _0x1257e6=extractBlocksByTags(_0x150a8b['mes'],_0x5e7568);_0x35f679=_0x1257e6[_0x4cd741(0x296)]('\x0a\x0a');}else _0x35f679=_0x150a8b['mes'];_0x35f679=applyExclusionRules(_0x35f679,_0x31b855);}const _0x1ea9ce=_0x5a2660[_0x4cd741(0x215)](_0x53613f=>_0x53613f===_0x150a8b),_0x82cf6d=_0x1ea9ce!==-0x1?_0x1ea9ce+0x1:-0x1;return{'id':_0x4cd741(0x247)+_0x430b6f,'name':_0x150a8b['name'],'content':_0x35f679[_0x4cd741(0x228)](),'floor':_0x82cf6d,'is_user':_0x150a8b[_0x4cd741(0x1ce)],'send_date':_0x150a8b[_0x4cd741(0x238)]};})[_0x555b7f(0x1e9)](_0x51acb2=>_0x51acb2[_0x555b7f(0x1d2)]);if(_0x5b88db['length']===0x0){_0x3489c8[_0x555b7f(0x24f)]=_0x555b7f(0x254),toastr[_0x555b7f(0x17f)](_0x555b7f(0x254),_0x555b7f(0x2e0));return;}const _0x134c71=_0x5b88db['map']((_0x5791d9,_0xb82525)=>'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-preview-item-v2\x22\x20id=\x22'+_0x5791d9['id']+_0x555b7f(0x1ec)+_0x5791d9[_0x555b7f(0x2d8)]+_0x555b7f(0x163)+_0x5791d9[_0x555b7f(0x2ac)]+_0x555b7f(0x17a)+_0x5791d9[_0x555b7f(0x2d8)]+_0x555b7f(0x12a)+_0x5791d9[_0x555b7f(0x1ce)]+_0x555b7f(0x267)+_0x5791d9[_0x555b7f(0x238)]+'\x22>'+_0x5791d9[_0x555b7f(0x1d2)]+_0x555b7f(0x25f)+_0x5791d9['id']+_0x555b7f(0x2c7))[_0x555b7f(0x296)]('');showHtmlModal(_0x555b7f(0x22b),_0x555b7f(0x1a8)+_0x134c71+_0x555b7f(0x183),{'okText':_0x555b7f(0x1f6),'onOk':_0x5d744a=>{const _0x4dc2bd=_0x555b7f,_0x399973=[];_0x5d744a['find'](_0x4dc2bd(0x199))['each'](function(){const _0x46b23c=_0x4dc2bd,_0x1cca7e=$(this)[_0x46b23c(0x1b1)](_0x46b23c(0x1aa)),_0x8c7a46=_0x1cca7e[_0x46b23c(0x1f7)]();_0x8c7a46['trim']()&&_0x399973[_0x46b23c(0x1d7)]({'mes':_0x8c7a46,'is_user':_0x1cca7e[_0x46b23c(0x2b9)]('is-user'),'send_date':_0x1cca7e[_0x46b23c(0x2b9)](_0x46b23c(0x2bb)),'floor':_0x1cca7e[_0x46b23c(0x2b9)]('floor')});}),_0x3489c8['dataset'][_0x4dc2bd(0x1f8)]=JSON[_0x4dc2bd(0x2f4)](_0x399973);const _0x29ca3b=document[_0x4dc2bd(0x23a)](_0x4dc2bd(0x1e3))[_0x4dc2bd(0x27d)],_0x4e6cee=document[_0x4dc2bd(0x23a)]('hly-layer-end')[_0x4dc2bd(0x27d)];_0x3489c8['textContent']=_0x4dc2bd(0x266)+_0x29ca3b+_0x4dc2bd(0x176)+_0x4e6cee+_0x4dc2bd(0x1c0)+_0x399973['length']+_0x4dc2bd(0x21e),toastr[_0x4dc2bd(0x1c8)](_0x4dc2bd(0x1b3),_0x4dc2bd(0x192));}}),$(_0x555b7f(0x26d))['on']('click',function(_0x42b021){const _0x326f9a=_0x555b7f;_0x42b021[_0x326f9a(0x18f)]();const _0x4e9714=$(this)['data'](_0x326f9a(0x1ed));$('#'+_0x4e9714)[_0x326f9a(0x1b9)]();});}catch(_0x5a32e9){console[_0x555b7f(0x1f3)](_0x555b7f(0x181),_0x5a32e9),_0x3489c8['textContent']=_0x555b7f(0x1ff)+_0x5a32e9[_0x555b7f(0x12d)],toastr[_0x555b7f(0x1f3)]('预览失败:\x20'+_0x5a32e9[_0x555b7f(0x12d)],_0x555b7f(0x129));}}function log(_0x46d0f9,_0x722e0d=_0x1cfca3(0x202)){const _0x57606b=_0x1cfca3,_0x408c26=document[_0x57606b(0x23a)](_0x57606b(0x1bb));if(!_0x408c26)return;const _0xce696a=document['createElement']('p'),_0x2e754a=new Date()[_0x57606b(0x2e7)]();let _0x598348=_0x57606b(0x25c),_0x260920=_0x57606b(0x2d9);switch(_0x722e0d){case _0x57606b(0x1c8):_0x598348=_0x57606b(0x2ba),_0x260920=_0x57606b(0x14f);break;case _0x57606b(0x1f3):_0x598348=_0x57606b(0x248),_0x260920='log-error';break;case _0x57606b(0x13e):_0x598348=_0x57606b(0x144),_0x260920=_0x57606b(0x283);break;}_0xce696a['className']=_0x57606b(0x257)+_0x260920,_0xce696a[_0x57606b(0x235)]='<i\x20class=\x22fa-solid\x20'+_0x598348+_0x57606b(0x1dd)+_0x2e754a+']\x20'+_0x46d0f9;const _0xcd0e95=_0x408c26[_0x57606b(0x198)](_0x57606b(0x2ae));_0xcd0e95&&_0xcd0e95[_0x57606b(0x1b9)](),_0x408c26[_0x57606b(0x13f)](_0xce696a),_0x408c26[_0x57606b(0x14e)]=_0x408c26[_0x57606b(0x2cb)];}async function ingestManualText(){const _0x563185=_0x1cfca3,_0x1559d6=document[_0x563185(0x23a)](_0x563185(0x2b8)),_0x3bea60=_0x1559d6['value']['trim']();if(!_0x3bea60){toastr[_0x563185(0x17f)]('录入内容不能为空。','翰林院启奏'),log('用户尝试录入空文本。',_0x563185(0x13e));return;}log(_0x563185(0x1b6)+_0x3bea60[_0x563185(0x262)],_0x563185(0x202)),toastr[_0x563185(0x202)](_0x563185(0x294),'圣旨');try{const _0x4f0aec=await _0x589651[_0x563185(0x1a2)](_0x3bea60,_0x563185(0x2c3),{'sourceName':_0x563185(0x27e)});if(_0x4f0aec[_0x563185(0x1c8)])toastr[_0x563185(0x1c8)](_0x563185(0x20f)+_0x4f0aec[_0x563185(0x1de)]+'\x20条忆识。',_0x563185(0x2f2)),log(_0x563185(0x22d)+_0x4f0aec['count']+_0x563185(0x1df),_0x563185(0x1c8)),_0x1559d6[_0x563185(0x27d)]='';else throw new Error(_0x4f0aec[_0x563185(0x1f3)]||_0x563185(0x28d));}catch(_0x3a495f){console[_0x563185(0x1f3)](_0x563185(0x221),_0x3a495f),toastr[_0x563185(0x1f3)](_0x563185(0x256)+_0x3a495f[_0x563185(0x12d)],_0x563185(0x129)),log('手动录入失败:\x20'+_0x3a495f[_0x563185(0x12d)],_0x563185(0x1f3));}finally{await updatePanelStatus();}}