Files
ST-Amily2-Chat-Optimisation…/ui/hanlinyuan-bindings.js
2025-11-04 23:39:48 +08:00

2 lines
76 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 _0x28d2da=_0x219d;function _0x219d(_0xa49005,_0x12ee67){const _0x1a1560=_0x1a15();return _0x219d=function(_0x219db0,_0x20a982){_0x219db0=_0x219db0-0x1f3;let _0x52a346=_0x1a1560[_0x219db0];return _0x52a346;},_0x219d(_0xa49005,_0x12ee67);}(function(_0xc807d3,_0x2667b8){const _0x4a8bb6=_0x219d,_0x181744=_0xc807d3();while(!![]){try{const _0x5dec87=parseInt(_0x4a8bb6(0x31a))/0x1*(-parseInt(_0x4a8bb6(0x200))/0x2)+parseInt(_0x4a8bb6(0x35a))/0x3+parseInt(_0x4a8bb6(0x3ba))/0x4*(-parseInt(_0x4a8bb6(0x318))/0x5)+parseInt(_0x4a8bb6(0x2d9))/0x6+-parseInt(_0x4a8bb6(0x291))/0x7+parseInt(_0x4a8bb6(0x23a))/0x8+parseInt(_0x4a8bb6(0x3ab))/0x9;if(_0x5dec87===_0x2667b8)break;else _0x181744['push'](_0x181744['shift']());}catch(_0x3cd810){_0x181744['push'](_0x181744['shift']());}}}(_0x1a15,0x789fc));import{getContext}from'/scripts/extensions.js';import*as _0x5a0ed1 from'../core/rag-processor.js';import*as _0x798f38 from'../core/historiographer.js';import*as _0x4966d0 from'../core/utils/context-utils.js';import*as _0x54c7cd from'../core/ingestion-manager.js';import{showContentModal,showHtmlModal}from'./page-window.js';function _0x1a15(){const _0x1e2eb6=['未找到符合条件的消息。','.hly-nav-item','options','processCondensation','{{chat_text}}','target','】吗?','string','stringify','fetchEmbeddingModels','[翰林院-枢纽]\x20未能获取SillyTavern上下文绑定失败。','\x20个知识库\x20(范围:\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-kb-name-container\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22checkbox\x22\x20class=\x22hly-kb-item-checkbox\x22\x20data-kb-id=\x22','当前所有操作都将指向这个锁定的宝库:',',\x20向量:\x20','data','神力连接失败:\x20','length','saveSettings','count','[实时刷新]\x20批次完成忆识总数已更新。','\x22></i>\x20[','selectedIndex','正在查询宝库状态...','<option\x20value=\x22\x22>加载失败</option>','】移动到【','hly-tag-input','entries','hly-kb-list-local','未能获取到任何模型。','advanced','\x20块继续录入。','hly-retrieval-notify','<button\x20class=\x22hly-kb-move-btn\x22\x20title=\x22上移到全局\x22><i\x20class=\x22fas\x20fa-arrow-up\x22></i></button>','scrollTop','hly-api-endpoint','generateJobId','scrollHeight','hly-kb-delete-btn','loadProgress','preventDefault','用户尝试录入空文本。','1586568LlkrfG','embeddingModel','trim','hly-current-character-name','未能获取到任何Rerank模型。','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-preview-item-v2\x22\x20id=\x22','\x20块开始。','正在获取可用书库列表...','.hly-kb-item-checkbox','scripts/extensions/third-party/ST-Amily2-Chat-Optimisation/HanLin.md','local_proxy','。进度已保存,可稍后重试。','appendChild','<option>获取失败</option>','知识库\x20','dataset','[翰林院-枢纽]\x20编纂过程发生严重错误:','hly-kb-list-item','hly-custom-endpoint-docket','>\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','解锁会话','任务已中止。','#hly-add-rule-btn','[自动保存]\x20设置项\x20\x27','finalMessages','messageTypes','hly-kb-move-all-to-global','hly-hist-entry-multiselect-options','<div\x20class=\x22hly-no-results\x22>未找到匹配的条目</div>','开始对《','请先选择一个书库并至少选择一个要编纂的条目。','children','filter',')\x22>\x0a\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','\x20个条目','文书已成功录入宝库,新增\x20','chat','\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-exclusion-rule-row\x22\x20data-index=\x22','retrieval',',\x20忆识总数=','hly-kb-bulk-actions-global','hly-include-user','hly-api-key-group','\x20个知识块。','翰林院使用教程','total','.hly-kb-move-btn','hly-kb-bulk-actions-','正在处理您确认后的文书...','novel','</textarea>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</fieldset>\x0a\x20\x20\x20\x20','录入内容不能为空。','top_n','请至少选择一个知识库进行操作。','info','hly-kb-delete-local-btn','hly-injection-source-selector','\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','[翰林院-枢纽]\x20核心法典未能提供初始化圣旨','manual','<i\x20class=\x22fa-solid\x20','model','[翰林院-枢纽]\x20获取Rerank模型列表失败:','hly-condensation-enabled','手动录入成功,新增\x20','\x20的状态已切换','\x0a</pre>\x0a\x20\x20\x20\x20\x20\x20\x20\x20','all','\x20个局部知识库均已成功删除。','click','[翰林院-枢纽]\x20加载书库列表失败:','hly-overlap-size','hly-rerank-api-key','removeEventListener','批量编纂任务已完成,但有部分错误。','.hly-hist-entry-checkbox','圣谕不明','hly-unified-template-notes','display','checked','[断点续传]\x20用户选择放弃旧任务\x20','9229779fwRJyc','tags','知识库【','html','toFixed','kbId','push','content','text','processed','此书库为空','...','清空宝库失败。','\x22\x20placeholder=\x22开始字符串,\x20如\x20<!--\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20style=\x22margin:\x200\x205px;\x22>到</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','depth_role','21236jtvhJd','true','通行令牌\x20(API\x20Key):','\x20个Rerank模型。','indeterminate','\x20个知识库吗此操作无法恢复','正在对\x20','》中的\x20','hly-hist-select-library',',从第\x20','开始对\x20','localToGlobal','active','input[name=\x22hly-unified-injection-position\x22]:checked','正在加载条目...','keys','\x20个知识库的启用状态吗','<button\x20class=\x22hly-kb-move-btn\x22\x20title=\x22下移到局部\x22><i\x20class=\x22fas\x20fa-arrow-down\x22></i></button>','.position','hly-unified-template-editor','用户请求查看宝库状态。','处理中:\x20','hly-rerank-url','未选择文件','tagExtractionEnabled','\x20操作成功。','\x20个条目进行编纂...','split','.hly-tab-pane','点击以解锁,让翰林院跟随当前角色','preview-item-','send_date','<option>未找到模型</option>','本地代理地址:','hly-priority-retrieval-enabled','forEach','hly-batch-size','</i></p>','\x20个知识库移动到【','textContent','会话已锁定到宝库:\x20','sources','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<fieldset\x20class=\x22hly-settings-group\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<legend><i\x20class=\x22fas\x20fa-ban\x22></i>\x20内容排除规则</legend>\x0a\x20\x20\x20\x20\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\x20\x20\x20\x20<div\x20id=\x22hly-rules-list\x22>','您确定要将所有设定恢复为出厂默认值吗?','purgeHLYStorage','您确定要将知识库【','comment','<option\x20value=\x22\x22>未找到匹配的书库</option>','\x20个局部知识库...','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22hly-multiselect-option\x22\x20title=\x22','{{novel_text}}','log-warn','enabled','.hly-hist-entry-checkbox:checked','批量操作失败:\x20','hly-retrieval-enabled','mes','\x20个知识库的状态。','加载失败','\x20条忆识。',',重新开始。','编辑凝识内容排除规则','根据当前勾选条件,未找到符合的消息可供预览。','custom','layerStart','from','[翰林院-枢纽]\x20加载《','[data-setting-key]','\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22hly-rules-modal-container\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','成功获取\x20','hly-session-lock-btn','findIndex','toggleSessionLock','layerEnd','hly-kb-toggle','.hly-kb-item-checkbox:checked','notify','css','fas\x20fa-lock','hly-','warning','hly-kb-list-','\x20个条目进行批量编纂...','[翰林院-枢纽]\x20获取模型列表失败:','append','AbortError','_searchHandler','切换知识库\x20','start','fas\x20fa-lock-open','预览失败:\x20','message','成功移动了\x20','ingestTextToHanlinyuan','源区域(','beforeend','add','圣旨已下','严重错误','#hly-modal-tag-extraction-enabled','[翰林院-枢纽]\x20更新忆识数量失败:','hly-layer-end','change','getCharacterName','当前角色没有任何局部知识库可供删除。','例如\x20http://127.0.0.1:8000/v1','1113628jDNDXZ','大功告成','toLocaleTimeString','key','map','getMessagesForCondensation','apiKey','遵命,将从第\x20','getAvailableWorldbooks','移动失败:\x20','会话已锁定到:\x20','请输入知识库的新名称:','所有\x20','批量\x20','option','\x0a\x20\x20\x20\x20\x20\x20\x20\x20<fieldset\x20class=\x22hly-settings-group\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<legend><i\x20class=\x22fas\x20fa-tags\x22></i>\x20标签提取</legend>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22hly-control-block\x22\x20style=\x22flex-direction:\x20row;\x20justify-content:\x20space-between;\x20align-items:\x20center;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22hly-modal-tag-extraction-enabled\x22>启用标签提取</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22hly-toggle-switch\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\x20id=\x22hly-modal-tag-extraction-enabled\x22\x20','google_direct','hybrid_alpha','保存规则',')\x20执行批量\x20','getElementById','settingKey','录入失败:\x20','createElement','凝识完成!新增\x20','totalChunks','remove','is-user','-tab',')\x20已被删除','integer','\x22\x20的配置项。','正在测试神力连接...','hly-include-ai','hly-locked-status','#hly-modal-tag-input','success','\x20个书库。','[data-setting-key=\x22rerank.priorityRetrieval.sources.','\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','files','请输入您的Google\x20API\x20Key','getSettings','style','预览内容已更新,可随时开始凝识。','翰林院设定已存档封印。','fetchHLYRerankModels','\x0a忆识总数:\x20','use\x20strict','insertAdjacentHTML','任务已由用户中止。进度已保存,可随时继续。','</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>','previewHLYCondensation','input','{{lorebook_text}}','\x20楼:\x20[','预览并编辑凝识内容','您确定要将选中的\x20','2898488kmGHZn','condensationHistory','<option>正在获取...</option>','warn','send-date','.hly-kb-rename-btn','saveHLYSettings','hly-entry-search','】已删除。','hly-chunk-size','删除局部知识库\x20','fa-times-circle','exclusionRules','getLocalKnowledgeBases','hanlinyuan-ingest-progress-bar','删除失败:\x20','获取模型失败:\x20','翰林院设定已重置为初始状态。','当前角色','allWorldbooks','未知错误','\x20个知识块','》的批量编纂任务已完成。成功:\x20','every','includes','\x20楼已成功凝识新增\x20','processedChunks','%。是否从上次中断之处继续?','.depth','stopPropagation','\x20楼到第\x20','ingestHLYManualText','chat_history','apiEndpoint','finalText','\x0a--------------------\x0aAPI端点:\x20','value','move','\x20个知识库从\x20','hly-embedding-model','.count\x22]','hanlinyuan-ingest-novel-file-name','hly-historiography-results','closest','N/A','globalToLocal','获取Rerank模型失败:\x20','hly-independent-chat-memory-enabled','find','加载书库列表失败:\x20','hly-rerank-notify','user','fa-check-circle','</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','您确定要将\x20','\x20个知识库删除失败。','div','totalVectors','isSessionLocked','\x20个知识库均已成功移动。','getChatId','hly-current-chat-id','\x20/\x20','\x20个条目。','查询宝库状态失败:\x20','hanlinyuan-ingest-abort','【手动存档】所有设定已存档封印。','title','已选择\x20','hly-unified-injection-role','hly-query-preprocessing-enabled','getGlobalKnowledgeBases','error','startHLYHistoriography','\x20个模型。','querySelectorAll','hly-hist-entry-multiselect-btn','label','<p\x20class=\x22hly-notes\x20log-error\x22><i>加载失败:\x20','开始将\x20','rerank','floor','<p\x20class=\x22hly-notes\x22\x20style=\x22text-align:center;\x22>暂无规则</p>','遵命,将从头开始录入此书。','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\x22hly-kb-rename-btn\x22\x20title=\x22重命名\x22><i\x20class=\x22fas\x20fa-pen-to-square\x22></i></button>\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','testHLYApi','编纂失败:\x20','4825758IxOHwT','》获取条目列表...','join','翰林院启奏','tab','amily2_open_rag_palace','log-error','disabled','hly-modal-container','addEventListener','toggle','批量编纂任务已完成。','[翰林院-枢纽]\x20手动录入过程发生错误:','请先选择一个\x20.txt\x20文件','\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20type=\x22text\x22\x20class=\x22hly-imperial-brush\x22\x20value=\x22','Google\x20API\x20Key:','lorebook','hanlinyuan-ingest-progress-container','startHLYCondensation','hanlinyuan-ingest-status','手动录入失败:\x20','hly-log-output','is_user','\x20(ID:\x20','maxResults','{{manual_text}}','正在准备凝识...','批量移动过程中发生错误:\x20','hly-layer-start','输入兼容OpenAI的embeddings端点','聊天记录从第\x20','\x20楼。</i></p>','input[name=\x22hly-unified-injection-position\x22]','superSortEnabled','[翰林院-枢纽]\x20查询宝库状态失败:','className','template','正在清空宝库...','>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22slider\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</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22hly-modal-tag-input-container\x22\x20class=\x22hly-control-block\x22\x20style=\x22display:\x20','您确定要切换选中的\x20','\x20失败:\x20','成功录入\x20','queryPreprocessing','规则已保存。','.hly-kb-list-item','条)</span>\x0a\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<div\x20class=\x22hly-kb-actions\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x20个局部知识库吗此操作无法恢复','initialize','手动录入','hly-local-kb-char-name','hly-hist-select-all-entries','classList','错误:\x20','injection_','[翰林院-枢纽]\x20渲染知识库列表失败:','</div>\x0a\x20\x20\x20\x20\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\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\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</fieldset>\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;\x20flex-shrink:\x200;\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20</style>\x0a\x20\x20\x20\x20','正在为《','会话已解锁,将跟随当前角色。','根据标签提取或内容排除条件,未找到任何有效内容。','\x20楼的内容共\x20','span','hly-condensation-results','操作完成,但有\x20','\x20个知识库从【','.hly-kb-name','hly-kb-bulk-actions-local','getCollectionId','getLockedSessionInfo','[翰林院-枢纽]\x20凝识过程发生错误:','.hly-log-placeholder','请先选择书库','hly-rerank-enabled','2541018uDGzfQ','</div>','hly-query-message-count','自定义路径:','delete','hly-kb-select-all-global','.hly-preview-delete-btn-v2','boolean','removeKnowledgeBase','resetSettings','float','#hly-rules-list','\x20个知识库。','成功切换了\x20','删除知识库\x20','未找到匹配的条目','开始批量删除\x20','each','[断点续传]\x20用户选择继续任务\x20','condensation','local','end','hly-current-vector-count','toggleKnowledgeBase','flex','renameKnowledgeBase','hly-max-results','\x20为占位符。','成功加载\x20','val',';\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20for=\x22hly-modal-tag-input\x22>输入标签\x20(以逗号分隔):</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<textarea\x20id=\x22hly-modal-tag-input\x22\x20class=\x22hly-imperial-brush\x22\x20rows=\x222\x22\x20placeholder=\x22例如:\x20content,details,摘要\x22>','宝库已清空。','testApiConnection','radio','replace','.depth_role','clearJob','independentChatMemoryEnabled','.hly-exclusion-rule-row','启禀大人,发现此书上次录入已完成\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','allEntries','圣旨已达','hly-tag-extraction-toggle','hly-tag-input-container','#hly-modal-tag-input-container','block','已采集\x20','》的条目失败:','innerHTML','chunkSize','querySelector','position','input[name=\x22','\x20条消息开始凝识...','contains','宝库状态','none','移动知识库\x20','\x20条有效条目请点击“开始凝识”进入自动向量化流程。','moveKnowledgeBase','queryMessageCount','hly-kb-select-all-','565YGAnPY','name','1WJOSuX','[翰林院-枢纽]\x20未找到类型为\x20\x22','hly-kb-list-global','您确定要永久删除知识库【','type','点击以锁定,让翰林院固定操作当前角色的宝库','url','signal','\x22\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-is-user=\x22','准备对《','\x20个知识库执行批量操作...','checkbox','文书录入失败:\x20','updateHLYMemoryCount','global','.hly-preview-item-v2','编辑检索内容排除规则','hanlinyuan-ingest-novel-start','getVectorCount','会话已解锁。','<option\x20value=\x22\x22>未找到任何书库</option>','executeCompilation'];_0x1a15=function(){return _0x1e2eb6;};return _0x1a15();}import{extractBlocksByTags,applyExclusionRules}from'../core/utils/rag-tag-extractor.js';import{filterWorldbooks,filterWorldbookEntries,highlightSearchMatch,debounce}from'../core/rag-processor.js';_0x28d2da(0x230);function setupGlobalEventHandlers(){const _0x9c32ac=_0x28d2da;window[_0x9c32ac(0x240)]=()=>saveSettingsFromUI(![]),window['resetHLYSettings']=resetSettingsToUI,window[_0x9c32ac(0x28f)]=testApi,window['fetchHLYEmbeddingModels']=fetchHLYEmbeddingModels,window[_0x9c32ac(0x22e)]=fetchHLYRerankModels,window[_0x9c32ac(0x327)]=updatePanelStatus,window[_0x9c32ac(0x3e6)]=purgeStorage,window[_0x9c32ac(0x2a3)]=startCondensation,window[_0x9c32ac(0x234)]=previewCondensation,window[_0x9c32ac(0x259)]=ingestManualText,window['hlyLog']=log,window['showHLYStats']=showStats,window[_0x9c32ac(0x283)]=startHistoriography;}function updateAndSaveSetting(_0x432dde,_0x2d2b27){const _0x3f6349=_0x28d2da,_0xf00ca3=_0x5a0ed1[_0x3f6349(0x22a)]();if(!_0xf00ca3)return;const _0x4619b0=_0x432dde[_0x3f6349(0x3d5)]('.');let _0x55f57c=_0xf00ca3;for(let _0x462ee1=0x0;_0x462ee1<_0x4619b0[_0x3f6349(0x341)]-0x1;_0x462ee1++){_0x55f57c=_0x55f57c[_0x4619b0[_0x462ee1]]=_0x55f57c[_0x4619b0[_0x462ee1]]||{};}_0x55f57c[_0x4619b0[_0x4619b0[_0x3f6349(0x341)]-0x1]]=_0x2d2b27,_0x5a0ed1[_0x3f6349(0x342)](),log(_0x3f6349(0x371)+_0x432dde+'\x27\x20已更新为:\x20'+JSON[_0x3f6349(0x338)](_0x2d2b27),'success');}function bindAutoSaveEvents(){const _0x1805bc=_0x28d2da,_0x3c1f61=document[_0x1805bc(0x214)](_0x1805bc(0x299));if(!_0x3c1f61)return;_0x3c1f61[_0x1805bc(0x29a)]('change',_0x541b13=>{const _0x3277f5=_0x1805bc,_0x4a99c5=_0x541b13[_0x3277f5(0x335)],_0x88d917=_0x4a99c5[_0x3277f5(0x369)]['settingKey'];if(!_0x88d917)return;let _0x22113a;const _0x1e717a=_0x4a99c5[_0x3277f5(0x369)][_0x3277f5(0x31e)]||_0x3277f5(0x337);if(_0x4a99c5[_0x3277f5(0x31e)]===_0x3277f5(0x325))_0x22113a=_0x4a99c5[_0x3277f5(0x3a9)];else{if(_0x4a99c5['type']===_0x3277f5(0x2fa)){if(_0x4a99c5[_0x3277f5(0x3a9)]){const _0x11aa21=_0x3c1f61[_0x3277f5(0x285)](_0x3277f5(0x30e)+_0x4a99c5[_0x3277f5(0x319)]+'\x22]'),_0x23a463=Array['from'](_0x11aa21)[_0x3277f5(0x26a)](_0x161d2d=>_0x161d2d[_0x3277f5(0x3a9)]);_0x22113a=_0x23a463[_0x3277f5(0x25e)];}else return;}else _0x22113a=_0x4a99c5[_0x3277f5(0x25e)];}switch(_0x1e717a){case _0x3277f5(0x21e):_0x22113a=parseInt(_0x22113a,0xa);break;case _0x3277f5(0x2e3):_0x22113a=parseFloat(_0x22113a);break;case'boolean':typeof _0x22113a!==_0x3277f5(0x2e0)&&(_0x22113a=_0x22113a===_0x3277f5(0x3bb));break;}if(_0x4a99c5[_0x3277f5(0x31e)]===_0x3277f5(0x2fa)&&!_0x4a99c5[_0x3277f5(0x3a9)])return;updateAndSaveSetting(_0x88d917,_0x22113a),_0x88d917==='retrieval.independentChatMemoryEnabled'&&updatePanelStatus();});}export function bindHanlinyuanEvents(){const _0x5c71ac=_0x28d2da,_0x37537a=getContext();if(!_0x37537a){console[_0x5c71ac(0x282)](_0x5c71ac(0x33a));return;}setupGlobalEventHandlers(),bindPanelToggleEvents(),bindInternalUIEvents(),bindTutorialEvents(),bindAutoSaveEvents(),bindSessionLockEvent(),initializeUnifiedInjectionEditor();if(_0x5a0ed1[_0x5c71ac(0x2c0)])_0x5a0ed1[_0x5c71ac(0x2c0)]();else{console[_0x5c71ac(0x282)](_0x5c71ac(0x394));return;}loadSettingsToUI(),loadWorldbookList(),log('[翰林院-枢纽]\x20已成功连接各部政令畅通。','info');const _0x49d861=document[_0x5c71ac(0x214)]('hanlinyuan-ingest-novel-file-input'),_0x49b507=document['getElementById'](_0x5c71ac(0x263)),_0x13fd6c=document['getElementById'](_0x5c71ac(0x32b)),_0x4a47e4=document[_0x5c71ac(0x214)](_0x5c71ac(0x27b)),_0x5a9012=document['getElementById'](_0x5c71ac(0x2a2)),_0xb4da80=document[_0x5c71ac(0x214)](_0x5c71ac(0x248)),_0x4deb6a=document[_0x5c71ac(0x214)](_0x5c71ac(0x2a4)),_0x7150d9=document[_0x5c71ac(0x214)]('hanlinyuan-ingest-novel-controls');let _0x1e674b=null,_0x46dbb9=null;_0x49d861[_0x5c71ac(0x29a)](_0x5c71ac(0x1fc),_0xd84e50=>{const _0x3e8863=_0x5c71ac;_0x1e674b=_0xd84e50['target'][_0x3e8863(0x228)][0x0],_0x1e674b?(_0x49b507['textContent']=_0x1e674b[_0x3e8863(0x319)],_0x49b507[_0x3e8863(0x27d)]=_0x1e674b[_0x3e8863(0x319)]):_0x49b507['textContent']=_0x3e8863(0x3d1);}),_0x13fd6c[_0x5c71ac(0x29a)](_0x5c71ac(0x39f),async()=>{const _0x3bc0c9=_0x5c71ac;if(!_0x1e674b){toastr[_0x3bc0c9(0x40a)](_0x3bc0c9(0x29e));return;}let _0xafc159=0x0;const _0x586bb6=_0x54c7cd[_0x3bc0c9(0x354)](_0x1e674b),_0x33c001=_0x54c7cd[_0x3bc0c9(0x357)](_0x586bb6);if(_0x33c001){const _0x2741ba=(_0x33c001[_0x3bc0c9(0x254)]/_0x33c001[_0x3bc0c9(0x219)]*0x64)[_0x3bc0c9(0x3af)](0x1),_0x143b16=confirm(_0x3bc0c9(0x300)+_0x2741ba+_0x3bc0c9(0x255));_0x143b16?(_0xafc159=_0x33c001[_0x3bc0c9(0x254)],toastr[_0x3bc0c9(0x390)](_0x3bc0c9(0x207)+(_0xafc159+0x1)+_0x3bc0c9(0x34f),'圣旨已达'),log(_0x3bc0c9(0x2eb)+_0x586bb6+_0x3bc0c9(0x3c3)+_0xafc159+_0x3bc0c9(0x360),'info')):(_0x54c7cd[_0x3bc0c9(0x2fd)](_0x586bb6),toastr[_0x3bc0c9(0x390)](_0x3bc0c9(0x28d),_0x3bc0c9(0x303)),log(_0x3bc0c9(0x3aa)+_0x586bb6+_0x3bc0c9(0x3f6),_0x3bc0c9(0x23d)));}_0x46dbb9=new AbortController();const _0x40a85d=_0x46dbb9[_0x3bc0c9(0x321)];_0x7150d9['style'][_0x3bc0c9(0x3a8)]=_0x3bc0c9(0x312),_0x5a9012[_0x3bc0c9(0x22b)]['display']='block',_0x4deb6a['textContent']='正在读取文件...',_0xb4da80[_0x3bc0c9(0x25e)]=0x0;try{const _0x4e74f6=await _0x1e674b[_0x3bc0c9(0x3b3)](),_0x48409b=_0x4a99f5=>{const _0x10aec9=_0x3bc0c9;_0x4deb6a[_0x10aec9(0x3e1)]=_0x10aec9(0x3cf)+_0x4a99f5['message']+'\x20('+_0x4a99f5[_0x10aec9(0x3b4)]+'/'+_0x4a99f5[_0x10aec9(0x387)]+')',_0xb4da80[_0x10aec9(0x25e)]=_0x4a99f5[_0x10aec9(0x3b4)]/_0x4a99f5[_0x10aec9(0x387)]*0x64;},_0x500025=()=>{const _0xfdb1d5=_0x3bc0c9;updatePanelStatus(),log(_0xfdb1d5(0x344),_0xfdb1d5(0x390));},_0x1dd627=await _0x5a0ed1[_0x3bc0c9(0x1f3)](_0x4e74f6,_0x3bc0c9(0x38b),{'sourceName':_0x1e674b[_0x3bc0c9(0x319)]},_0x48409b,_0x40a85d,log,_0x500025,_0x586bb6,_0xafc159);if(_0x1dd627[_0x3bc0c9(0x224)])toastr[_0x3bc0c9(0x224)](_0x3bc0c9(0x2ba)+_0x1dd627[_0x3bc0c9(0x343)]+_0x3bc0c9(0x24f)),_0x4deb6a['textContent']='任务完成!成功录入\x20'+_0x1dd627[_0x3bc0c9(0x343)]+_0x3bc0c9(0x385),_0xb4da80['value']=0x64,updatePanelStatus();else throw new Error(_0x1dd627[_0x3bc0c9(0x282)]||'未知错误');}catch(_0x5163bc){_0x5163bc[_0x3bc0c9(0x319)]===_0x3bc0c9(0x40f)?(toastr[_0x3bc0c9(0x390)](_0x3bc0c9(0x232)),_0x4deb6a['textContent']=_0x3bc0c9(0x36f)):(toastr[_0x3bc0c9(0x282)](_0x3bc0c9(0x216)+_0x5163bc[_0x3bc0c9(0x415)]+_0x3bc0c9(0x365)),_0x4deb6a[_0x3bc0c9(0x3e1)]=_0x3bc0c9(0x2c5)+_0x5163bc[_0x3bc0c9(0x415)]);}finally{setTimeout(()=>{const _0x5bef81=_0x3bc0c9;_0x7150d9[_0x5bef81(0x22b)]['display']=_0x5bef81(0x2f1),_0x5a9012['style'][_0x5bef81(0x3a8)]=_0x5bef81(0x312),_0x49d861[_0x5bef81(0x25e)]='',_0x1e674b=null,_0x49b507[_0x5bef81(0x3e1)]=_0x5bef81(0x3d1);},0xbb8);}}),_0x4a47e4['addEventListener'](_0x5c71ac(0x39f),()=>{_0x46dbb9&&_0x46dbb9['abort']();});}function bindSessionLockEvent(){const _0x29a9cb=_0x28d2da,_0x1c0b46=document[_0x29a9cb(0x214)](_0x29a9cb(0x400));if(!_0x1c0b46)return;_0x1c0b46[_0x29a9cb(0x29a)](_0x29a9cb(0x39f),async()=>{const _0x1d1888=_0x29a9cb,_0x47b5c1=await _0x5a0ed1[_0x1d1888(0x402)]();updateSessionLockUI(_0x47b5c1);if(_0x47b5c1){const _0x4381c5=_0x5a0ed1[_0x1d1888(0x2d4)]();_0x4381c5&&(toastr[_0x1d1888(0x224)](_0x1d1888(0x20a)+_0x4381c5['id'],_0x1d1888(0x1f7)),log(_0x1d1888(0x3e2)+_0x4381c5['id'],_0x1d1888(0x224)));}else toastr['info'](_0x1d1888(0x2ca),'诏曰'),log(_0x1d1888(0x32d),_0x1d1888(0x390));updatePanelStatus();}),updateSessionLockUI(_0x5a0ed1[_0x29a9cb(0x274)]());}function updateSessionLockUI(_0x51b879){const _0x388703=_0x28d2da,_0x224e43=document[_0x388703(0x214)](_0x388703(0x400));if(!_0x224e43)return;const _0x4fda47=_0x224e43[_0x388703(0x30c)]('i'),_0x32f01e=_0x224e43[_0x388703(0x30c)](_0x388703(0x2cd));_0x51b879?(_0x224e43[_0x388703(0x2c4)][_0x388703(0x1f6)](_0x388703(0x3c6)),_0x4fda47['className']=_0x388703(0x408),_0x32f01e[_0x388703(0x3e1)]=_0x388703(0x36e),_0x224e43[_0x388703(0x27d)]=_0x388703(0x3d7)):(_0x224e43['classList'][_0x388703(0x21a)](_0x388703(0x3c6)),_0x4fda47[_0x388703(0x2b4)]=_0x388703(0x413),_0x32f01e['textContent']='锁定会话',_0x224e43[_0x388703(0x27d)]=_0x388703(0x31f));}function bindPanelToggleEvents(){const _0x1eb852=_0x28d2da,_0xef0868=document[_0x1eb852(0x214)](_0x1eb852(0x296));if(_0xef0868){}}function bindTutorialEvents(){const _0x50ce05=_0x28d2da,_0x51bf99=document[_0x50ce05(0x214)]('amily2_open_hanlin_tutorial');_0x51bf99&&_0x51bf99[_0x50ce05(0x29a)](_0x50ce05(0x39f),()=>{const _0x32ed9c=_0x50ce05;showContentModal(_0x32ed9c(0x386),_0x32ed9c(0x363));});}function bindInternalUIEvents(){const _0x2d6442=_0x28d2da,_0x4f1103=document[_0x2d6442(0x285)](_0x2d6442(0x331));_0x4f1103[_0x2d6442(0x3dd)](_0x14d2f3=>{const _0x511a8e=_0x2d6442;_0x14d2f3[_0x511a8e(0x29a)](_0x511a8e(0x39f),()=>{const _0x33fa96=_0x511a8e,_0x156a17=_0x14d2f3[_0x33fa96(0x369)][_0x33fa96(0x295)],_0x169aba=_0x33fa96(0x409)+_0x156a17+_0x33fa96(0x21c);document[_0x33fa96(0x285)](_0x33fa96(0x3d6))['forEach'](_0x4ad631=>{const _0x265a30=_0x33fa96;_0x4ad631[_0x265a30(0x2c4)][_0x265a30(0x29b)](_0x265a30(0x3c6),_0x4ad631['id']===_0x169aba);}),_0x4f1103[_0x33fa96(0x3dd)](_0xd74caa=>_0xd74caa['classList']['toggle'](_0x33fa96(0x3c6),_0xd74caa===_0x14d2f3));});});const _0x28b6dd=document[_0x2d6442(0x214)](_0x2d6442(0x353));_0x28b6dd&&_0x28b6dd[_0x2d6442(0x29a)](_0x2d6442(0x1fc),handleApiModeChange);const _0x146ac1=document[_0x2d6442(0x214)](_0x2d6442(0x304)),_0x1f045a=document[_0x2d6442(0x214)](_0x2d6442(0x305));_0x146ac1&&_0x1f045a&&_0x146ac1['addEventListener'](_0x2d6442(0x1fc),()=>{const _0x40bb19=_0x2d6442;_0x1f045a[_0x40bb19(0x22b)][_0x40bb19(0x3a8)]=_0x146ac1[_0x40bb19(0x3a9)]?_0x40bb19(0x307):_0x40bb19(0x312);});const _0x5370f7=document[_0x2d6442(0x214)](_0x2d6442(0x3c2));_0x5370f7&&_0x5370f7[_0x2d6442(0x29a)](_0x2d6442(0x1fc),handleWorldbookSelectionChange);const _0x25e0e1=document['getElementById']('hly-exclusion-rules-btn');_0x25e0e1&&_0x25e0e1[_0x2d6442(0x29a)](_0x2d6442(0x39f),()=>showRulesModal(_0x2d6442(0x2ec)));const _0x1f112b=document[_0x2d6442(0x214)]('hly-query-preprocessing-rules-btn');_0x1f112b&&_0x1f112b['addEventListener']('click',()=>showRulesModal('queryPreprocessing'));const _0x558a54=document[_0x2d6442(0x214)](_0x2d6442(0x286)),_0x13f699=document['getElementById'](_0x2d6442(0x375));_0x558a54&&_0x13f699&&(_0x558a54[_0x2d6442(0x29a)](_0x2d6442(0x39f),_0xf31c34=>{const _0x47841c=_0x2d6442;_0xf31c34[_0x47841c(0x257)]();const _0x33b429=_0x13f699[_0x47841c(0x22b)]['display']===_0x47841c(0x307);_0x13f699[_0x47841c(0x22b)][_0x47841c(0x3a8)]=_0x33b429?_0x47841c(0x312):_0x47841c(0x307);}),_0x13f699[_0x2d6442(0x29a)](_0x2d6442(0x1fc),_0xddf3b4=>{const _0x30a99b=_0x2d6442,_0x5475bf=_0xddf3b4['target'];if(_0x5475bf[_0x30a99b(0x31e)]!==_0x30a99b(0x325))return;const _0x18ba19=_0x13f699[_0x30a99b(0x285)](_0x30a99b(0x3a5)),_0x1f3e34=document[_0x30a99b(0x214)](_0x30a99b(0x2c3));if(_0x5475bf['id']===_0x30a99b(0x2c3))_0x18ba19[_0x30a99b(0x3dd)](_0x585cd8=>_0x585cd8[_0x30a99b(0x3a9)]=_0x5475bf[_0x30a99b(0x3a9)]);else{const _0x42fd1a=Array[_0x30a99b(0x3fb)](_0x18ba19)[_0x30a99b(0x251)](_0x61ce96=>_0x61ce96[_0x30a99b(0x3a9)]);_0x1f3e34[_0x30a99b(0x3a9)]=_0x42fd1a;}const _0x4faea4=_0x13f699[_0x30a99b(0x285)](_0x30a99b(0x3ef))['length'],_0x39cf62=_0x18ba19[_0x30a99b(0x341)];_0x558a54[_0x30a99b(0x30c)](_0x30a99b(0x2cd))[_0x30a99b(0x3e1)]=_0x30a99b(0x27e)+_0x4faea4+_0x30a99b(0x278)+_0x39cf62+_0x30a99b(0x37c);}),document[_0x2d6442(0x29a)]('click',_0x5c16ed=>{const _0x3eb234=_0x2d6442;!_0x558a54[_0x3eb234(0x310)](_0x5c16ed[_0x3eb234(0x335)])&&!_0x13f699[_0x3eb234(0x310)](_0x5c16ed['target'])&&(_0x13f699[_0x3eb234(0x22b)][_0x3eb234(0x3a8)]=_0x3eb234(0x312));}));const _0x4d42b1=document[_0x2d6442(0x214)](_0x2d6442(0x391));_0x4d42b1&&_0x4d42b1[_0x2d6442(0x29a)](_0x2d6442(0x39f),deleteAllLocalKnowledgeBases);const _0x17e211=document['getElementById']('hly-kb-move-all-to-local');_0x17e211&&_0x17e211[_0x2d6442(0x29a)]('click',()=>moveAllKnowledgeBases(_0x2d6442(0x267)));const _0x2da5c3=document[_0x2d6442(0x214)](_0x2d6442(0x374));_0x2da5c3&&_0x2da5c3[_0x2d6442(0x29a)]('click',()=>moveAllKnowledgeBases(_0x2d6442(0x3c5)));const _0x1bd6ca=[_0x2d6442(0x34c),_0x2d6442(0x31c)];_0x1bd6ca[_0x2d6442(0x3dd)](_0x2e8f5a=>{const _0x13ffc5=_0x2d6442,_0x24f8c0=document[_0x13ffc5(0x214)](_0x2e8f5a);_0x24f8c0&&(_0x24f8c0[_0x13ffc5(0x29a)]('click',handleKbAction),_0x24f8c0[_0x13ffc5(0x29a)](_0x13ffc5(0x1fc),handleKbAction));}),document['getElementById'](_0x2d6442(0x2de))[_0x2d6442(0x29a)](_0x2d6442(0x1fc),_0x13268c=>handleSelectAll(_0x13268c,'global')),document[_0x2d6442(0x214)]('hly-kb-select-all-local')[_0x2d6442(0x29a)](_0x2d6442(0x1fc),_0x2ef633=>handleSelectAll(_0x2ef633,_0x2d6442(0x2ed))),document[_0x2d6442(0x214)](_0x2d6442(0x382))['addEventListener'](_0x2d6442(0x39f),_0x424e52=>handleBulkAction(_0x424e52,'global')),document[_0x2d6442(0x214)](_0x2d6442(0x2d2))[_0x2d6442(0x29a)](_0x2d6442(0x39f),_0xa0e4c8=>handleBulkAction(_0xa0e4c8,_0x2d6442(0x2ed)));}function initializeUnifiedInjectionEditor(){const _0x5aa35f=_0x28d2da,_0x565d61=document[_0x5aa35f(0x214)](_0x5aa35f(0x392)),_0x3df534=document[_0x5aa35f(0x214)](_0x5aa35f(0x3cd)),_0x221b81=document[_0x5aa35f(0x214)](_0x5aa35f(0x3a7)),_0x201587=document['querySelectorAll'](_0x5aa35f(0x2b1)),_0x5550b6=document[_0x5aa35f(0x214)]('hly-unified-injection-depth'),_0x4dfe79=document[_0x5aa35f(0x214)](_0x5aa35f(0x27f));if(!_0x565d61)return;const _0x3e3d5a={'novel':_0x5aa35f(0x3ec),'chat':_0x5aa35f(0x334),'lorebook':_0x5aa35f(0x236),'manual':_0x5aa35f(0x2aa)};function _0x1cb71a(){const _0x2dbc04=_0x5aa35f,_0x51b4c6=_0x565d61[_0x2dbc04(0x25e)],_0x2e048c=_0x5a0ed1['getSettings'](),_0x5496d8=_0x2e048c[_0x2dbc04(0x2c6)+_0x51b4c6]||{};_0x3df534[_0x2dbc04(0x25e)]=_0x5496d8[_0x2dbc04(0x2b5)]||'',_0x221b81[_0x2dbc04(0x3e1)]='以\x20'+(_0x3e3d5a[_0x51b4c6]||'{{text}}')+_0x2dbc04(0x2f4);const _0x24f078=_0x5496d8[_0x2dbc04(0x30d)]!==undefined?String(_0x5496d8[_0x2dbc04(0x30d)]):'2';_0x201587[_0x2dbc04(0x3dd)](_0x3d788e=>_0x3d788e[_0x2dbc04(0x3a9)]=_0x3d788e['value']===_0x24f078),_0x5550b6['value']=_0x5496d8['depth']||0x0,_0x4dfe79['value']=_0x5496d8[_0x2dbc04(0x3b9)]!==undefined?String(_0x5496d8[_0x2dbc04(0x3b9)]):'0';const _0x4ac179=_0x24f078==='1';_0x5550b6[_0x2dbc04(0x298)]=!_0x4ac179,_0x4dfe79[_0x2dbc04(0x298)]=!_0x4ac179;}function _0x1d8a99(){const _0x349db5=_0x5aa35f,_0x233da5=_0x565d61[_0x349db5(0x25e)];updateAndSaveSetting('injection_'+_0x233da5+'.template',_0x3df534['value']);const _0x4bacc2=document[_0x349db5(0x30c)](_0x349db5(0x3c7));_0x4bacc2&&updateAndSaveSetting(_0x349db5(0x2c6)+_0x233da5+_0x349db5(0x3cc),parseInt(_0x4bacc2[_0x349db5(0x25e)],0xa)),updateAndSaveSetting(_0x349db5(0x2c6)+_0x233da5+_0x349db5(0x256),parseInt(_0x5550b6[_0x349db5(0x25e)],0xa)),updateAndSaveSetting(_0x349db5(0x2c6)+_0x233da5+_0x349db5(0x2fc),parseInt(_0x4dfe79[_0x349db5(0x25e)],0xa));}_0x565d61['addEventListener'](_0x5aa35f(0x1fc),_0x1cb71a);const _0x2ed4e4=debounce(_0x1d8a99,0x12c);_0x3df534[_0x5aa35f(0x29a)](_0x5aa35f(0x235),_0x2ed4e4),_0x5550b6[_0x5aa35f(0x29a)](_0x5aa35f(0x1fc),_0x1d8a99),_0x4dfe79[_0x5aa35f(0x29a)](_0x5aa35f(0x1fc),_0x1d8a99),_0x201587[_0x5aa35f(0x3dd)](_0x3ed4cf=>_0x3ed4cf[_0x5aa35f(0x29a)](_0x5aa35f(0x1fc),()=>{const _0x928f97=_0x5aa35f;_0x1d8a99();const _0x249673=_0x3ed4cf[_0x928f97(0x25e)]==='1'&&_0x3ed4cf['checked'];_0x5550b6[_0x928f97(0x298)]=!_0x249673,_0x4dfe79[_0x928f97(0x298)]=!_0x249673;})),_0x1cb71a();}function handleApiModeChange(){const _0x253c74=_0x28d2da,_0x5b6e02=document[_0x253c74(0x214)](_0x253c74(0x353))[_0x253c74(0x25e)],_0x42fea4=document['getElementById'](_0x253c74(0x36c)),_0x48deaf=document[_0x253c74(0x214)](_0x253c74(0x384)),_0xab017d=document[_0x253c74(0x214)]('hly-embedding-model'),_0x32d382=_0xab017d['previousElementSibling'];if(!_0x42fea4||!_0x48deaf)return;_0x42fea4[_0x253c74(0x22b)][_0x253c74(0x3a8)]=_0x253c74(0x307),_0x48deaf[_0x253c74(0x22b)]['display']=_0x253c74(0x307);switch(_0x5b6e02){case _0x253c74(0x210):_0x42fea4[_0x253c74(0x22b)][_0x253c74(0x3a8)]=_0x253c74(0x312),_0x48deaf['querySelector']('label')['textContent']=_0x253c74(0x2a0),_0x48deaf[_0x253c74(0x30c)](_0x253c74(0x235))['placeholder']=_0x253c74(0x229);break;case _0x253c74(0x364):_0x42fea4[_0x253c74(0x30c)](_0x253c74(0x287))[_0x253c74(0x3e1)]=_0x253c74(0x3db),_0x42fea4['querySelector'](_0x253c74(0x235))['placeholder']=_0x253c74(0x1ff),_0x48deaf['style']['display']=_0x253c74(0x312);break;case _0x253c74(0x3f9):default:_0x42fea4[_0x253c74(0x30c)](_0x253c74(0x287))[_0x253c74(0x3e1)]=_0x253c74(0x2dc),_0x42fea4[_0x253c74(0x30c)](_0x253c74(0x235))['placeholder']=_0x253c74(0x2ae),_0x48deaf['querySelector'](_0x253c74(0x287))[_0x253c74(0x3e1)]=_0x253c74(0x3bc);break;}}function loadSettingsToUI(){const _0x201612=_0x28d2da,_0x6c8a37=_0x5a0ed1[_0x201612(0x22a)]();if(!_0x6c8a37)return;document[_0x201612(0x214)](_0x201612(0x3f1))['checked']=_0x6c8a37[_0x201612(0x380)][_0x201612(0x3ee)],document[_0x201612(0x214)](_0x201612(0x353))[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x380)]['apiEndpoint'],document[_0x201612(0x214)]('hly-custom-api-url')[_0x201612(0x25e)]=_0x6c8a37['retrieval']['customApiUrl'],document[_0x201612(0x214)]('hly-api-key')[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x380)]['apiKey'];const _0x3cccd9=document[_0x201612(0x214)](_0x201612(0x261));if(_0x3cccd9[_0x201612(0x332)][_0x201612(0x341)]===0x0){const _0x574d2b=_0x6c8a37[_0x201612(0x380)][_0x201612(0x35b)],_0x4990eb=new Option(_0x574d2b,_0x574d2b,!![],!![]);_0x3cccd9[_0x201612(0x1f6)](_0x4990eb);}_0x3cccd9[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x380)]['embeddingModel'],document['getElementById'](_0x201612(0x350))['checked']=_0x6c8a37[_0x201612(0x380)][_0x201612(0x406)],document[_0x201612(0x214)](_0x201612(0x243))['value']=_0x6c8a37['advanced'][_0x201612(0x30b)],document['getElementById'](_0x201612(0x3a1))[_0x201612(0x25e)]=_0x6c8a37['advanced']['overlap'],document[_0x201612(0x214)]('hly-match-threshold')[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x34e)]['matchThreshold'],document[_0x201612(0x214)](_0x201612(0x2db))['value']=_0x6c8a37[_0x201612(0x34e)][_0x201612(0x316)],document[_0x201612(0x214)](_0x201612(0x2f3))[_0x201612(0x25e)]=_0x6c8a37['advanced'][_0x201612(0x2a9)],document['getElementById'](_0x201612(0x3de))[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x380)]['batchSize'],handleApiModeChange(),document[_0x201612(0x214)](_0x201612(0x399))[_0x201612(0x3a9)]=_0x6c8a37[_0x201612(0x2ec)]['enabled'],document[_0x201612(0x214)](_0x201612(0x2ad))[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x2ec)][_0x201612(0x3fa)],document[_0x201612(0x214)](_0x201612(0x1fb))[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x2ec)][_0x201612(0x403)],document[_0x201612(0x214)](_0x201612(0x383))[_0x201612(0x3a9)]=_0x6c8a37[_0x201612(0x2ec)][_0x201612(0x373)][_0x201612(0x26d)],document[_0x201612(0x214)](_0x201612(0x221))['checked']=_0x6c8a37['condensation'][_0x201612(0x373)]['ai'];const _0x680fd=document[_0x201612(0x214)](_0x201612(0x304)),_0x1e43f7=document[_0x201612(0x214)]('hly-tag-input'),_0x2d7c51=document[_0x201612(0x214)]('hly-tag-input-container');_0x680fd[_0x201612(0x3a9)]=_0x6c8a37[_0x201612(0x2ec)]['tagExtractionEnabled'],_0x1e43f7[_0x201612(0x25e)]=_0x6c8a37['condensation'][_0x201612(0x3ac)],_0x2d7c51[_0x201612(0x22b)][_0x201612(0x3a8)]=_0x680fd[_0x201612(0x3a9)]?'block':_0x201612(0x312),document[_0x201612(0x214)](_0x201612(0x2d8))[_0x201612(0x3a9)]=_0x6c8a37[_0x201612(0x28a)]['enabled'],document['getElementById'](_0x201612(0x3d0))[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x28a)][_0x201612(0x320)],document[_0x201612(0x214)](_0x201612(0x3a2))[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x28a)][_0x201612(0x206)];const _0x21e0db=document[_0x201612(0x214)]('hly-rerank-model');if(_0x21e0db[_0x201612(0x332)][_0x201612(0x341)]===0x0){const _0x32fc22=_0x6c8a37['rerank'][_0x201612(0x397)];if(_0x32fc22){const _0x3dff52=new Option(_0x32fc22,_0x32fc22,!![],!![]);_0x21e0db[_0x201612(0x1f6)](_0x3dff52);}}_0x21e0db[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x28a)][_0x201612(0x397)],document[_0x201612(0x214)]('hly-rerank-top-n')[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x28a)][_0x201612(0x38e)],document['getElementById']('hly-rerank-hybrid-alpha')[_0x201612(0x25e)]=_0x6c8a37[_0x201612(0x28a)][_0x201612(0x211)],document[_0x201612(0x214)](_0x201612(0x26c))[_0x201612(0x3a9)]=_0x6c8a37[_0x201612(0x28a)][_0x201612(0x406)],document['getElementById']('hly-super-sort-enabled')['checked']=_0x6c8a37[_0x201612(0x28a)][_0x201612(0x2b2)];const _0x11aba6=_0x6c8a37['rerank']['priorityRetrieval'];if(_0x11aba6){document[_0x201612(0x214)](_0x201612(0x3dc))[_0x201612(0x3a9)]=_0x11aba6[_0x201612(0x3ee)];const _0x328549=[_0x201612(0x38b),_0x201612(0x25a),_0x201612(0x2a1),_0x201612(0x395)];_0x328549['forEach'](_0x37eb92=>{const _0x37ba25=_0x201612,_0x733f84=_0x11aba6[_0x37ba25(0x3e3)][_0x37eb92];if(_0x733f84){const _0x517fd8=document['querySelector'](_0x37ba25(0x226)+_0x37eb92+'.enabled\x22]'),_0x38c290=document[_0x37ba25(0x30c)](_0x37ba25(0x226)+_0x37eb92+_0x37ba25(0x262));if(_0x517fd8)_0x517fd8[_0x37ba25(0x3a9)]=_0x733f84[_0x37ba25(0x3ee)];if(_0x38c290)_0x38c290['value']=_0x733f84[_0x37ba25(0x343)];}});}_0x6c8a37['queryPreprocessing']&&(document[_0x201612(0x214)](_0x201612(0x280))[_0x201612(0x3a9)]=_0x6c8a37['queryPreprocessing'][_0x201612(0x3ee)]),_0x6c8a37[_0x201612(0x380)][_0x201612(0x2fe)]!==undefined&&(document[_0x201612(0x214)](_0x201612(0x269))[_0x201612(0x3a9)]=_0x6c8a37[_0x201612(0x380)]['independentChatMemoryEnabled']);}function saveSettingsFromUI(_0x4956c3=!![]){const _0x4582fe=_0x28d2da,_0x59e8d8=document[_0x4582fe(0x214)](_0x4582fe(0x299));if(!_0x59e8d8)return;const _0x96a758=_0x59e8d8[_0x4582fe(0x285)](_0x4582fe(0x3fd));_0x96a758['forEach'](_0xc400f2=>{const _0x585818=_0x4582fe,_0x88e277=_0xc400f2[_0x585818(0x369)][_0x585818(0x215)];if(!_0x88e277)return;let _0x74d1e7;const _0x12e126=_0xc400f2['dataset'][_0x585818(0x31e)]||_0x585818(0x337);if(_0xc400f2[_0x585818(0x31e)]===_0x585818(0x325))_0x74d1e7=_0xc400f2['checked'];else{if(_0xc400f2['type']===_0x585818(0x2fa)){if(!_0xc400f2[_0x585818(0x3a9)])return;_0x74d1e7=_0xc400f2[_0x585818(0x25e)];}else _0x74d1e7=_0xc400f2[_0x585818(0x25e)];}switch(_0x12e126){case _0x585818(0x21e):_0x74d1e7=parseInt(_0x74d1e7,0xa);break;case _0x585818(0x2e3):_0x74d1e7=parseFloat(_0x74d1e7);break;case _0x585818(0x2e0):if(typeof _0x74d1e7!=='boolean')_0x74d1e7=_0x74d1e7===_0x585818(0x3bb);break;}const _0x10f567=_0x5a0ed1[_0x585818(0x22a)](),_0x544ffa=_0x88e277[_0x585818(0x3d5)]('.');let _0x535fc0=_0x10f567;for(let _0x5445e6=0x0;_0x5445e6<_0x544ffa[_0x585818(0x341)]-0x1;_0x5445e6++){_0x535fc0=_0x535fc0[_0x544ffa[_0x5445e6]]=_0x535fc0[_0x544ffa[_0x5445e6]]||{};}_0x535fc0[_0x544ffa[_0x544ffa[_0x585818(0x341)]-0x1]]=_0x74d1e7;}),_0x5a0ed1[_0x4582fe(0x342)](),!_0x4956c3&&(log(_0x4582fe(0x27c),_0x4582fe(0x224)),toastr[_0x4582fe(0x224)](_0x4582fe(0x22d),_0x4582fe(0x303)));}function resetSettingsToUI(){const _0x221d71=_0x28d2da;confirm(_0x221d71(0x3e5))&&(_0x5a0ed1[_0x221d71(0x2e2)](),loadSettingsToUI(),toastr[_0x221d71(0x390)](_0x221d71(0x24b),'诏曰'));}async function updatePanelStatus(){const _0x35cec2=_0x28d2da,_0x1cde32=_0x5a0ed1[_0x35cec2(0x274)](),_0x4c5e55=document[_0x35cec2(0x214)](_0x35cec2(0x35d)),_0x2248e6=document['getElementById'](_0x35cec2(0x277));if(_0x1cde32){const _0x32d178=_0x5a0ed1[_0x35cec2(0x2d4)]();_0x32d178&&(_0x4c5e55[_0x35cec2(0x3e1)]='会话已锁定',_0x2248e6[_0x35cec2(0x3e1)]=_0x32d178['id'],_0x2248e6['title']=_0x35cec2(0x33d)+_0x32d178['id'],_0x4c5e55[_0x35cec2(0x2c4)][_0x35cec2(0x1f6)](_0x35cec2(0x222)),_0x2248e6[_0x35cec2(0x2c4)]['add'](_0x35cec2(0x222)));}else _0x4c5e55['textContent']=_0x4966d0[_0x35cec2(0x1fd)](),_0x2248e6[_0x35cec2(0x3e1)]=_0x4966d0[_0x35cec2(0x276)]()||'无',_0x2248e6[_0x35cec2(0x27d)]='',_0x4c5e55['classList'][_0x35cec2(0x21a)](_0x35cec2(0x222)),_0x2248e6[_0x35cec2(0x2c4)][_0x35cec2(0x21a)](_0x35cec2(0x222));const _0x4f0a20=document[_0x35cec2(0x214)](_0x35cec2(0x2ef));_0x4f0a20[_0x35cec2(0x3e1)]=_0x35cec2(0x3b6);try{const _0x8f437e=await _0x5a0ed1[_0x35cec2(0x32c)]();_0x4f0a20[_0x35cec2(0x3e1)]=_0x8f437e;}catch(_0x5cfb5f){console[_0x35cec2(0x282)](_0x35cec2(0x1fa),_0x5cfb5f),_0x4f0a20[_0x35cec2(0x3e1)]=_0x35cec2(0x266),_0x4f0a20['title']='无法获取总数:\x20'+_0x5cfb5f[_0x35cec2(0x415)];}const _0x583b0c=document[_0x35cec2(0x214)](_0x35cec2(0x2ce));if(_0x583b0c&&!_0x583b0c[_0x35cec2(0x369)][_0x35cec2(0x25c)]){const _0x2318fc=_0x5a0ed1['getSettings'](),_0x105bf7=await _0x5a0ed1[_0x35cec2(0x2d3)]();if(_0x2318fc[_0x35cec2(0x23b)]&&_0x2318fc[_0x35cec2(0x23b)][_0x105bf7]){const _0x513227=_0x2318fc['condensationHistory'][_0x105bf7];_0x583b0c['innerHTML']='<p\x20class=\x22hly-record-hint\x22><i>上次已从第\x20'+_0x513227['start']+'\x20楼凝识至第\x20'+_0x513227[_0x35cec2(0x2ee)]+_0x35cec2(0x2b0);}else _0x583b0c['innerHTML']='<p\x20class=\x22hly-record-hint\x22>可在此预览凝识结果。</p>';}renderKnowledgeBases();}async function moveAllKnowledgeBases(_0x4d6d57){const _0x236ff5=_0x28d2da,_0x3d00e3=_0x4d6d57==='globalToLocal',_0x37a662=_0x3d00e3?_0x236ff5(0x328):_0x236ff5(0x2ed),_0x29df8c=_0x3d00e3?'局部':'全局',_0x5ddf43=_0x3d00e3?_0x5a0ed1[_0x236ff5(0x281)]():_0x5a0ed1[_0x236ff5(0x247)](),_0x54866b=Object['keys'](_0x5ddf43);if(_0x54866b['length']===0x0){toastr[_0x236ff5(0x390)](_0x236ff5(0x1f4)+(_0x3d00e3?'全局':'局部')+')没有任何知识库可供移动。','圣谕');return;}if(!confirm(_0x236ff5(0x270)+_0x54866b[_0x236ff5(0x341)]+_0x236ff5(0x2d0)+(_0x3d00e3?'全局':'局部')+_0x236ff5(0x349)+_0x29df8c+_0x236ff5(0x336)))return;log(_0x236ff5(0x289)+_0x54866b[_0x236ff5(0x341)]+_0x236ff5(0x260)+_0x37a662+'\x20移动到\x20'+(_0x3d00e3?_0x236ff5(0x2ed):_0x236ff5(0x328))+_0x236ff5(0x3b6),'info');const _0x5b8aac=_0x54866b['map'](_0xe86d8=>_0x5a0ed1['moveKnowledgeBase'](_0xe86d8,_0x37a662));try{await Promise[_0x236ff5(0x39d)](_0x5b8aac),toastr[_0x236ff5(0x224)](_0x236ff5(0x20c)+_0x54866b['length']+_0x236ff5(0x275),'大功告成'),log('批量移动完成。',_0x236ff5(0x224));}catch(_0x226574){toastr[_0x236ff5(0x282)](_0x236ff5(0x2ac)+_0x226574[_0x236ff5(0x415)],'警报'),log('批量移动失败:\x20'+_0x226574['message'],_0x236ff5(0x282));}finally{await updatePanelStatus();}}async function deleteAllLocalKnowledgeBases(){const _0x2f97d1=_0x28d2da,_0x10ff47=_0x5a0ed1[_0x2f97d1(0x247)](),_0x270144=Object[_0x2f97d1(0x3c9)](_0x10ff47);if(_0x270144[_0x2f97d1(0x341)]===0x0){toastr['info'](_0x2f97d1(0x1fe),'圣谕');return;}if(!confirm('您确定要永久删除【当前角色】的全部\x20'+_0x270144[_0x2f97d1(0x341)]+_0x2f97d1(0x2bf)))return;toastr[_0x2f97d1(0x390)]('正在删除\x20'+_0x270144[_0x2f97d1(0x341)]+_0x2f97d1(0x3ea),'圣旨'),log(_0x2f97d1(0x2e9)+_0x270144[_0x2f97d1(0x341)]+_0x2f97d1(0x3ea),_0x2f97d1(0x23d));let _0x3b3153=0x0,_0x6878c5=0x0;for(const _0x3a522c of _0x270144){try{await _0x5a0ed1[_0x2f97d1(0x2e1)](_0x3a522c,_0x2f97d1(0x2ed)),_0x3b3153++;}catch(_0x1b98ed){_0x6878c5++,log(_0x2f97d1(0x244)+_0x3a522c+_0x2f97d1(0x2b9)+_0x1b98ed[_0x2f97d1(0x415)],_0x2f97d1(0x282));}}_0x6878c5>0x0?toastr[_0x2f97d1(0x282)](_0x2f97d1(0x2cf)+_0x6878c5+_0x2f97d1(0x271),'警报'):toastr['success'](_0x2f97d1(0x20c)+_0x3b3153+_0x2f97d1(0x39e),_0x2f97d1(0x201)),log('局部知识库批量删除完成。成功:\x20'+_0x3b3153+',\x20失败:\x20'+_0x6878c5,_0x2f97d1(0x390)),await updatePanelStatus();}async function renderKnowledgeBases(){const _0x45c1a5=_0x28d2da,_0xcdf090=document[_0x45c1a5(0x214)](_0x45c1a5(0x34c)),_0x427456=document[_0x45c1a5(0x214)](_0x45c1a5(0x31c)),_0x156ed5=document['getElementById'](_0x45c1a5(0x2c2));if(!_0xcdf090||!_0x427456||!_0x156ed5)return;_0x156ed5[_0x45c1a5(0x3e1)]=_0x4966d0[_0x45c1a5(0x1fd)]()||_0x45c1a5(0x24c);try{const _0x43e82e=_0x5a0ed1[_0x45c1a5(0x247)](),_0x1eab4d=_0x5a0ed1[_0x45c1a5(0x281)]();await _renderKbList(_0x43e82e,_0xcdf090,_0x45c1a5(0x2ed),'hly-kb-list-local-placeholder'),await _renderKbList(_0x1eab4d,_0x427456,_0x45c1a5(0x328),'hly-kb-list-global-placeholder');}catch(_0x3aaa5e){console[_0x45c1a5(0x282)](_0x45c1a5(0x2c7),_0x3aaa5e),_0xcdf090[_0x45c1a5(0x30a)]=_0x45c1a5(0x288)+_0x3aaa5e[_0x45c1a5(0x415)]+_0x45c1a5(0x3df),_0x427456[_0x45c1a5(0x30a)]=_0x45c1a5(0x288)+_0x3aaa5e['message']+_0x45c1a5(0x3df);}}async function _renderKbList(_0x1fe686,_0xd46886,_0x2719f1,_0x1547d9){const _0x88d619=_0x28d2da,_0x34ba84=document[_0x88d619(0x214)](_0x1547d9);_0xd46886[_0x88d619(0x30a)]='',_0xd46886[_0x88d619(0x366)](_0x34ba84);if(Object[_0x88d619(0x3c9)](_0x1fe686)[_0x88d619(0x341)]===0x0){_0x34ba84[_0x88d619(0x22b)][_0x88d619(0x3a8)]=_0x88d619(0x307);return;}_0x34ba84[_0x88d619(0x22b)][_0x88d619(0x3a8)]=_0x88d619(0x312);for(const [_0x1219d4,_0x348d35]of Object[_0x88d619(0x34b)](_0x1fe686)){const _0x1aff8c=document['createElement'](_0x88d619(0x272));_0x1aff8c['className']=_0x88d619(0x36b),_0x1aff8c[_0x88d619(0x369)]['kbId']=_0x1219d4,_0x1aff8c['dataset']['kbScope']=_0x2719f1;const _0x25956c=await _0x5a0ed1['getVectorCount'](_0x1219d4,_0x2719f1),_0x5f5d0e=_0x2719f1===_0x88d619(0x2ed)?_0x88d619(0x351):_0x88d619(0x3cb);_0x1aff8c[_0x88d619(0x30a)]=_0x88d619(0x33c)+_0x1219d4+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22hly-kb-name\x22\x20title=\x22ID:\x20'+_0x1219d4+'\x22>'+_0x348d35['name']+'\x20('+_0x25956c+_0x88d619(0x2be)+_0x5f5d0e+_0x88d619(0x28e)+(_0x348d35[_0x88d619(0x3ee)]?_0x88d619(0x3a9):'')+_0x88d619(0x36d),_0xd46886[_0x88d619(0x366)](_0x1aff8c);}}async function handleKbAction(_0x2949b5){const _0x15573c=_0x28d2da,_0x135783=_0x2949b5['target'],_0x37c968=_0x135783[_0x15573c(0x265)](_0x15573c(0x2bd));if(!_0x37c968)return;const _0x46a723=_0x37c968[_0x15573c(0x369)][_0x15573c(0x3b0)],_0x31e3da=_0x37c968[_0x15573c(0x369)]['kbScope'],_0x768d10=_0x37c968['querySelector'](_0x15573c(0x2d1))[_0x15573c(0x3e1)]['split']('\x20(')[0x0];if(_0x135783[_0x15573c(0x265)](_0x15573c(0x23f))){const _0x5bdf91=_0x37c968[_0x15573c(0x30c)](_0x15573c(0x2d1))[_0x15573c(0x3e1)]['split']('\x20(')[0x0],_0x4b788f=prompt(_0x15573c(0x20b),_0x5bdf91);if(_0x4b788f&&_0x4b788f[_0x15573c(0x35c)]()&&_0x4b788f[_0x15573c(0x35c)]()!==_0x5bdf91)try{await _0x5a0ed1[_0x15573c(0x2f2)](_0x46a723,_0x4b788f,_0x31e3da),await updatePanelStatus();}catch(_0x4e04c2){log('重命名知识库\x20'+_0x5bdf91+_0x15573c(0x2b9)+_0x4e04c2[_0x15573c(0x415)],'error'),toastr['error']('重命名失败:\x20'+_0x4e04c2[_0x15573c(0x415)]);}return;}if(_0x135783[_0x15573c(0x2c4)][_0x15573c(0x310)](_0x15573c(0x356))){if(confirm(_0x15573c(0x31d)+_0x768d10+'】吗?此操作无法恢复!'))try{await _0x5a0ed1[_0x15573c(0x2e1)](_0x46a723,_0x31e3da),log('知识库\x20'+_0x768d10+_0x15573c(0x2a8)+_0x46a723+_0x15573c(0x21d),'success'),toastr[_0x15573c(0x224)](_0x15573c(0x3ad)+_0x768d10+_0x15573c(0x242)),await updatePanelStatus();}catch(_0x35f935){log(_0x15573c(0x2e7)+_0x768d10+_0x15573c(0x2b9)+_0x35f935[_0x15573c(0x415)],'error'),toastr[_0x15573c(0x282)](_0x15573c(0x249)+_0x35f935[_0x15573c(0x415)]);}}if(_0x135783[_0x15573c(0x265)](_0x15573c(0x388))){const _0x5f358e=_0x31e3da===_0x15573c(0x2ed)?'全局':'局部';if(confirm(_0x15573c(0x3e7)+_0x768d10+'】移动到【'+_0x5f358e+'】吗?'))try{await _0x5a0ed1[_0x15573c(0x315)](_0x46a723,_0x31e3da),await updatePanelStatus();}catch(_0x3be913){log(_0x15573c(0x313)+_0x768d10+_0x15573c(0x2b9)+_0x3be913['message'],_0x15573c(0x282)),toastr[_0x15573c(0x282)](_0x15573c(0x209)+_0x3be913[_0x15573c(0x415)]);}}if(_0x135783[_0x15573c(0x2c4)][_0x15573c(0x310)](_0x15573c(0x404))&&_0x2949b5[_0x15573c(0x31e)]==='change')try{await _0x5a0ed1[_0x15573c(0x2f0)](_0x46a723,_0x31e3da),log(_0x15573c(0x368)+_0x768d10+_0x15573c(0x39b),_0x15573c(0x224));}catch(_0x4ea435){log(_0x15573c(0x411)+_0x768d10+'\x20状态失败:\x20'+_0x4ea435[_0x15573c(0x415)],'error'),toastr[_0x15573c(0x282)]('切换状态失败:\x20'+_0x4ea435[_0x15573c(0x415)]),_0x135783['checked']=!_0x135783['checked'];}_0x135783[_0x15573c(0x2c4)]['contains']('hly-kb-item-checkbox')&&_0x2949b5[_0x15573c(0x31e)]===_0x15573c(0x1fc)&&updateBulkActionUI(_0x31e3da);}function handleSelectAll(_0x3d619a,_0xdc1be9){const _0x2e695f=_0x28d2da,_0x44b69a=_0x3d619a['target']['checked'],_0x57b2a8=document[_0x2e695f(0x214)](_0x2e695f(0x40b)+_0xdc1be9),_0x1a620a=_0x57b2a8[_0x2e695f(0x285)](_0x2e695f(0x362));_0x1a620a[_0x2e695f(0x3dd)](_0x2cbad1=>_0x2cbad1[_0x2e695f(0x3a9)]=_0x44b69a),updateBulkActionUI(_0xdc1be9);}function updateBulkActionUI(_0x24846e){const _0x51595c=_0x28d2da,_0x3812cc=document[_0x51595c(0x214)](_0x51595c(0x40b)+_0x24846e),_0x2ab30f=document[_0x51595c(0x214)](_0x51595c(0x389)+_0x24846e),_0x23a3df=document['getElementById'](_0x51595c(0x317)+_0x24846e),_0x1dc6f2=_0x3812cc['querySelectorAll'](_0x51595c(0x362)),_0x22870f=_0x3812cc[_0x51595c(0x285)](_0x51595c(0x405)),_0x4e8740=_0x22870f[_0x51595c(0x341)],_0x4bc76d=_0x1dc6f2[_0x51595c(0x341)];_0x4e8740>0x0?_0x2ab30f[_0x51595c(0x22b)][_0x51595c(0x3a8)]=_0x51595c(0x2f1):_0x2ab30f[_0x51595c(0x22b)][_0x51595c(0x3a8)]=_0x51595c(0x312);if(_0x4bc76d===0x0)_0x23a3df['checked']=![],_0x23a3df[_0x51595c(0x3be)]=![];else{if(_0x4e8740===_0x4bc76d)_0x23a3df[_0x51595c(0x3a9)]=!![],_0x23a3df[_0x51595c(0x3be)]=![];else _0x4e8740>0x0?(_0x23a3df[_0x51595c(0x3a9)]=![],_0x23a3df[_0x51595c(0x3be)]=!![]):(_0x23a3df[_0x51595c(0x3a9)]=![],_0x23a3df[_0x51595c(0x3be)]=![]);}}async function handleBulkAction(_0x1870d1,_0xa62ec3){const _0x4eab20=_0x28d2da,_0x2e9826=_0x1870d1[_0x4eab20(0x335)]['dataset']['action'];if(!_0x2e9826)return;const _0x19b794=document[_0x4eab20(0x214)](_0x4eab20(0x40b)+_0xa62ec3),_0x443bd2=_0x19b794[_0x4eab20(0x285)]('.hly-kb-item-checkbox:checked'),_0x413b68=Array[_0x4eab20(0x3fb)](_0x443bd2)[_0x4eab20(0x204)](_0x3002be=>_0x3002be[_0x4eab20(0x369)][_0x4eab20(0x3b0)]);if(_0x413b68[_0x4eab20(0x341)]===0x0){toastr[_0x4eab20(0x40a)](_0x4eab20(0x38f),'圣谕');return;}let _0x1fd9ac='',_0xc813,_0x2d9e1c='';switch(_0x2e9826){case _0x4eab20(0x2dd):_0x1fd9ac='您确定要永久删除选中的\x20'+_0x413b68[_0x4eab20(0x341)]+_0x4eab20(0x3bf),_0xc813=_0x3cdb61=>_0x5a0ed1[_0x4eab20(0x2e1)](_0x3cdb61,_0xa62ec3),_0x2d9e1c='成功删除了\x20'+_0x413b68[_0x4eab20(0x341)]+_0x4eab20(0x2e5);break;case _0x4eab20(0x25f):const _0x40895d=_0xa62ec3===_0x4eab20(0x2ed)?'全局':'局部';_0x1fd9ac=_0x4eab20(0x239)+_0x413b68['length']+_0x4eab20(0x3e0)+_0x40895d+_0x4eab20(0x336),_0xc813=_0x4544ff=>_0x5a0ed1[_0x4eab20(0x315)](_0x4544ff,_0xa62ec3),_0x2d9e1c=_0x4eab20(0x416)+_0x413b68[_0x4eab20(0x341)]+_0x4eab20(0x2e5);break;case _0x4eab20(0x29b):_0x1fd9ac=_0x4eab20(0x2b8)+_0x413b68[_0x4eab20(0x341)]+_0x4eab20(0x3ca),_0xc813=_0x9d6dee=>_0x5a0ed1[_0x4eab20(0x2f0)](_0x9d6dee,_0xa62ec3),_0x2d9e1c=_0x4eab20(0x2e6)+_0x413b68[_0x4eab20(0x341)]+_0x4eab20(0x3f3);break;default:return;}if(!confirm(_0x1fd9ac))return;toastr[_0x4eab20(0x390)](_0x4eab20(0x3c0)+_0x413b68[_0x4eab20(0x341)]+_0x4eab20(0x324),'圣旨'),log(_0x4eab20(0x3c4)+_0x413b68[_0x4eab20(0x341)]+_0x4eab20(0x33b)+_0xa62ec3+_0x4eab20(0x213)+_0x2e9826+'\x20操作...',_0x4eab20(0x390));try{const _0x3c4879=_0x413b68[_0x4eab20(0x204)](_0x56534b=>_0xc813(_0x56534b));await Promise[_0x4eab20(0x39d)](_0x3c4879),toastr[_0x4eab20(0x224)](_0x2d9e1c,_0x4eab20(0x201)),log('批量\x20'+_0x2e9826+_0x4eab20(0x3d3),'success');}catch(_0x4fce3c){toastr['error'](_0x4eab20(0x3f0)+_0x4fce3c[_0x4eab20(0x415)],'警报'),log(_0x4eab20(0x20d)+_0x2e9826+'\x20操作失败:\x20'+_0x4fce3c[_0x4eab20(0x415)],_0x4eab20(0x282));}finally{await updatePanelStatus();}}async function testApi(){const _0x2cf2bf=_0x28d2da;toastr['info'](_0x2cf2bf(0x220),'圣旨');try{await _0x5a0ed1[_0x2cf2bf(0x2f9)](),toastr[_0x2cf2bf(0x224)]('神力连接通畅!','圣意');}catch(_0x197973){toastr[_0x2cf2bf(0x282)](_0x2cf2bf(0x340)+_0x197973[_0x2cf2bf(0x415)],'警报');}}async function fetchHLYEmbeddingModels(){const _0x59a464=_0x28d2da,_0x57d860=document[_0x59a464(0x214)](_0x59a464(0x261)),_0x424e74=_0x57d860[_0x59a464(0x25e)];_0x57d860[_0x59a464(0x30a)]=_0x59a464(0x23c),_0x57d860[_0x59a464(0x298)]=!![];try{log('开始获取模型列表...','info');const _0xcbff8c=await _0x5a0ed1[_0x59a464(0x339)]();_0x57d860[_0x59a464(0x30a)]='';if(_0xcbff8c['length']===0x0){_0x57d860[_0x59a464(0x30a)]='<option>未找到模型</option>',toastr[_0x59a464(0x23d)](_0x59a464(0x34d),_0x59a464(0x294)),log(_0x59a464(0x34d),_0x59a464(0x23d));return;}_0xcbff8c[_0x59a464(0x3dd)](_0x5366f2=>{const _0x3e6a0c=new Option(_0x5366f2,_0x5366f2);_0x57d860['add'](_0x3e6a0c);}),_0xcbff8c[_0x59a464(0x252)](_0x424e74)?_0x57d860[_0x59a464(0x25e)]=_0x424e74:_0x57d860[_0x59a464(0x346)]=0x0,toastr['success'](_0x59a464(0x3ff)+_0xcbff8c[_0x59a464(0x341)]+_0x59a464(0x284),'圣意'),log(_0x59a464(0x3ff)+_0xcbff8c[_0x59a464(0x341)]+'\x20个模型。',_0x59a464(0x224));}catch(_0x31afbb){console[_0x59a464(0x282)](_0x59a464(0x40d),_0x31afbb),toastr[_0x59a464(0x282)](_0x59a464(0x24a)+_0x31afbb[_0x59a464(0x415)],_0x59a464(0x1f8)),log('获取模型失败:\x20'+_0x31afbb[_0x59a464(0x415)],_0x59a464(0x282)),_0x57d860[_0x59a464(0x30a)]=_0x59a464(0x367);}finally{_0x57d860['disabled']=![];}}async function fetchHLYRerankModels(){const _0x4bc037=_0x28d2da,_0x5a77d2=document[_0x4bc037(0x214)]('hly-rerank-model'),_0x5c4c7f=_0x5a77d2['value'];_0x5a77d2[_0x4bc037(0x30a)]=_0x4bc037(0x23c),_0x5a77d2['disabled']=!![];try{log('开始获取Rerank模型列表...',_0x4bc037(0x390));const _0x7f41c9=await _0x5a0ed1['fetchRerankModels']();_0x5a77d2[_0x4bc037(0x30a)]='';if(_0x7f41c9[_0x4bc037(0x341)]===0x0){_0x5a77d2[_0x4bc037(0x30a)]=_0x4bc037(0x3da),toastr[_0x4bc037(0x23d)](_0x4bc037(0x35e),_0x4bc037(0x294)),log(_0x4bc037(0x35e),'warn');return;}_0x7f41c9[_0x4bc037(0x3dd)](_0x3ab806=>{const _0x32eaaf=new Option(_0x3ab806,_0x3ab806);_0x5a77d2['add'](_0x32eaaf);}),_0x7f41c9[_0x4bc037(0x252)](_0x5c4c7f)?_0x5a77d2['value']=_0x5c4c7f:_0x5a77d2[_0x4bc037(0x346)]=0x0,toastr[_0x4bc037(0x224)]('成功获取\x20'+_0x7f41c9[_0x4bc037(0x341)]+_0x4bc037(0x3bd),'圣意'),log('成功获取\x20'+_0x7f41c9[_0x4bc037(0x341)]+'\x20个Rerank模型。',_0x4bc037(0x224));}catch(_0x5853a1){console[_0x4bc037(0x282)](_0x4bc037(0x398),_0x5853a1),toastr[_0x4bc037(0x282)](_0x4bc037(0x268)+_0x5853a1[_0x4bc037(0x415)],_0x4bc037(0x1f8)),log(_0x4bc037(0x268)+_0x5853a1[_0x4bc037(0x415)],_0x4bc037(0x282)),_0x5a77d2[_0x4bc037(0x30a)]=_0x4bc037(0x367);}finally{_0x5a77d2['disabled']=![];}}async function purgeStorage(){const _0x146c44=_0x28d2da;if(confirm('此操作将彻底清空当前角色的所有忆识(向量),且无法恢复。您确定要继续吗?')){toastr['info'](_0x146c44(0x2b6),'圣旨');const _0x36cd20=await _0x5a0ed1['purgeStorage']();_0x36cd20?toastr[_0x146c44(0x224)](_0x146c44(0x2f8),'圣意'):toastr[_0x146c44(0x282)](_0x146c44(0x3b7),'警报'),await updatePanelStatus();}}async function startCondensation(){const _0x3032a9=_0x28d2da,_0x406056=document[_0x3032a9(0x214)](_0x3032a9(0x2ce)),_0xea97d0=_0x406056['dataset']['finalMessages'],_0x1c7782=document[_0x3032a9(0x214)](_0x3032a9(0x2ad))[_0x3032a9(0x25e)],_0xf1843=document[_0x3032a9(0x214)]('hly-layer-end')['value'],_0x456d14={'start':parseInt(_0x1c7782),'end':parseInt(_0xf1843)};try{let _0x4c6b36;_0xea97d0?(log('检测到预览后待处理的消息对象,开始精确凝识...',_0x3032a9(0x390)),toastr['info'](_0x3032a9(0x38a),'圣旨'),_0x4c6b36=JSON['parse'](_0xea97d0),delete _0x406056['dataset'][_0x3032a9(0x372)]):(log('未检测到预览文本,按标准流程采集消息...',_0x3032a9(0x390)),toastr[_0x3032a9(0x390)](_0x3032a9(0x2ab),'圣旨'),_0x4c6b36=_0x5a0ed1[_0x3032a9(0x205)]());if(!_0x4c6b36||_0x4c6b36[_0x3032a9(0x341)]===0x0){toastr[_0x3032a9(0x40a)]('未找到符合条件的消息可供凝识。',_0x3032a9(0x294)),_0x406056[_0x3032a9(0x3e1)]=_0x3032a9(0x330);return;}_0x406056['textContent']=_0x3032a9(0x308)+_0x4c6b36[_0x3032a9(0x341)]+_0x3032a9(0x30f),toastr['info']('已采集\x20'+_0x4c6b36[_0x3032a9(0x341)]+_0x3032a9(0x30f),_0x3032a9(0x294));const _0x3ca729=await _0x5a0ed1[_0x3032a9(0x333)](_0x4c6b36,log,_0x456d14);if(_0x3ca729[_0x3032a9(0x224)]){toastr['success'](_0x3032a9(0x218)+_0x3ca729['count']+_0x3032a9(0x3f5),_0x3032a9(0x201));const _0xa6e99b=_0x456d14[_0x3032a9(0x2ee)]===0x0?getContext()[_0x3032a9(0x37e)][_0x3032a9(0x341)]:_0x456d14[_0x3032a9(0x2ee)];_0x406056[_0x3032a9(0x3e1)]=_0x3032a9(0x2af)+_0x456d14[_0x3032a9(0x412)]+_0x3032a9(0x258)+_0xa6e99b+_0x3032a9(0x253)+_0x3ca729[_0x3032a9(0x343)]+'\x20条忆识。';}else throw new Error(_0x3ca729[_0x3032a9(0x282)]||'未知错误');}catch(_0x1b6417){console[_0x3032a9(0x282)](_0x3032a9(0x2d5),_0x1b6417),toastr[_0x3032a9(0x282)]('凝识失败:\x20'+_0x1b6417['message'],_0x3032a9(0x1f8)),_0x406056[_0x3032a9(0x3e1)]='凝识失败:\x20'+_0x1b6417['message'];}finally{await updatePanelStatus();}}async function loadWorldbookList(){const _0x1d9af3=_0x28d2da,_0xc40cdb=document['getElementById'](_0x1d9af3(0x3c2)),_0x43c325=document[_0x1d9af3(0x214)]('hly-worldbook-search');if(!_0xc40cdb)return;try{log(_0x1d9af3(0x361),_0x1d9af3(0x390));const _0x511552=await _0x798f38[_0x1d9af3(0x208)]();window[_0x1d9af3(0x24d)]=_0x511552,updateWorldbookOptions(_0xc40cdb,'',_0x511552);if(_0x43c325){const _0x341d5f=debounce(_0x2c9f20=>{updateWorldbookOptions(_0xc40cdb,_0x2c9f20,_0x511552);},0x12c);_0x43c325[_0x1d9af3(0x29a)](_0x1d9af3(0x235),_0x30337c=>{const _0x362325=_0x1d9af3;_0x341d5f(_0x30337c[_0x362325(0x335)]['value']);});}log(_0x1d9af3(0x2f5)+_0x511552[_0x1d9af3(0x341)]+_0x1d9af3(0x225),_0x1d9af3(0x224));}catch(_0x4e7bfd){console[_0x1d9af3(0x282)](_0x1d9af3(0x3a0),_0x4e7bfd),log(_0x1d9af3(0x26b)+_0x4e7bfd[_0x1d9af3(0x415)],_0x1d9af3(0x282)),_0xc40cdb&&(_0xc40cdb[_0x1d9af3(0x30a)]=_0x1d9af3(0x348));}}function updateWorldbookOptions(_0x1ab03d,_0x48a496,_0x380b5c){const _0x29806c=_0x28d2da,_0x12bbd9=filterWorldbooks(_0x48a496,_0x380b5c),_0x468e7c=_0x1ab03d[_0x29806c(0x25e)];_0x1ab03d[_0x29806c(0x30a)]='<option\x20value=\x22\x22>请选择一个书库...</option>';if(_0x12bbd9[_0x29806c(0x341)]===0x0){_0x1ab03d[_0x29806c(0x30a)]=_0x48a496[_0x29806c(0x35c)]()?_0x29806c(0x3e9):_0x29806c(0x32e);return;}_0x12bbd9[_0x29806c(0x3dd)](_0x58323d=>{const _0x1904ec=_0x29806c,_0x2e8091=document[_0x1904ec(0x217)](_0x1904ec(0x20e));_0x2e8091[_0x1904ec(0x25e)]=_0x58323d,_0x2e8091[_0x1904ec(0x3e1)]=_0x58323d,_0x1ab03d[_0x1904ec(0x366)](_0x2e8091);}),_0x468e7c&&_0x12bbd9[_0x29806c(0x252)](_0x468e7c)&&(_0x1ab03d[_0x29806c(0x25e)]=_0x468e7c);}async function handleWorldbookSelectionChange(){const _0x317bdd=_0x28d2da,_0x55b3eb=document[_0x317bdd(0x214)](_0x317bdd(0x3c2)),_0x10e159=document['getElementById'](_0x317bdd(0x286)),_0x314b32=document[_0x317bdd(0x214)](_0x317bdd(0x375)),_0x3e8e0d=document[_0x317bdd(0x214)](_0x317bdd(0x241)),_0x18b27d=_0x55b3eb[_0x317bdd(0x25e)];_0x10e159[_0x317bdd(0x298)]=!![],_0x10e159['querySelector'](_0x317bdd(0x2cd))[_0x317bdd(0x3e1)]=_0x317bdd(0x3c8),_0x314b32[_0x317bdd(0x30a)]='',_0x314b32[_0x317bdd(0x22b)][_0x317bdd(0x3a8)]=_0x317bdd(0x312);_0x3e8e0d&&(_0x3e8e0d[_0x317bdd(0x25e)]='');if(!_0x18b27d){_0x10e159[_0x317bdd(0x30c)]('span')[_0x317bdd(0x3e1)]=_0x317bdd(0x2d7);return;}try{log(_0x317bdd(0x2c9)+_0x18b27d+_0x317bdd(0x292),_0x317bdd(0x390));const _0x3673c0=await _0x798f38['getLoresForWorldbook'](_0x18b27d);if(_0x3673c0['length']===0x0){_0x10e159[_0x317bdd(0x30c)](_0x317bdd(0x2cd))['textContent']=_0x317bdd(0x3b5);return;}window[_0x317bdd(0x302)]=_0x3673c0,updateEntryOptions('',_0x3673c0);if(_0x3e8e0d){_0x3e8e0d[_0x317bdd(0x3a3)]('input',_0x3e8e0d[_0x317bdd(0x410)]);const _0x22638e=debounce(_0x5d2f73=>{updateEntryOptions(_0x5d2f73,_0x3673c0);},0x12c);_0x3e8e0d[_0x317bdd(0x410)]=_0x331f66=>{const _0x4855ec=_0x317bdd;_0x22638e(_0x331f66[_0x4855ec(0x335)]['value']);},_0x3e8e0d[_0x317bdd(0x29a)]('input',_0x3e8e0d[_0x317bdd(0x410)]);}log(_0x317bdd(0x2f5)+_0x3673c0[_0x317bdd(0x341)]+_0x317bdd(0x279),'success');}catch(_0x1d9eb0){console[_0x317bdd(0x282)](_0x317bdd(0x3fc)+_0x18b27d+_0x317bdd(0x309),_0x1d9eb0),log('加载条目失败:\x20'+_0x1d9eb0[_0x317bdd(0x415)],_0x317bdd(0x282)),_0x10e159[_0x317bdd(0x30c)](_0x317bdd(0x2cd))[_0x317bdd(0x3e1)]=_0x317bdd(0x3f4);}finally{_0x10e159[_0x317bdd(0x298)]=![];}}function updateEntryOptions(_0x32cadc,_0x408bcd){const _0x1c56bb=_0x28d2da,_0x4245ea=document['getElementById'](_0x1c56bb(0x375)),_0x1f8be3=document[_0x1c56bb(0x214)]('hly-hist-entry-multiselect-btn'),_0x268ecd=filterWorldbookEntries(_0x32cadc,_0x408bcd);_0x4245ea[_0x1c56bb(0x30a)]='';const _0x3c688c='\x0a\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<input\x20type=\x22checkbox\x22\x20id=\x22hly-hist-select-all-entries\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<strong>全选/全不选</strong>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</label>';_0x4245ea[_0x1c56bb(0x231)](_0x1c56bb(0x1f5),_0x3c688c);if(_0x268ecd[_0x1c56bb(0x341)]===0x0){const _0x4f4fc3=_0x1c56bb(0x376);_0x4245ea[_0x1c56bb(0x231)](_0x1c56bb(0x1f5),_0x4f4fc3),_0x1f8be3['querySelector'](_0x1c56bb(0x2cd))[_0x1c56bb(0x3e1)]=_0x1c56bb(0x2e8);return;}_0x268ecd[_0x1c56bb(0x3dd)](_0x475e32=>{const _0x429275=_0x1c56bb,_0x4143e3=_0x32cadc?highlightSearchMatch(_0x475e32[_0x429275(0x3e8)],_0x32cadc):_0x475e32[_0x429275(0x3e8)],_0x442cc1=_0x429275(0x3eb)+_0x475e32[_0x429275(0x3e8)]+'\x20(Key:\x20'+_0x475e32[_0x429275(0x203)]+_0x429275(0x37b)+_0x475e32[_0x429275(0x203)]+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>'+_0x4143e3+_0x429275(0x233);_0x4245ea[_0x429275(0x231)](_0x429275(0x1f5),_0x442cc1);}),_0x1f8be3['querySelector']('span')[_0x1c56bb(0x3e1)]='已选择\x200\x20/\x20'+_0x268ecd['length']+_0x1c56bb(0x37c);}async function startHistoriography(){const _0x5ca924=_0x28d2da,_0x41eb45=document['getElementById'](_0x5ca924(0x3c2))[_0x5ca924(0x25e)],_0x225cfd=document[_0x5ca924(0x214)](_0x5ca924(0x375)),_0x52164b=document[_0x5ca924(0x214)](_0x5ca924(0x264)),_0x29394a=Array[_0x5ca924(0x3fb)](_0x225cfd['querySelectorAll']('.hly-hist-entry-checkbox:checked'))['map'](_0x38a306=>_0x38a306[_0x5ca924(0x25e)]);if(!_0x41eb45||_0x29394a['length']===0x0){toastr[_0x5ca924(0x40a)](_0x5ca924(0x378),_0x5ca924(0x3a6));return;}_0x52164b['textContent']=_0x5ca924(0x323)+_0x41eb45+_0x5ca924(0x3c1)+_0x29394a[_0x5ca924(0x341)]+_0x5ca924(0x40c),toastr[_0x5ca924(0x390)]('批量编纂任务已开始...','圣旨'),log(_0x5ca924(0x377)+_0x41eb45+_0x5ca924(0x3c1)+_0x29394a[_0x5ca924(0x341)]+_0x5ca924(0x3d4),_0x5ca924(0x390));try{const _0xe741a8=await _0x798f38[_0x5ca924(0x32f)](_0x41eb45,_0x29394a);_0x52164b[_0x5ca924(0x3e1)]=_0xe741a8[_0x5ca924(0x3b2)],_0xe741a8[_0x5ca924(0x224)]?toastr[_0x5ca924(0x224)](_0x5ca924(0x29c),'大功告成'):toastr['warning'](_0x5ca924(0x3a4),'圣谕'),log('对《'+_0x41eb45+_0x5ca924(0x250)+_0xe741a8['totalSuccess']+_0x5ca924(0x33e)+_0xe741a8[_0x5ca924(0x273)],_0x5ca924(0x224));}catch(_0x295926){console[_0x5ca924(0x282)](_0x5ca924(0x36a),_0x295926),toastr[_0x5ca924(0x282)](_0x5ca924(0x290)+_0x295926[_0x5ca924(0x415)],_0x5ca924(0x1f8)),_0x52164b['textContent']=_0x5ca924(0x290)+_0x295926['message'];}finally{await updatePanelStatus();}}async function showStats(){const _0x2eac30=_0x28d2da;try{log(_0x2eac30(0x3ce),'info'),toastr[_0x2eac30(0x390)](_0x2eac30(0x347),'圣旨');const _0x442c90=await _0x5a0ed1[_0x2eac30(0x32c)](),_0x4bf186=await _0x5a0ed1[_0x2eac30(0x2d3)](),_0x495c47=_0x5a0ed1[_0x2eac30(0x22a)](),_0x5e05b5='\x0a<pre>\x0a翰林院宝库状态\x0a--------------------\x0a集合ID:\x20'+_0x4bf186+_0x2eac30(0x22f)+_0x442c90+_0x2eac30(0x25d)+_0x495c47[_0x2eac30(0x380)][_0x2eac30(0x25b)]+'\x0a所用模型:\x20'+_0x495c47['retrieval'][_0x2eac30(0x35b)]+_0x2eac30(0x39c);toastr['info'](_0x5e05b5,_0x2eac30(0x311),{'timeOut':0x3a98,'extendedTimeOut':0x1388,'tapToDismiss':!![],'closeButton':!![]}),log('查看宝库状态成功集合ID='+_0x4bf186+_0x2eac30(0x381)+_0x442c90,_0x2eac30(0x224));}catch(_0x4be326){console['error'](_0x2eac30(0x2b3),_0x4be326),toastr[_0x2eac30(0x282)](_0x2eac30(0x27a)+_0x4be326[_0x2eac30(0x415)],_0x2eac30(0x1f8)),log('查询宝库状态失败:\x20'+_0x4be326['message'],_0x2eac30(0x282));}}function showRulesModal(_0x13e2f7){const _0x28fbc9=_0x28d2da,_0x3b2d01=_0x5a0ed1['getSettings'](),_0x4f2d11=_0x3b2d01[_0x13e2f7];if(!_0x4f2d11){console[_0x28fbc9(0x282)](_0x28fbc9(0x31b)+_0x13e2f7+_0x28fbc9(0x21f));return;}const _0x1a3ef3=_0x13e2f7===_0x28fbc9(0x2ec)?_0x28fbc9(0x3f7):_0x28fbc9(0x32a),_0x27f247=_0x4f2d11['exclusionRules']||[],_0x142892=(_0x3b8cd4={'start':'','end':''},_0x568e6c)=>_0x28fbc9(0x37f)+_0x568e6c+_0x28fbc9(0x29f)+(_0x3b8cd4[_0x28fbc9(0x412)]||'')['replace'](/"/g,'\x22')+_0x28fbc9(0x3b8)+(_0x3b8cd4[_0x28fbc9(0x2ee)]||'')[_0x28fbc9(0x2fb)](/"/g,'\x22')+_0x28fbc9(0x227),_0x40225e=_0x27f247[_0x28fbc9(0x204)](_0x142892)['join'](''),_0x5b4381=_0x13e2f7===_0x28fbc9(0x2bb)?_0x28fbc9(0x20f)+(_0x4f2d11[_0x28fbc9(0x3d2)]?_0x28fbc9(0x3a9):'')+_0x28fbc9(0x2b7)+(_0x4f2d11['tagExtractionEnabled']?_0x28fbc9(0x307):_0x28fbc9(0x312))+_0x28fbc9(0x2f7)+(_0x4f2d11[_0x28fbc9(0x3ac)]||'')+_0x28fbc9(0x38c):'',_0x9e2b71=_0x28fbc9(0x3fe)+_0x5b4381+_0x28fbc9(0x3e4)+(_0x40225e[_0x28fbc9(0x341)]>0x0?_0x40225e:_0x28fbc9(0x28c))+_0x28fbc9(0x2c8);showHtmlModal(_0x1a3ef3,_0x9e2b71,{'okText':_0x28fbc9(0x212),'onOk':_0x44256b=>{const _0x4d1ee0=_0x28fbc9,_0x108c96=[];_0x44256b[_0x4d1ee0(0x26a)](_0x4d1ee0(0x2ff))[_0x4d1ee0(0x2ea)](function(){const _0x3242f9=_0x4d1ee0,_0x365829=$(this)['find'](_0x3242f9(0x235))['eq'](0x0)[_0x3242f9(0x2f6)]()[_0x3242f9(0x35c)](),_0x4651ee=$(this)[_0x3242f9(0x26a)](_0x3242f9(0x235))['eq'](0x1)['val']()[_0x3242f9(0x35c)]();_0x365829&&_0x108c96['push']({'start':_0x365829,'end':_0x4651ee});});const _0x2066c9={..._0x4f2d11,'exclusionRules':_0x108c96};_0x13e2f7==='queryPreprocessing'&&(_0x2066c9[_0x4d1ee0(0x3d2)]=_0x44256b['find'](_0x4d1ee0(0x1f9))['is'](':checked'),_0x2066c9['tags']=_0x44256b[_0x4d1ee0(0x26a)](_0x4d1ee0(0x223))[_0x4d1ee0(0x2f6)]()),updateAndSaveSetting(_0x13e2f7,_0x2066c9),toastr[_0x4d1ee0(0x224)](_0x4d1ee0(0x2bc),_0x4d1ee0(0x303));},'onShow':_0x38a410=>{const _0x168f88=_0x28fbc9,_0x1e02ae=_0x38a410[_0x168f88(0x26a)](_0x168f88(0x2e4));_0x38a410[_0x168f88(0x26a)](_0x168f88(0x370))['on'](_0x168f88(0x39f),()=>{const _0x18ca7e=_0x168f88,_0x29d616=_0x1e02ae[_0x18ca7e(0x379)](_0x18ca7e(0x2ff))[_0x18ca7e(0x341)],_0x52521d=_0x142892(undefined,_0x29d616);_0x1e02ae[_0x18ca7e(0x26a)]('p')[_0x18ca7e(0x341)]>0x0?_0x1e02ae['html'](_0x52521d):_0x1e02ae[_0x18ca7e(0x40e)](_0x52521d);}),_0x1e02ae['on'](_0x168f88(0x39f),'.hly-delete-rule-btn',function(){const _0x5bdc6f=_0x168f88;$(this)[_0x5bdc6f(0x265)]('.hly-exclusion-rule-row')[_0x5bdc6f(0x21a)](),_0x1e02ae[_0x5bdc6f(0x379)]()[_0x5bdc6f(0x341)]===0x0&&_0x1e02ae[_0x5bdc6f(0x3ae)](_0x5bdc6f(0x28c));});if(_0x13e2f7===_0x168f88(0x2bb)){const _0x1931b4=_0x38a410[_0x168f88(0x26a)](_0x168f88(0x1f9)),_0x3f392b=_0x38a410[_0x168f88(0x26a)](_0x168f88(0x306));_0x1931b4['on'](_0x168f88(0x1fc),()=>{const _0x1bd41a=_0x168f88;_0x3f392b[_0x1bd41a(0x407)](_0x1bd41a(0x3a8),_0x1931b4['is'](':checked')?_0x1bd41a(0x307):_0x1bd41a(0x312));});}}});}function previewCondensation(){const _0x458e46=_0x28d2da,_0x4c9029=document[_0x458e46(0x214)](_0x458e46(0x2ce));try{const _0x2ef694=_0x5a0ed1[_0x458e46(0x22a)](),_0x40ec63=_0x2ef694['condensation'][_0x458e46(0x246)]||[],_0x23701a={'user':document['getElementById'](_0x458e46(0x383))[_0x458e46(0x3a9)],'ai':document[_0x458e46(0x214)](_0x458e46(0x221))['checked']},_0x37b140=document[_0x458e46(0x214)](_0x458e46(0x304))[_0x458e46(0x3a9)],_0x9c7f3e=_0x37b140?document['getElementById'](_0x458e46(0x34a))[_0x458e46(0x25e)][_0x458e46(0x3d5)](',')[_0x458e46(0x204)](_0x585f5d=>_0x585f5d[_0x458e46(0x35c)]())[_0x458e46(0x37a)](Boolean):[],_0x202b71=_0x5a0ed1[_0x458e46(0x205)](_0x23701a);if(!_0x202b71||_0x202b71[_0x458e46(0x341)]===0x0){_0x4c9029[_0x458e46(0x3e1)]=_0x458e46(0x3f8),toastr['warning'](_0x458e46(0x330),_0x458e46(0x294));return;}const _0x2c920a=getContext()[_0x458e46(0x37e)],_0x2e206f=_0x202b71['map']((_0x509ca6,_0x313c14)=>{const _0x4d55ed=_0x458e46;let _0xcb6b01;if(_0x509ca6[_0x4d55ed(0x2a7)])_0xcb6b01=_0x509ca6['mes'];else{if(_0x37b140&&_0x9c7f3e[_0x4d55ed(0x341)]>0x0){const _0x59fb00=extractBlocksByTags(_0x509ca6[_0x4d55ed(0x3f2)],_0x9c7f3e);_0x59fb00[_0x4d55ed(0x341)]>0x0?_0xcb6b01=_0x59fb00[_0x4d55ed(0x293)]('\x0a\x0a'):_0xcb6b01=_0x509ca6[_0x4d55ed(0x3f2)];}else _0xcb6b01=_0x509ca6['mes'];_0xcb6b01=applyExclusionRules(_0xcb6b01,_0x40ec63);}const _0xb852d=_0x2c920a[_0x4d55ed(0x401)](_0x12ac4f=>_0x12ac4f===_0x509ca6),_0x1fac31=_0xb852d!==-0x1?_0xb852d+0x1:-0x1;return{'id':_0x4d55ed(0x3d8)+_0x313c14,'name':_0x509ca6['name'],'content':_0xcb6b01[_0x4d55ed(0x35c)](),'floor':_0x1fac31,'is_user':_0x509ca6['is_user'],'send_date':_0x509ca6[_0x4d55ed(0x3d9)]};})[_0x458e46(0x37a)](_0x47c90a=>_0x47c90a[_0x458e46(0x3b2)]);if(_0x2e206f[_0x458e46(0x341)]===0x0){_0x4c9029[_0x458e46(0x3e1)]=_0x458e46(0x2cb),toastr[_0x458e46(0x40a)](_0x458e46(0x2cb),'翰林院启奏');return;}const _0x39226c=_0x2e206f['map']((_0x6f4bad,_0x3add8f)=>_0x458e46(0x35f)+_0x6f4bad['id']+_0x458e46(0x393)+_0x6f4bad[_0x458e46(0x28b)]+_0x458e46(0x237)+_0x6f4bad['name']+']\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'+_0x6f4bad['floor']+_0x458e46(0x322)+_0x6f4bad[_0x458e46(0x2a7)]+_0x458e46(0x301)+_0x6f4bad[_0x458e46(0x3d9)]+'\x22>'+_0x6f4bad[_0x458e46(0x3b2)]+_0x458e46(0x26f)+_0x6f4bad['id']+'\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')['join']('');showHtmlModal(_0x458e46(0x238),'<div\x20class=\x22hly-preview-container-v2\x22>'+_0x39226c+_0x458e46(0x2da),{'okText':'确认并更新预览','onOk':_0x2c3069=>{const _0x841267=_0x458e46,_0x528e12=[];_0x2c3069[_0x841267(0x26a)](_0x841267(0x329))[_0x841267(0x2ea)](function(){const _0x34b133=_0x841267,_0x15cfb7=$(this)[_0x34b133(0x26a)]('.hly-preview-textarea'),_0x5df252=_0x15cfb7[_0x34b133(0x2f6)]();_0x5df252[_0x34b133(0x35c)]()&&_0x528e12[_0x34b133(0x3b1)]({'mes':_0x5df252,'is_user':_0x15cfb7[_0x34b133(0x33f)](_0x34b133(0x21b)),'send_date':_0x15cfb7[_0x34b133(0x33f)](_0x34b133(0x23e)),'floor':_0x15cfb7[_0x34b133(0x33f)](_0x34b133(0x28b))});}),_0x4c9029[_0x841267(0x369)]['finalMessages']=JSON[_0x841267(0x338)](_0x528e12);const _0x556b93=document[_0x841267(0x214)]('hly-layer-start')[_0x841267(0x25e)],_0x58fd2b=document['getElementById'](_0x841267(0x1fb))[_0x841267(0x25e)];_0x4c9029['textContent']=_0x841267(0x27e)+_0x556b93+'\x20楼到\x20'+_0x58fd2b+_0x841267(0x2cc)+_0x528e12[_0x841267(0x341)]+_0x841267(0x314),toastr[_0x841267(0x224)](_0x841267(0x22c),_0x841267(0x303));}}),$(_0x458e46(0x2df))['on'](_0x458e46(0x39f),function(_0x49f34d){const _0x38da5c=_0x458e46;_0x49f34d[_0x38da5c(0x358)]();const _0x251f37=$(this)[_0x38da5c(0x33f)]('target');$('#'+_0x251f37)[_0x38da5c(0x21a)]();});}catch(_0x2b02a5){console[_0x458e46(0x282)]('[翰林院-枢纽]\x20预览过程发生错误:',_0x2b02a5),_0x4c9029['textContent']=_0x458e46(0x414)+_0x2b02a5[_0x458e46(0x415)],toastr[_0x458e46(0x282)](_0x458e46(0x414)+_0x2b02a5[_0x458e46(0x415)],_0x458e46(0x1f8));}}function log(_0x166e51,_0xc66294='info'){const _0x49d55b=_0x28d2da,_0x542375=document[_0x49d55b(0x214)](_0x49d55b(0x2a6));if(!_0x542375)return;const _0x4e3ca6=document[_0x49d55b(0x217)]('p'),_0x5748dd=new Date()[_0x49d55b(0x202)]();let _0x1427fd='fa-circle-info',_0x5bd2c1='log-info';switch(_0xc66294){case _0x49d55b(0x224):_0x1427fd=_0x49d55b(0x26e),_0x5bd2c1='log-success';break;case _0x49d55b(0x282):_0x1427fd=_0x49d55b(0x245),_0x5bd2c1=_0x49d55b(0x297);break;case _0x49d55b(0x23d):_0x1427fd='fa-exclamation-triangle',_0x5bd2c1=_0x49d55b(0x3ed);break;}_0x4e3ca6[_0x49d55b(0x2b4)]='hly-log-entry\x20'+_0x5bd2c1,_0x4e3ca6[_0x49d55b(0x30a)]=_0x49d55b(0x396)+_0x1427fd+_0x49d55b(0x345)+_0x5748dd+']\x20'+_0x166e51;const _0x20be44=_0x542375['querySelector'](_0x49d55b(0x2d6));_0x20be44&&_0x20be44[_0x49d55b(0x21a)](),_0x542375[_0x49d55b(0x366)](_0x4e3ca6),_0x542375[_0x49d55b(0x352)]=_0x542375[_0x49d55b(0x355)];}async function ingestManualText(){const _0x89a971=_0x28d2da,_0x10390b=document[_0x89a971(0x214)]('hly-manual-text'),_0x47a55b=_0x10390b['value'][_0x89a971(0x35c)]();if(!_0x47a55b){toastr['warning'](_0x89a971(0x38d),_0x89a971(0x294)),log(_0x89a971(0x359),'warn');return;}log('收到手动录入请求,文本长度:\x20'+_0x47a55b[_0x89a971(0x341)],'info'),toastr['info']('正在处理您提交的文书...','圣旨');try{const _0xdee09d=await _0x5a0ed1[_0x89a971(0x1f3)](_0x47a55b,'manual',{'sourceName':_0x89a971(0x2c1)});if(_0xdee09d['success'])toastr[_0x89a971(0x224)](_0x89a971(0x37d)+_0xdee09d[_0x89a971(0x343)]+_0x89a971(0x3f5),_0x89a971(0x201)),log(_0x89a971(0x39a)+_0xdee09d[_0x89a971(0x343)]+'\x20条忆识。',_0x89a971(0x224)),_0x10390b[_0x89a971(0x25e)]='';else throw new Error(_0xdee09d[_0x89a971(0x282)]||_0x89a971(0x24e));}catch(_0x3af794){console['error'](_0x89a971(0x29d),_0x3af794),toastr['error'](_0x89a971(0x326)+_0x3af794[_0x89a971(0x415)],'严重错误'),log(_0x89a971(0x2a5)+_0x3af794['message'],_0x89a971(0x282));}finally{await updatePanelStatus();}}