Files
ST-Amily2-Chat-Optimisation…/ui/hanlinyuan-bindings.js
2025-07-23 06:29:14 +08:00

2 lines
38 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 _0xc2967b=_0x129f;(function(_0x2e69ed,_0x29425d){const _0x4e2df7=_0x129f,_0x3af0d4=_0x2e69ed();while(!![]){try{const _0x487b27=-parseInt(_0x4e2df7(0xf0))/0x1*(parseInt(_0x4e2df7(0xe0))/0x2)+-parseInt(_0x4e2df7(0x17f))/0x3*(parseInt(_0x4e2df7(0x14b))/0x4)+parseInt(_0x4e2df7(0x6d))/0x5+-parseInt(_0x4e2df7(0x164))/0x6*(parseInt(_0x4e2df7(0x137))/0x7)+-parseInt(_0x4e2df7(0xe7))/0x8*(parseInt(_0x4e2df7(0xdc))/0x9)+-parseInt(_0x4e2df7(0xec))/0xa+parseInt(_0x4e2df7(0x155))/0xb;if(_0x487b27===_0x29425d)break;else _0x3af0d4['push'](_0x3af0d4['shift']());}catch(_0x2dde75){_0x3af0d4['push'](_0x3af0d4['shift']());}}}(_0x17e6,0x99ff4));import{getContext}from'/scripts/extensions.js';import*as _0x5a3b7a from'../core/rag-processor.js';import*as _0x4c2e19 from'../core/historiographer.js';import*as _0x7f301b from'../core/utils/context-utils.js';import{showContentModal,showHtmlModal}from'./page-window.js';import{extractBlocksByTags,applyExclusionRules}from'../core/utils/rag-tag-extractor.js';_0xc2967b(0x181);function _0x17e6(){const _0x284e17=['\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','未找到符合条件的消息。','fa-times-circle','querySelector','fa-check-circle','凝识完成!新增\x20','model','depth_role','最终将对以下\x20','preview-item-','split','hly-manual-text','layerStart','文书已成功录入宝库,新增\x20','success','[data-setting-key]','boolean','getAvailableWorldbooks','display','[翰林院-枢纽]\x20查询宝库状态失败:','disabled','float','hly-hist-select-entry','凝识失败:\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','\x0a忆识总数:\x20','startHLYHistoriography','hly-log-output','checked','none','hly-query-message-count','hly-rerank-api-key','hly-exclusion-rules-btn','amily2_open_hanlin_tutorial','log-warn','manual','closest','trim','...','filter','true','大功告成','\x27\x20已更新为:\x20','检测到预览后待处理的文本,开始直接凝识...','tagExtractionEnabled','fetchHLYRerankModels','确认并更新预览','messageTypes','编纂失败:\x20','url','getChatId','<div\x20class=\x22hly-preview-container-v2\x22>','\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>','正在清空宝库...','编纂任务已开始...','正在采集消息...','未能获取到任何Rerank模型。','.hly-preview-textarea','injection','dataset','active','add','成功加载\x20','string','exclusionRules','error','hly-log-entry\x20','finalText','hly-current-chat-id','input[name=\x22hly-injection-position\x22][value=\x22','info','input','join','length','hly-injection-role','开始对《','\x20楼:\x20[','value','enabled','\x20条忆识。','.hly-nav-item','hly-overlap-size','fa-exclamation-triangle','tab','options','加载书库列表失败:\x20','template','未找到符合条件的消息可供凝识。','正在获取可用书库列表...','<option>获取失败</option>','depth','beforeend','[翰林院-枢纽]\x20加载《','executeCompilation','\x0a</pre>\x0a\x20\x20\x20\x20\x20\x20\x20\x20','根据当前勾选条件,未找到符合的消息可供预览。','hly-batch-size','hly-api-key','hly-rerank-top-n','\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-exclusion-rule-row\x22\x20data-index=\x22','getElementById','custom','获取模型失败:\x20','comment','remove','神力连接通畅!','<option>未找到模型</option>','customApiUrl','querySelectorAll','预览内容已更新,可随时开始凝识。','820557rODpJA','notify','\x20进行编纂...','hly-hist-select-library','12lAanSk','input[name=\x22hly-injection-position\x22]:checked','正在处理预览后的文本...','[翰林院-枢纽]\x20更新忆识数量失败:','batchSize','purgeHLYStorage','.hly-tab-pane','72QqQdds','[翰林院-枢纽]\x20获取Rerank模型列表失败:','hly-delete-rule-btn','condensation','[翰林院-枢纽]\x20已成功连接各部政令畅通。','1962290GqIQQj','正在测试神力连接...','\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','正在处理您确认后的文书...','176137qPoRIW','hly-api-endpoint',')\x20的编纂任务已完成。','chunkSize','val','hly-historiography-results','user','tags','翰林院启奏','classList','hly-include-user','未知错误','target','fetchEmbeddingModels','》获取条目列表...','layerEnd','<option\x20value=\x22\x22>未找到任何书库</option>','textContent','scrollTop','神力连接失败:\x20','addEventListener','[翰林院-枢纽]\x20未能获取SillyTavern上下文绑定失败。','请先选择一个书库和要编纂的条目。','查询宝库状态失败:\x20','\x22></i>\x20[','fa-circle-info','\x20(Key:\x20','style','\x20条消息开始凝识...','hly-embedding-model','<option\x20value=\x22\x22>此书库为空</option>','includes','[翰林院-枢纽]\x20预览过程发生错误:','getCharacterName','amily2_open_rag_palace','[翰林院-枢纽]\x20手动录入过程发生错误:','forEach','maxResults','getMessagesForCondensation','根据标签提取或内容排除条件,未找到任何有效内容。','\x20条内容进行凝识\x0a\x0a','saveSettings','严重错误','hly-injection-depth','hly-custom-endpoint-docket','编纂任务已完成。','fetchHLYEmbeddingModels','startHLYCondensation','<option\x20value=\x22\x22>加载失败</option>','toLocaleTimeString','map','checkbox','hly-injection-template','radio','click','#hly-add-rule-btn','purgeStorage','start','成功获取\x20','updateHLYMemoryCount','圣旨已达','content','-tab','翰林院设定已重置为初始状态。','已采集\x20','此操作将彻底清空当前角色的所有忆识(向量),且无法恢复。您确定要继续吗?','ingestHLYManualText','\x0a--------------------\x0aAPI端点:\x20','retrieval','hly-modal-container','warn','329413coPgmr','hly-tag-input-container',')\x20进行编纂...','embeddingModel','手动录入失败:\x20','预览并编辑凝识内容','log-error','宝库已清空。','apiKey','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨','\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','【手动存档】所有设定已存档封印。','toggle','innerHTML','</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','\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','log-success','hly-layer-start','<option>正在获取...</option>','scrollHeight','1304596xUHgOx','from','change','hly-condensation-results','[翰林院-枢纽]\x20加载书库列表失败:','previewHLYCondensation','清空宝库失败。','name','find','each','29459067MHQWBD','加载条目失败:\x20','stringify','position','resetHLYSettings','hly-rerank-model','appendChild','\x20个书库。','\x0a所用模型:\x20','<option\x20value=\x22\x22>请选择一个条目...</option>','hly-retrieval-notify','[自动保存]\x20设置项\x20\x27','apiEndpoint','getSettings','翰林院设定已存档封印。','6KVTfms','hly-current-vector-count','翰林院使用教程','integer','<option\x20value=\x22\x22>正在加载条目...</option>','hly-','warning','文书录入失败:\x20','正在处理您提交的文书...','advanced','data','testApiConnection','ingestTextToHanlinyuan','message','.hly-preview-delete-btn-v2','push','[翰林院-枢纽]\x20编纂过程发生错误:','圣谕不明','scripts/extensions/third-party/ST-Amily2-Chat-Optimisation/HanLin.md','正在为《','[翰林院-枢纽]\x20获取模型列表失败:','\x20个Rerank模型。','fetchRerankModels','准备对《','contains','log-info','overlap','6tmJwTT','hly-layer-end','use\x20strict','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-preview-item-v2\x22\x20id=\x22','processCondensation','hly-tag-extraction-toggle','未能获取到任何模型。','key','hly-include-ai','block','getVectorCount','className','rerank','count','type','预览失败:\x20','获取Rerank模型失败:\x20','收到手动录入请求,文本长度:\x20','查看宝库状态成功集合ID=','top_n','hly-tag-input',']\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>','mes','用户尝试录入空文本。','initialize','showHLYStats','\x20个模型。','内容排除规则已保存。','.hly-log-placeholder','3628200sGDCrM'];_0x17e6=function(){return _0x284e17;};return _0x17e6();}function setupGlobalEventHandlers(){const _0x179de1=_0xc2967b;window['saveHLYSettings']=()=>saveSettingsFromUI(![]),window[_0x179de1(0x159)]=resetSettingsToUI,window['testHLYApi']=testApi,window[_0x179de1(0x11e)]=fetchHLYEmbeddingModels,window[_0x179de1(0x9b)]=fetchHLYRerankModels,window[_0x179de1(0x12b)]=updatePanelStatus,window[_0x179de1(0xe5)]=purgeStorage,window[_0x179de1(0x11f)]=startCondensation,window[_0x179de1(0x150)]=previewCondensation,window[_0x179de1(0x132)]=ingestManualText,window['hlyLog']=log,window[_0x179de1(0x69)]=showStats,window[_0x179de1(0x88)]=startHistoriography;}function updateAndSaveSetting(_0x7b7834,_0x1a0709){const _0x88718c=_0xc2967b,_0x2ae761=_0x5a3b7a[_0x88718c(0x162)]();if(!_0x2ae761)return;const _0x2b33bd=_0x7b7834[_0x88718c(0x78)]('.');let _0x2006a2=_0x2ae761;for(let _0x1d2d28=0x0;_0x1d2d28<_0x2b33bd[_0x88718c(0xb7)]-0x1;_0x1d2d28++){_0x2006a2=_0x2006a2[_0x2b33bd[_0x1d2d28]]=_0x2006a2[_0x2b33bd[_0x1d2d28]]||{};}_0x2006a2[_0x2b33bd[_0x2b33bd[_0x88718c(0xb7)]-0x1]]=_0x1a0709,_0x5a3b7a[_0x88718c(0x119)](),log(_0x88718c(0x160)+_0x7b7834+_0x88718c(0x98)+JSON[_0x88718c(0x157)](_0x1a0709),_0x88718c(0x7c));}function bindAutoSaveEvents(){const _0x4d502b=_0xc2967b,_0x2b4a9b=document[_0x4d502b(0xd2)]('hly-modal-container');if(!_0x2b4a9b)return;_0x2b4a9b[_0x4d502b(0x104)]('change',_0x5cba6a=>{const _0x358f2d=_0x4d502b,_0x176b0e=_0x5cba6a[_0x358f2d(0xfc)],_0xd66cdd=_0x176b0e[_0x358f2d(0xa9)]['settingKey'];if(!_0xd66cdd)return;let _0x5e46d5;const _0x1d44fa=_0x176b0e[_0x358f2d(0xa9)][_0x358f2d(0x18d)]||_0x358f2d(0xad);if(_0x176b0e[_0x358f2d(0x18d)]===_0x358f2d(0x123))_0x5e46d5=_0x176b0e[_0x358f2d(0x8a)];else{if(_0x176b0e[_0x358f2d(0x18d)]===_0x358f2d(0x125)){if(_0x176b0e[_0x358f2d(0x8a)]){const _0x3be7dc=_0x2b4a9b[_0x358f2d(0xda)]('input[name=\x22'+_0x176b0e[_0x358f2d(0x152)]+'\x22]'),_0x4ea8e5=Array[_0x358f2d(0x14c)](_0x3be7dc)[_0x358f2d(0x153)](_0x53fffb=>_0x53fffb[_0x358f2d(0x8a)]);_0x5e46d5=_0x4ea8e5['value'];}else return;}else _0x5e46d5=_0x176b0e['value'];}switch(_0x1d44fa){case _0x358f2d(0x167):_0x5e46d5=parseInt(_0x5e46d5,0xa);break;case _0x358f2d(0x83):_0x5e46d5=parseFloat(_0x5e46d5);break;case _0x358f2d(0x7e):typeof _0x5e46d5!==_0x358f2d(0x7e)&&(_0x5e46d5=_0x5e46d5==='true');break;}if(_0x176b0e[_0x358f2d(0x18d)]===_0x358f2d(0x125)&&!_0x176b0e[_0x358f2d(0x8a)])return;updateAndSaveSetting(_0xd66cdd,_0x5e46d5);});}export function bindHanlinyuanEvents(){const _0x48c076=_0xc2967b,_0x559f8a=getContext();if(!_0x559f8a){console[_0x48c076(0xaf)](_0x48c076(0x105));return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents(),bindTutorialEvents(),bindAutoSaveEvents();if(_0x5a3b7a[_0x48c076(0x68)])_0x5a3b7a[_0x48c076(0x68)]();else{console[_0x48c076(0xaf)](_0x48c076(0x140));return;}loadSettingsToUI(),loadWorldbookList(),log(_0x48c076(0xeb),'info');}function bindPanelToggleEvents(){const _0x46cc94=_0xc2967b,_0x2f2579=document[_0x46cc94(0xd2)](_0x46cc94(0x112));if(_0x2f2579){}}function bindTutorialEvents(){const _0x15a328=_0xc2967b,_0x29f7f2=document[_0x15a328(0xd2)](_0x15a328(0x8f));_0x29f7f2&&_0x29f7f2['addEventListener'](_0x15a328(0x126),()=>{const _0xb77b4c=_0x15a328;showContentModal(_0xb77b4c(0x166),_0xb77b4c(0x176));});}function bindInternalUIEvents(){const _0x165b2c=_0xc2967b,_0xfa6e04=document[_0x165b2c(0xda)](_0x165b2c(0xbe));_0xfa6e04[_0x165b2c(0x114)](_0x44fb99=>{const _0xce61a6=_0x165b2c;_0x44fb99[_0xce61a6(0x104)](_0xce61a6(0x126),()=>{const _0x2a7527=_0xce61a6,_0x461c42=_0x44fb99[_0x2a7527(0xa9)][_0x2a7527(0xc1)],_0x4e0171=_0x2a7527(0x169)+_0x461c42+_0x2a7527(0x12e);document[_0x2a7527(0xda)](_0x2a7527(0xe6))[_0x2a7527(0x114)](_0x157f22=>{const _0x3e6f0f=_0x2a7527;_0x157f22[_0x3e6f0f(0xf9)][_0x3e6f0f(0x143)](_0x3e6f0f(0xaa),_0x157f22['id']===_0x4e0171);}),_0xfa6e04['forEach'](_0xd29458=>_0xd29458[_0x2a7527(0xf9)][_0x2a7527(0x143)](_0x2a7527(0xaa),_0xd29458===_0x44fb99));});});const _0x4264ef=document[_0x165b2c(0xd2)](_0x165b2c(0xf1));_0x4264ef&&_0x4264ef[_0x165b2c(0x104)]('change',toggleCustomEndpointDocket);const _0x4acb53=document[_0x165b2c(0xda)]('input[name=\x22hly-injection-position\x22]');_0x4acb53[_0x165b2c(0x114)](_0x5ae5bc=>{const _0x344f87=_0x165b2c;_0x5ae5bc['addEventListener'](_0x344f87(0x14d),toggleInjectionDetails);});const _0x149b8f=document[_0x165b2c(0xd2)](_0x165b2c(0x184)),_0x1d4211=document[_0x165b2c(0xd2)](_0x165b2c(0x138));_0x149b8f&&_0x1d4211&&_0x149b8f[_0x165b2c(0x104)](_0x165b2c(0x14d),()=>{const _0x54d8ce=_0x165b2c;_0x1d4211[_0x54d8ce(0x10b)]['display']=_0x149b8f[_0x54d8ce(0x8a)]?_0x54d8ce(0x188):_0x54d8ce(0x8b);});const _0x7f8220=document[_0x165b2c(0xd2)]('hly-hist-select-library');_0x7f8220&&_0x7f8220[_0x165b2c(0x104)]('change',handleWorldbookSelectionChange);const _0x211f9c=document[_0x165b2c(0xd2)](_0x165b2c(0x8e));_0x211f9c&&_0x211f9c[_0x165b2c(0x104)](_0x165b2c(0x126),showExclusionRulesModal);}function toggleInjectionDetails(){const _0x4b2bbf=_0xc2967b,_0x47192c=document[_0x4b2bbf(0x71)](_0x4b2bbf(0xe1))[_0x4b2bbf(0xbb)],_0x54d0e7=document[_0x4b2bbf(0xd2)](_0x4b2bbf(0x11b)),_0x1eaa73=document[_0x4b2bbf(0xd2)]('hly-injection-role'),_0x42d6bc=_0x47192c==='1';_0x54d0e7[_0x4b2bbf(0x82)]=!_0x42d6bc,_0x1eaa73[_0x4b2bbf(0x82)]=!_0x42d6bc;}function toggleCustomEndpointDocket(){const _0x19f4c8=_0xc2967b,_0x4a3743=document['getElementById']('hly-api-endpoint')[_0x19f4c8(0xbb)],_0x308496=document[_0x19f4c8(0xd2)](_0x19f4c8(0x11c));_0x308496&&(_0x308496[_0x19f4c8(0x10b)][_0x19f4c8(0x80)]=_0x4a3743===_0x19f4c8(0xd3)||_0x4a3743==='azure'?_0x19f4c8(0x188):_0x19f4c8(0x8b));}function loadSettingsToUI(){const _0x460f87=_0xc2967b,_0x458749=_0x5a3b7a['getSettings']();if(!_0x458749)return;document['getElementById']('hly-retrieval-enabled')[_0x460f87(0x8a)]=_0x458749[_0x460f87(0x134)][_0x460f87(0xbc)],document[_0x460f87(0xd2)]('hly-api-endpoint')[_0x460f87(0xbb)]=_0x458749['retrieval'][_0x460f87(0x161)],document[_0x460f87(0xd2)]('hly-custom-api-url')[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x134)][_0x460f87(0xd9)],document[_0x460f87(0xd2)](_0x460f87(0xcf))[_0x460f87(0xbb)]=_0x458749['retrieval'][_0x460f87(0x13f)];const _0x331e04=document['getElementById'](_0x460f87(0x10d));if(_0x331e04['options'][_0x460f87(0xb7)]===0x0){const _0x5b5adf=_0x458749[_0x460f87(0x134)]['embeddingModel'],_0x4bcb36=new Option(_0x5b5adf,_0x5b5adf,!![],!![]);_0x331e04[_0x460f87(0xab)](_0x4bcb36);}_0x331e04['value']=_0x458749[_0x460f87(0x134)][_0x460f87(0x13a)],document['getElementById'](_0x460f87(0x15f))['checked']=_0x458749[_0x460f87(0x134)]['notify'],document[_0x460f87(0xd2)]('hly-chunk-size')[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x16d)][_0x460f87(0xf3)],document['getElementById'](_0x460f87(0xbf))[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x16d)][_0x460f87(0x17e)],document[_0x460f87(0xd2)]('hly-match-threshold')[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x16d)]['matchThreshold'],document[_0x460f87(0xd2)](_0x460f87(0x8c))[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x16d)]['queryMessageCount'],document[_0x460f87(0xd2)]('hly-max-results')['value']=_0x458749[_0x460f87(0x16d)][_0x460f87(0x115)],document[_0x460f87(0xd2)](_0x460f87(0xce))[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x134)][_0x460f87(0xe4)],document[_0x460f87(0xd2)](_0x460f87(0x124))[_0x460f87(0xbb)]=_0x458749['injection'][_0x460f87(0xc4)];const _0xb4a02d=document['querySelector'](_0x460f87(0xb3)+_0x458749[_0x460f87(0xa8)][_0x460f87(0x158)]+'\x22]');_0xb4a02d&&(_0xb4a02d[_0x460f87(0x8a)]=!![]);document[_0x460f87(0xd2)]('hly-injection-depth')[_0x460f87(0xbb)]=_0x458749[_0x460f87(0xa8)][_0x460f87(0xc8)],document[_0x460f87(0xd2)](_0x460f87(0xb8))[_0x460f87(0xbb)]=_0x458749[_0x460f87(0xa8)][_0x460f87(0x75)],toggleInjectionDetails(),document[_0x460f87(0xd2)]('hly-condensation-enabled')['checked']=_0x458749[_0x460f87(0xea)]['enabled'],document[_0x460f87(0xd2)](_0x460f87(0x148))[_0x460f87(0xbb)]=_0x458749[_0x460f87(0xea)][_0x460f87(0x7a)],document[_0x460f87(0xd2)](_0x460f87(0x180))[_0x460f87(0xbb)]=_0x458749[_0x460f87(0xea)][_0x460f87(0xff)],document[_0x460f87(0xd2)]('hly-include-user')['checked']=_0x458749[_0x460f87(0xea)][_0x460f87(0x9d)][_0x460f87(0xf6)],document[_0x460f87(0xd2)]('hly-include-ai')[_0x460f87(0x8a)]=_0x458749[_0x460f87(0xea)]['messageTypes']['ai'];const _0xa3117e=document['getElementById'](_0x460f87(0x184)),_0x19dc9d=document[_0x460f87(0xd2)](_0x460f87(0x64)),_0x2ae6ff=document['getElementById']('hly-tag-input-container');_0xa3117e[_0x460f87(0x8a)]=_0x458749[_0x460f87(0xea)][_0x460f87(0x9a)],_0x19dc9d[_0x460f87(0xbb)]=_0x458749['condensation'][_0x460f87(0xf7)],_0x2ae6ff[_0x460f87(0x10b)][_0x460f87(0x80)]=_0xa3117e[_0x460f87(0x8a)]?_0x460f87(0x188):_0x460f87(0x8b),document[_0x460f87(0xd2)]('hly-rerank-enabled')['checked']=_0x458749[_0x460f87(0x18b)][_0x460f87(0xbc)],document[_0x460f87(0xd2)]('hly-rerank-url')[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x18b)][_0x460f87(0x9f)],document[_0x460f87(0xd2)](_0x460f87(0x8d))['value']=_0x458749['rerank'][_0x460f87(0x13f)];const _0x4d4a91=document[_0x460f87(0xd2)](_0x460f87(0x15a));if(_0x4d4a91[_0x460f87(0xc2)]['length']===0x0){const _0x257151=_0x458749[_0x460f87(0x18b)][_0x460f87(0x74)];if(_0x257151){const _0xc475db=new Option(_0x257151,_0x257151,!![],!![]);_0x4d4a91[_0x460f87(0xab)](_0xc475db);}}_0x4d4a91[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x18b)][_0x460f87(0x74)],document[_0x460f87(0xd2)](_0x460f87(0xd0))[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x18b)][_0x460f87(0x192)],document[_0x460f87(0xd2)]('hly-rerank-hybrid-alpha')[_0x460f87(0xbb)]=_0x458749[_0x460f87(0x18b)]['hybrid_alpha'],document['getElementById']('hly-rerank-notify')[_0x460f87(0x8a)]=_0x458749[_0x460f87(0x18b)][_0x460f87(0xdd)],toggleCustomEndpointDocket();}function saveSettingsFromUI(_0x3b3424=!![]){const _0x4d0ca4=_0xc2967b,_0x1941ff=document[_0x4d0ca4(0xd2)](_0x4d0ca4(0x135));if(!_0x1941ff)return;const _0x28cfed=_0x1941ff[_0x4d0ca4(0xda)](_0x4d0ca4(0x7d));_0x28cfed[_0x4d0ca4(0x114)](_0x308d06=>{const _0x5ebc2b=_0x4d0ca4,_0x380b6c=_0x308d06['dataset']['settingKey'];if(!_0x380b6c)return;let _0x4d1160;const _0x4ec57b=_0x308d06[_0x5ebc2b(0xa9)][_0x5ebc2b(0x18d)]||_0x5ebc2b(0xad);if(_0x308d06['type']===_0x5ebc2b(0x123))_0x4d1160=_0x308d06[_0x5ebc2b(0x8a)];else{if(_0x308d06['type']===_0x5ebc2b(0x125)){if(!_0x308d06[_0x5ebc2b(0x8a)])return;_0x4d1160=_0x308d06[_0x5ebc2b(0xbb)];}else _0x4d1160=_0x308d06['value'];}switch(_0x4ec57b){case _0x5ebc2b(0x167):_0x4d1160=parseInt(_0x4d1160,0xa);break;case'float':_0x4d1160=parseFloat(_0x4d1160);break;case _0x5ebc2b(0x7e):if(typeof _0x4d1160!==_0x5ebc2b(0x7e))_0x4d1160=_0x4d1160===_0x5ebc2b(0x96);break;}const _0x4f00ed=_0x5a3b7a[_0x5ebc2b(0x162)](),_0xc58c83=_0x380b6c['split']('.');let _0x1a9aee=_0x4f00ed;for(let _0x446bc1=0x0;_0x446bc1<_0xc58c83[_0x5ebc2b(0xb7)]-0x1;_0x446bc1++){_0x1a9aee=_0x1a9aee[_0xc58c83[_0x446bc1]]=_0x1a9aee[_0xc58c83[_0x446bc1]]||{};}_0x1a9aee[_0xc58c83[_0xc58c83[_0x5ebc2b(0xb7)]-0x1]]=_0x4d1160;}),_0x5a3b7a[_0x4d0ca4(0x119)](),!_0x3b3424&&(log(_0x4d0ca4(0x142),_0x4d0ca4(0x7c)),toastr[_0x4d0ca4(0x7c)](_0x4d0ca4(0x163),_0x4d0ca4(0x12c)));}function resetSettingsToUI(){const _0x202a44=_0xc2967b;confirm('您确定要将所有设定恢复为出厂默认值吗?')&&(_0x5a3b7a['resetSettings'](),loadSettingsToUI(),toastr[_0x202a44(0xb4)](_0x202a44(0x12f),'诏曰'));}async function updatePanelStatus(){const _0x147fdc=_0xc2967b;document[_0x147fdc(0xd2)]('hly-current-character-name')['textContent']=_0x7f301b[_0x147fdc(0x111)](),document[_0x147fdc(0xd2)](_0x147fdc(0xb2))['textContent']=_0x7f301b[_0x147fdc(0xa0)]()||'无';const _0x4b9aa6=document[_0x147fdc(0xd2)](_0x147fdc(0x165));_0x4b9aa6[_0x147fdc(0x101)]=_0x147fdc(0x94);try{const _0x2ac11d=await _0x5a3b7a[_0x147fdc(0x189)]();_0x4b9aa6['textContent']=_0x2ac11d;}catch(_0x296602){console[_0x147fdc(0xaf)](_0x147fdc(0xe3),_0x296602),_0x4b9aa6[_0x147fdc(0x101)]='错误';}}async function testApi(){const _0x2afb05=_0xc2967b;toastr[_0x2afb05(0xb4)](_0x2afb05(0xed),'圣旨');try{await _0x5a3b7a[_0x2afb05(0x16f)](),toastr['success'](_0x2afb05(0xd7),'圣意');}catch(_0x3d41a5){toastr[_0x2afb05(0xaf)](_0x2afb05(0x103)+_0x3d41a5[_0x2afb05(0x171)],'警报');}}async function fetchHLYEmbeddingModels(){const _0x49e6af=_0xc2967b,_0x33454d=document[_0x49e6af(0xd2)](_0x49e6af(0x10d)),_0x4cdf0a=_0x33454d[_0x49e6af(0xbb)];_0x33454d[_0x49e6af(0x144)]=_0x49e6af(0x149),_0x33454d[_0x49e6af(0x82)]=!![];try{log('开始获取模型列表...',_0x49e6af(0xb4));const _0x2af248=await _0x5a3b7a[_0x49e6af(0xfd)]();_0x33454d[_0x49e6af(0x144)]='';if(_0x2af248['length']===0x0){_0x33454d['innerHTML']=_0x49e6af(0xd8),toastr[_0x49e6af(0x136)](_0x49e6af(0x185),'翰林院启奏'),log(_0x49e6af(0x185),_0x49e6af(0x136));return;}_0x2af248[_0x49e6af(0x114)](_0x45fa1a=>{const _0xe80c6f=_0x49e6af,_0xfa7744=new Option(_0x45fa1a,_0x45fa1a);_0x33454d[_0xe80c6f(0xab)](_0xfa7744);}),_0x2af248[_0x49e6af(0x10f)](_0x4cdf0a)?_0x33454d[_0x49e6af(0xbb)]=_0x4cdf0a:_0x33454d['selectedIndex']=0x0,toastr[_0x49e6af(0x7c)](_0x49e6af(0x12a)+_0x2af248[_0x49e6af(0xb7)]+_0x49e6af(0x6a),'圣意'),log(_0x49e6af(0x12a)+_0x2af248[_0x49e6af(0xb7)]+_0x49e6af(0x6a),_0x49e6af(0x7c));}catch(_0xe534d7){console['error'](_0x49e6af(0x178),_0xe534d7),toastr[_0x49e6af(0xaf)](_0x49e6af(0xd4)+_0xe534d7[_0x49e6af(0x171)],_0x49e6af(0x11a)),log(_0x49e6af(0xd4)+_0xe534d7[_0x49e6af(0x171)],_0x49e6af(0xaf)),_0x33454d[_0x49e6af(0x144)]=_0x49e6af(0xc7);}finally{_0x33454d[_0x49e6af(0x82)]=![];}}async function fetchHLYRerankModels(){const _0x2a2e75=_0xc2967b,_0x5d482b=document[_0x2a2e75(0xd2)]('hly-rerank-model'),_0x4e7cbe=_0x5d482b[_0x2a2e75(0xbb)];_0x5d482b[_0x2a2e75(0x144)]='<option>正在获取...</option>',_0x5d482b[_0x2a2e75(0x82)]=!![];try{log('开始获取Rerank模型列表...',_0x2a2e75(0xb4));const _0x51e72c=await _0x5a3b7a[_0x2a2e75(0x17a)]();_0x5d482b[_0x2a2e75(0x144)]='';if(_0x51e72c[_0x2a2e75(0xb7)]===0x0){_0x5d482b[_0x2a2e75(0x144)]=_0x2a2e75(0xd8),toastr[_0x2a2e75(0x136)](_0x2a2e75(0xa6),_0x2a2e75(0xf8)),log('未能获取到任何Rerank模型。','warn');return;}_0x51e72c[_0x2a2e75(0x114)](_0x5cb7e5=>{const _0x351302=_0x2a2e75,_0x728adb=new Option(_0x5cb7e5,_0x5cb7e5);_0x5d482b[_0x351302(0xab)](_0x728adb);}),_0x51e72c[_0x2a2e75(0x10f)](_0x4e7cbe)?_0x5d482b['value']=_0x4e7cbe:_0x5d482b['selectedIndex']=0x0,toastr['success']('成功获取\x20'+_0x51e72c[_0x2a2e75(0xb7)]+_0x2a2e75(0x179),'圣意'),log(_0x2a2e75(0x12a)+_0x51e72c[_0x2a2e75(0xb7)]+_0x2a2e75(0x179),'success');}catch(_0x45e320){console['error'](_0x2a2e75(0xe8),_0x45e320),toastr['error'](_0x2a2e75(0x18f)+_0x45e320[_0x2a2e75(0x171)],'严重错误'),log('获取Rerank模型失败:\x20'+_0x45e320['message'],_0x2a2e75(0xaf)),_0x5d482b['innerHTML']=_0x2a2e75(0xc7);}finally{_0x5d482b[_0x2a2e75(0x82)]=![];}}async function purgeStorage(){const _0x270fab=_0xc2967b;if(confirm(_0x270fab(0x131))){toastr[_0x270fab(0xb4)](_0x270fab(0xa3),'圣旨');const _0x18ad66=await _0x5a3b7a[_0x270fab(0x128)]();_0x18ad66?toastr[_0x270fab(0x7c)](_0x270fab(0x13e),'圣意'):toastr[_0x270fab(0xaf)](_0x270fab(0x151),'警报'),await updatePanelStatus();}}async function startCondensation(){const _0x5b3db6=_0xc2967b,_0x25a7d8=document[_0x5b3db6(0xd2)](_0x5b3db6(0x14e)),_0x445ccc=_0x25a7d8[_0x5b3db6(0xa9)][_0x5b3db6(0xb1)];try{if(_0x445ccc&&_0x445ccc[_0x5b3db6(0x93)]()){log(_0x5b3db6(0x99),_0x5b3db6(0xb4)),toastr[_0x5b3db6(0xb4)](_0x5b3db6(0xef),'圣旨'),_0x25a7d8[_0x5b3db6(0x101)]=_0x5b3db6(0xe2);const _0x1f665c=await _0x5a3b7a[_0x5b3db6(0x170)](_0x445ccc);if(_0x1f665c['success'])toastr['success'](_0x5b3db6(0x7b)+_0x1f665c[_0x5b3db6(0x18c)]+_0x5b3db6(0xbd),_0x5b3db6(0x97)),log('预览后文本录入成功,新增\x20'+_0x1f665c[_0x5b3db6(0x18c)]+_0x5b3db6(0xbd),'success'),_0x25a7d8[_0x5b3db6(0x101)]=_0x5b3db6(0x73)+_0x1f665c['count']+_0x5b3db6(0xbd),delete _0x25a7d8['dataset'][_0x5b3db6(0xb1)];else throw new Error(_0x1f665c[_0x5b3db6(0xaf)]||_0x5b3db6(0xfb));}else{_0x25a7d8[_0x5b3db6(0x101)]=_0x5b3db6(0xa5),toastr[_0x5b3db6(0xb4)]('正在准备凝识...','圣旨'),log('未检测到预览文本,按标准流程采集消息...','info');const _0x1f5d56=_0x5a3b7a[_0x5b3db6(0x116)]();if(!_0x1f5d56||_0x1f5d56[_0x5b3db6(0xb7)]===0x0){toastr[_0x5b3db6(0x16a)](_0x5b3db6(0xc5),_0x5b3db6(0xf8)),_0x25a7d8[_0x5b3db6(0x101)]=_0x5b3db6(0x6f);return;}_0x25a7d8[_0x5b3db6(0x101)]=_0x5b3db6(0x130)+_0x1f5d56[_0x5b3db6(0xb7)]+_0x5b3db6(0x10c),toastr[_0x5b3db6(0xb4)](_0x5b3db6(0x130)+_0x1f5d56['length']+_0x5b3db6(0x10c),'翰林院启奏');const _0x4d6e00=await _0x5a3b7a[_0x5b3db6(0x183)](_0x1f5d56);if(_0x4d6e00[_0x5b3db6(0x7c)])toastr[_0x5b3db6(0x7c)](_0x5b3db6(0x73)+_0x4d6e00['count']+'\x20条忆识。',_0x5b3db6(0x97)),_0x25a7d8[_0x5b3db6(0x101)]=_0x5b3db6(0x73)+_0x4d6e00[_0x5b3db6(0x18c)]+_0x5b3db6(0xbd);else throw new Error(_0x4d6e00['error']||'未知错误');}}catch(_0x879534){console[_0x5b3db6(0xaf)]('[翰林院-枢纽]\x20凝识过程发生错误:',_0x879534),toastr['error']('凝识失败:\x20'+_0x879534['message'],'严重错误'),_0x25a7d8[_0x5b3db6(0x101)]=_0x5b3db6(0x85)+_0x879534[_0x5b3db6(0x171)];}finally{await updatePanelStatus();}}async function loadWorldbookList(){const _0x1e2183=_0xc2967b,_0x47a9aa=document[_0x1e2183(0xd2)]('hly-hist-select-library');if(!_0x47a9aa)return;try{log(_0x1e2183(0xc6),_0x1e2183(0xb4));const _0x1c8a48=await _0x4c2e19[_0x1e2183(0x7f)]();_0x47a9aa[_0x1e2183(0x144)]='<option\x20value=\x22\x22>请选择一个书库...</option>';if(_0x1c8a48[_0x1e2183(0xb7)]===0x0){_0x47a9aa['innerHTML']=_0x1e2183(0x100);return;}_0x1c8a48['forEach'](_0x43bae1=>{const _0x1d7758=_0x1e2183,_0x20167d=new Option(_0x43bae1,_0x43bae1);_0x47a9aa[_0x1d7758(0xab)](_0x20167d);}),log('成功加载\x20'+_0x1c8a48['length']+_0x1e2183(0x15c),_0x1e2183(0x7c));}catch(_0x5b50e0){console[_0x1e2183(0xaf)](_0x1e2183(0x14f),_0x5b50e0),log(_0x1e2183(0xc3)+_0x5b50e0['message'],_0x1e2183(0xaf)),_0x47a9aa[_0x1e2183(0x144)]='<option\x20value=\x22\x22>加载失败</option>';}}async function handleWorldbookSelectionChange(){const _0x2729a3=_0xc2967b,_0x180224=document[_0x2729a3(0xd2)]('hly-hist-select-library'),_0x8e1c32=document[_0x2729a3(0xd2)](_0x2729a3(0x84)),_0x392c47=_0x180224[_0x2729a3(0xbb)];_0x8e1c32[_0x2729a3(0x144)]=_0x2729a3(0x168),_0x8e1c32[_0x2729a3(0x82)]=!![];if(!_0x392c47){_0x8e1c32[_0x2729a3(0x144)]='<option\x20value=\x22\x22>请先选择书库</option>';return;}try{log(_0x2729a3(0x177)+_0x392c47+_0x2729a3(0xfe),_0x2729a3(0xb4));const _0x5a1752=await _0x4c2e19['getLoresForWorldbook'](_0x392c47);_0x8e1c32[_0x2729a3(0x144)]=_0x2729a3(0x15e);if(_0x5a1752[_0x2729a3(0xb7)]===0x0){_0x8e1c32[_0x2729a3(0x144)]=_0x2729a3(0x10e);return;}_0x5a1752['forEach'](_0x1a0d74=>{const _0xbe3d71=_0x2729a3,_0x1b20f0=new Option(_0x1a0d74[_0xbe3d71(0xd5)]+_0xbe3d71(0x10a)+_0x1a0d74[_0xbe3d71(0x186)]+')',_0x1a0d74[_0xbe3d71(0x186)]);_0x8e1c32[_0xbe3d71(0xab)](_0x1b20f0);}),log(_0x2729a3(0xac)+_0x5a1752['length']+'\x20个条目。',_0x2729a3(0x7c));}catch(_0xa67207){console['error'](_0x2729a3(0xca)+_0x392c47+'》的条目失败:',_0xa67207),log(_0x2729a3(0x156)+_0xa67207[_0x2729a3(0x171)],_0x2729a3(0xaf)),_0x8e1c32[_0x2729a3(0x144)]=_0x2729a3(0x120);}finally{_0x8e1c32[_0x2729a3(0x82)]=![];}}async function startHistoriography(){const _0x40e64f=_0xc2967b,_0x985dee=document[_0x40e64f(0xd2)](_0x40e64f(0xdf))[_0x40e64f(0xbb)],_0x31de4d=document[_0x40e64f(0xd2)]('hly-hist-select-entry')[_0x40e64f(0xbb)],_0x35072d=document[_0x40e64f(0xd2)](_0x40e64f(0xf5));if(!_0x985dee||!_0x31de4d){toastr[_0x40e64f(0x16a)](_0x40e64f(0x106),_0x40e64f(0x175));return;}_0x35072d[_0x40e64f(0x101)]=_0x40e64f(0x17b)+_0x985dee+'》中的条目\x20(Key:\x20'+_0x31de4d+_0x40e64f(0x139),toastr[_0x40e64f(0xb4)](_0x40e64f(0xa4),'圣旨'),log(_0x40e64f(0xb9)+_0x985dee+'》-'+_0x31de4d+_0x40e64f(0xde),'info');try{const _0x110731=await _0x4c2e19[_0x40e64f(0xcb)](_0x985dee,_0x31de4d);if(_0x110731[_0x40e64f(0x7c)]){const _0x343761='对《'+_0x985dee+'》中条目\x20(Key:\x20'+_0x31de4d+_0x40e64f(0xf2);_0x35072d['textContent']=_0x110731['content'],toastr['success'](_0x40e64f(0x11d),_0x40e64f(0x97)),log(_0x343761,_0x40e64f(0x7c));}else throw new Error(_0x110731['error']||'未知的编纂错误');}catch(_0x4d8f19){console[_0x40e64f(0xaf)](_0x40e64f(0x174),_0x4d8f19),toastr['error'](_0x40e64f(0x9e)+_0x4d8f19[_0x40e64f(0x171)],_0x40e64f(0x11a)),_0x35072d[_0x40e64f(0x101)]=_0x40e64f(0x9e)+_0x4d8f19[_0x40e64f(0x171)];}}async function showStats(){const _0x4570fa=_0xc2967b;try{log('用户请求查看宝库状态。','info'),toastr[_0x4570fa(0xb4)]('正在查询宝库状态...','圣旨');const _0x5746ff=await _0x5a3b7a[_0x4570fa(0x189)](),_0x573c1d=_0x5a3b7a['getCollectionId'](),_0x67c21a=_0x5a3b7a[_0x4570fa(0x162)](),_0x107bee='\x0a<pre>\x0a翰林院宝库状态\x0a--------------------\x0a集合ID:\x20'+_0x573c1d+_0x4570fa(0x87)+_0x5746ff+_0x4570fa(0x133)+_0x67c21a[_0x4570fa(0x134)][_0x4570fa(0x161)]+_0x4570fa(0x15d)+_0x67c21a['retrieval'][_0x4570fa(0x13a)]+_0x4570fa(0xcc);toastr[_0x4570fa(0xb4)](_0x107bee,'宝库状态',{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log(_0x4570fa(0x191)+_0x573c1d+',\x20忆识总数='+_0x5746ff,_0x4570fa(0x7c));}catch(_0x354147){console[_0x4570fa(0xaf)](_0x4570fa(0x81),_0x354147),toastr[_0x4570fa(0xaf)](_0x4570fa(0x107)+_0x354147[_0x4570fa(0x171)],_0x4570fa(0x11a)),log(_0x4570fa(0x107)+_0x354147[_0x4570fa(0x171)],'error');}}function showExclusionRulesModal(){const _0x49680e=_0xc2967b,_0x5b711a=_0x5a3b7a['getSettings'](),_0x1dec70=_0x5b711a[_0x49680e(0xea)][_0x49680e(0xae)]||[],_0x426364=(_0xcfb471={'start':'','end':''},_0x36319b)=>_0x49680e(0xd1)+_0x36319b+_0x49680e(0x6e)+_0xcfb471[_0x49680e(0x129)]+_0x49680e(0xee)+_0xcfb471['end']+_0x49680e(0x146),_0x872081=_0x1dec70['map'](_0x426364)['join'](''),_0x44de9b=_0x49680e(0xa2)+_0x872081+'</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('编辑内容排除规则',_0x44de9b,{'okText':'保存规则','onOk':_0x1aab2f=>{const _0x5a6db6=_0x49680e,_0x183021=[];_0x1aab2f['find']('.hly-exclusion-rule-row')[_0x5a6db6(0x154)](function(){const _0x1968f6=_0x5a6db6,_0x2158e5=$(this)[_0x1968f6(0x153)](_0x1968f6(0xb5))['eq'](0x0)[_0x1968f6(0xf4)]()[_0x1968f6(0x93)](),_0x22ab7e=$(this)[_0x1968f6(0x153)](_0x1968f6(0xb5))['eq'](0x1)['val']()[_0x1968f6(0x93)]();_0x2158e5&&_0x22ab7e&&_0x183021['push']({'start':_0x2158e5,'end':_0x22ab7e});}),updateAndSaveSetting('condensation.exclusionRules',_0x183021),toastr[_0x5a6db6(0x7c)](_0x5a6db6(0x6b),_0x5a6db6(0x12c));}});const _0x4d882a=document['getElementById']('hly-exclusion-rules-container'),_0x446d47=_0x4d882a[_0x49680e(0x71)]('#hly-rules-list');_0x4d882a[_0x49680e(0x71)](_0x49680e(0x127))[_0x49680e(0x104)](_0x49680e(0x126),()=>{const _0x34451c=_0x49680e,_0x2a7d2a=_0x446d47['children'][_0x34451c(0xb7)],_0x37db7b=_0x426364({'start':'','end':''},_0x2a7d2a);_0x446d47['insertAdjacentHTML'](_0x34451c(0xc9),_0x37db7b);}),_0x446d47[_0x49680e(0x104)](_0x49680e(0x126),_0x52ae81=>{const _0x34fd90=_0x49680e;_0x52ae81[_0x34fd90(0xfc)][_0x34fd90(0xf9)][_0x34fd90(0x17c)](_0x34fd90(0xe9))&&_0x52ae81[_0x34fd90(0xfc)][_0x34fd90(0x92)]('.hly-exclusion-rule-row')[_0x34fd90(0xd6)]();});}function previewCondensation(){const _0x114a8a=_0xc2967b,_0x1015c6=document[_0x114a8a(0xd2)](_0x114a8a(0x14e));try{const _0x250537=_0x5a3b7a[_0x114a8a(0x162)](),_0x34ee34=_0x250537[_0x114a8a(0xea)][_0x114a8a(0xae)]||[],_0x1366b5={'user':document['getElementById'](_0x114a8a(0xfa))[_0x114a8a(0x8a)],'ai':document['getElementById'](_0x114a8a(0x187))['checked']},_0x277af6=document[_0x114a8a(0xd2)]('hly-tag-extraction-toggle')[_0x114a8a(0x8a)],_0x3174aa=_0x277af6?document[_0x114a8a(0xd2)]('hly-tag-input')[_0x114a8a(0xbb)][_0x114a8a(0x78)](',')[_0x114a8a(0x122)](_0x4d1caa=>_0x4d1caa[_0x114a8a(0x93)]())[_0x114a8a(0x95)](Boolean):[],_0x293d78=_0x5a3b7a[_0x114a8a(0x116)](_0x1366b5);if(!_0x293d78||_0x293d78[_0x114a8a(0xb7)]===0x0){_0x1015c6[_0x114a8a(0x101)]=_0x114a8a(0xcd),toastr['warning'](_0x114a8a(0x6f),'翰林院启奏');return;}const _0x320d1b=_0x293d78['map']((_0x3514de,_0x1fe9b9)=>{const _0x1fa77f=_0x114a8a;let _0x7cb621;if(_0x277af6&&_0x3174aa[_0x1fa77f(0xb7)]>0x0){const _0x3441b6=extractBlocksByTags(_0x3514de[_0x1fa77f(0x66)],_0x3174aa);_0x7cb621=_0x3441b6['join']('\x0a\x0a');}else _0x7cb621=_0x3514de[_0x1fa77f(0x66)];return _0x7cb621=applyExclusionRules(_0x7cb621,_0x34ee34),{'id':_0x1fa77f(0x77)+_0x1fe9b9,'name':_0x3514de[_0x1fa77f(0x152)],'content':_0x7cb621[_0x1fa77f(0x93)]()};})['filter'](_0x583465=>_0x583465[_0x114a8a(0x12d)]);if(_0x320d1b[_0x114a8a(0xb7)]===0x0){_0x1015c6['textContent']=_0x114a8a(0x117),toastr[_0x114a8a(0x16a)](_0x114a8a(0x117),'翰林院启奏');return;}const _0x24b59e=_0x320d1b[_0x114a8a(0x122)]((_0x58a049,_0xab622a)=>_0x114a8a(0x182)+_0x58a049['id']+_0x114a8a(0x141)+(_0xab622a+0x1)+_0x114a8a(0xba)+_0x58a049[_0x114a8a(0x152)]+_0x114a8a(0x65)+_0x58a049[_0x114a8a(0x12d)]+_0x114a8a(0x145)+_0x58a049['id']+_0x114a8a(0x86))[_0x114a8a(0xb6)]('');showHtmlModal(_0x114a8a(0x13c),_0x114a8a(0xa1)+_0x24b59e+'</div>',{'okText':_0x114a8a(0x9c),'onOk':_0x5313be=>{const _0x526627=_0x114a8a,_0x4b1827=[];_0x5313be['find']('.hly-preview-item-v2')[_0x526627(0x154)](function(){const _0x4dfb8c=_0x526627,_0x673909=$(this)[_0x4dfb8c(0x153)](_0x4dfb8c(0xa7))[_0x4dfb8c(0xf4)]();_0x673909[_0x4dfb8c(0x93)]()&&_0x4b1827[_0x4dfb8c(0x173)](_0x673909);});const _0x31e5e3=_0x4b1827['join']('\x0a\x0a---\x0a\x0a');_0x1015c6[_0x526627(0x101)]=_0x526627(0x76)+_0x4b1827[_0x526627(0xb7)]+_0x526627(0x118)+_0x31e5e3,_0x1015c6[_0x526627(0xa9)]['finalText']=_0x31e5e3,toastr['success'](_0x526627(0xdb),_0x526627(0x12c));}}),$(_0x114a8a(0x172))['on']('click',function(_0x6b14a8){const _0x100018=_0x114a8a;_0x6b14a8['preventDefault']();const _0x4ae9e7=$(this)[_0x100018(0x16e)](_0x100018(0xfc));$('#'+_0x4ae9e7)[_0x100018(0xd6)]();});}catch(_0x32dbd0){console[_0x114a8a(0xaf)](_0x114a8a(0x110),_0x32dbd0),_0x1015c6['textContent']=_0x114a8a(0x18e)+_0x32dbd0[_0x114a8a(0x171)],toastr[_0x114a8a(0xaf)]('预览失败:\x20'+_0x32dbd0[_0x114a8a(0x171)],_0x114a8a(0x11a));}}function log(_0x92501f,_0x1d61ac=_0xc2967b(0xb4)){const _0x164157=_0xc2967b,_0x1fbbe0=document['getElementById'](_0x164157(0x89));if(!_0x1fbbe0)return;const _0x54487c=document['createElement']('p'),_0x2e86ab=new Date()[_0x164157(0x121)]();let _0x266f97=_0x164157(0x109),_0x2927e5=_0x164157(0x17d);switch(_0x1d61ac){case _0x164157(0x7c):_0x266f97=_0x164157(0x72),_0x2927e5=_0x164157(0x147);break;case _0x164157(0xaf):_0x266f97=_0x164157(0x70),_0x2927e5=_0x164157(0x13d);break;case _0x164157(0x136):_0x266f97=_0x164157(0xc0),_0x2927e5=_0x164157(0x90);break;}_0x54487c[_0x164157(0x18a)]=_0x164157(0xb0)+_0x2927e5,_0x54487c[_0x164157(0x144)]='<i\x20class=\x22fa-solid\x20'+_0x266f97+_0x164157(0x108)+_0x2e86ab+']\x20'+_0x92501f;const _0x146836=_0x1fbbe0[_0x164157(0x71)](_0x164157(0x6c));_0x146836&&_0x146836[_0x164157(0xd6)](),_0x1fbbe0[_0x164157(0x15b)](_0x54487c),_0x1fbbe0[_0x164157(0x102)]=_0x1fbbe0[_0x164157(0x14a)];}function _0x129f(_0x1c22d2,_0x5c8d06){const _0x17e65a=_0x17e6();return _0x129f=function(_0x129f4f,_0x37bb14){_0x129f4f=_0x129f4f-0x64;let _0x171c45=_0x17e65a[_0x129f4f];return _0x171c45;},_0x129f(_0x1c22d2,_0x5c8d06);}async function ingestManualText(){const _0x12cce5=_0xc2967b,_0x85da=document[_0x12cce5(0xd2)](_0x12cce5(0x79)),_0x1e93a9=_0x85da['value']['trim']();if(!_0x1e93a9){toastr['warning']('录入内容不能为空。',_0x12cce5(0xf8)),log(_0x12cce5(0x67),'warn');return;}log(_0x12cce5(0x190)+_0x1e93a9[_0x12cce5(0xb7)],_0x12cce5(0xb4)),toastr[_0x12cce5(0xb4)](_0x12cce5(0x16c),'圣旨');try{const _0xf7f25d=await _0x5a3b7a[_0x12cce5(0x170)](_0x1e93a9,_0x12cce5(0x91));if(_0xf7f25d[_0x12cce5(0x7c)])toastr[_0x12cce5(0x7c)](_0x12cce5(0x7b)+_0xf7f25d['count']+_0x12cce5(0xbd),_0x12cce5(0x97)),log('手动录入成功,新增\x20'+_0xf7f25d[_0x12cce5(0x18c)]+_0x12cce5(0xbd),_0x12cce5(0x7c)),_0x85da['value']='';else throw new Error(_0xf7f25d[_0x12cce5(0xaf)]||_0x12cce5(0xfb));}catch(_0x167331){console[_0x12cce5(0xaf)](_0x12cce5(0x113),_0x167331),toastr[_0x12cce5(0xaf)](_0x12cce5(0x16b)+_0x167331[_0x12cce5(0x171)],_0x12cce5(0x11a)),log(_0x12cce5(0x13b)+_0x167331[_0x12cce5(0x171)],_0x12cce5(0xaf));}finally{await updatePanelStatus();}}