From 90fefdeb6a101c93ba82150c6213fabd92395ebe Mon Sep 17 00:00:00 2001 From: Wx-2025 <351320169@qq.com> Date: Thu, 28 Aug 2025 19:36:28 +0800 Subject: [PATCH] Update historiography-bindings.js --- ui/historiography-bindings.js | 389 +++++++++++++++++++++++++++++++++- 1 file changed, 388 insertions(+), 1 deletion(-) diff --git a/ui/historiography-bindings.js b/ui/historiography-bindings.js index aad93b3..97caef5 100644 --- a/ui/historiography-bindings.js +++ b/ui/historiography-bindings.js @@ -1 +1,388 @@ -function _0x40fb(_0x54c610,_0x5ead80){const _0x409883=_0x4098();return _0x40fb=function(_0x40fb0f,_0x8306d5){_0x40fb0f=_0x40fb0f-0x126;let _0x23d2dd=_0x409883[_0x40fb0f];return _0x23d2dd;},_0x40fb(_0x54c610,_0x5ead80);}(function(_0x1221bb,_0x3e552e){const _0x1b58fb=_0x40fb,_0x28e0ea=_0x1221bb();while(!![]){try{const _0x3d5565=parseInt(_0x1b58fb(0x191))/0x1*(-parseInt(_0x1b58fb(0x187))/0x2)+parseInt(_0x1b58fb(0x197))/0x3*(-parseInt(_0x1b58fb(0x161))/0x4)+-parseInt(_0x1b58fb(0x150))/0x5+-parseInt(_0x1b58fb(0x174))/0x6+-parseInt(_0x1b58fb(0x140))/0x7+-parseInt(_0x1b58fb(0x138))/0x8+parseInt(_0x1b58fb(0x16f))/0x9;if(_0x3d5565===_0x3e552e)break;else _0x28e0ea['push'](_0x28e0ea['shift']());}catch(_0x363a2c){_0x28e0ea['push'](_0x28e0ea['shift']());}}}(_0x4098,0x82542));import{extension_settings}from'/scripts/extensions.js';import{extensionName,defaultSettings,saveSettings}from'../utils/settings.js';import{showHtmlModal}from'./page-window.js';import{applyExclusionRules,extractBlocksByTags}from'../core/utils/rag-tag-extractor.js';import{getAvailableWorldbooks,getLoresForWorldbook,executeManualSummary,executeRefinement,executeExpedition,stopExpedition}from'../core/historiographer.js';function _0x4098(){const _0x45c8fb=['closest','远征阈值必须是大于0的数字。已重置。','amily2_vectorize_summary_content','appendChild','className','historiography-exclusion-rules-btn','historiography-exclusion-rules-container','getElementById','menu_button\x20small_button\x20interactable\x20success','createElement','trim','116fcgudw','amily2_mhb_large_worldbook_selector','historiographyWriteToLorebook','请输入有效的起始和结束楼层!','\x20继续远征','微言录','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20保存并关闭取消\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20在这里定义需要从提取内容中排除的文本片段。例如,排除HTML注释,可以设置开始字符为\x20``。

\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x22\x20placeholder=\x22结束字符,\x20如\x20-->\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20×\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20','.popup-button-cancel','40183956DfuqUv','body','insertAdjacentHTML','amily2_mhb_large_lore_selector','map','4185822SwTbhQ','_expand_editor','warning','textContent','\x20停止远征','textarea','historiography_ingest_to_rag','value','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20添加新规则\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20','end','showModal','编辑内容排除规则','display','none','val','amily2_mhb_small_expedition_execute','each','remove','checked','1544468eFGsAr','innerHTML','change','detail','amily2_mhb_small_trigger_count','join','running','selectedIndex','menu_button\x20small_button\x20interactable','style','1yMpsEv','historiographySmallAutoEnable','querySelector','historiographySmallSummaryPrompt','historiographyIngestToRag','historiographyTags','12771esyVxq','historiographyAutoSummaryInteractive','children','宏史卷','amily2_mhb_small_auto_enabled','圣谕有误','historiography_auto_summary_interactive','正在检阅史册...','\x22\x20placeholder=\x22开始字符,\x20如\x20"> + + + `; + + const rulesHtml = rules.map(createRuleRowHtml).join(''); + + const modalHtml = ` +
+

在这里定义需要从提取内容中排除的文本片段。例如,排除HTML注释,可以设置开始字符为 \`\`。

+
${rulesHtml}
+ +
+ + `; + + showHtmlModal('编辑内容排除规则', modalHtml, { + okText: '保存规则', + onOk: (dialogElement) => { + const newRules = []; + dialogElement.find('.hly-exclusion-rule-row').each(function() { + const start = $(this).find('input').eq(0).val().trim(); + const end = $(this).find('input').eq(1).val().trim(); + if (start && end) { + newRules.push({ start, end }); + } + }); + extension_settings[extensionName].historiographyExclusionRules = newRules; + saveSettings(); + toastr.success('内容排除规则已保存。', '圣旨已达'); + }, + onShow: (dialogElement) => { + const rulesList = dialogElement.find('#historiography-rules-list'); + + dialogElement.find('#historiography-add-rule-btn').on('click', () => { + const newIndex = rulesList.children().length; + const newRowHtml = createRuleRowHtml({ start: '', end: '' }, newIndex); + rulesList.append(newRowHtml); + }); + + rulesList.on('click', '.hly-delete-rule-btn', function() { + $(this).closest('.hly-exclusion-rule-row').remove(); + }); + } + }); +}