mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 11:35:50 +00:00
2 lines
4.9 KiB
JavaScript
2 lines
4.9 KiB
JavaScript
(function(_0x3301ce,_0x5a131b){const _0x25fc6c=_0x5838,_0x256792=_0x3301ce();while(!![]){try{const _0x3521e9=-parseInt(_0x25fc6c(0x1e7))/0x1*(parseInt(_0x25fc6c(0x1e3))/0x2)+-parseInt(_0x25fc6c(0x201))/0x3+-parseInt(_0x25fc6c(0x1ed))/0x4+-parseInt(_0x25fc6c(0x1fb))/0x5*(-parseInt(_0x25fc6c(0x1fa))/0x6)+-parseInt(_0x25fc6c(0x204))/0x7+parseInt(_0x25fc6c(0x1f6))/0x8*(-parseInt(_0x25fc6c(0x207))/0x9)+parseInt(_0x25fc6c(0x208))/0xa;if(_0x3521e9===_0x5a131b)break;else _0x256792['push'](_0x256792['shift']());}catch(_0x313ef5){_0x256792['push'](_0x256792['shift']());}}}(_0x305c,0x88704));import{getContext,extension_settings}from'/scripts/extensions.js';import{saveChatConditional}from'/script.js';import{extensionName}from'../utils/settings.js';import*as _0xaaaca8 from'./table-system/manager.js';import*as _0x188ba2 from'./table-system/executor.js';import{renderTables}from'../ui/table-bindings.js';function _0x305c(){const _0x1a4418=['loadTables','substring','【监察系统-步骤1】为消息\x20','optimizationEnabled','refresh','contextMessages','7061864XRZrCA','【监察系统-步骤2】推演完毕。是否有变化:\x20','chat','setMemoryState','5389086PHgMOW','5WESHMQ','【监察系统】消息\x20ID:\x20','max','enabled','\x20加载了基准状态。','[Amily2号]\x20检测到消息并非AI对用户的直接回复,已跳过优化。','973974uJNQSO','executeCommands','warn','1873480ZbaaSD','info','optimizationMode','9tTwoKx','23189140loxsWN','【监察系统-步骤3】检测到变化,已将新状态写入消息\x20','【监察系统】正在处理的奏折内容:\x20\x22',',流程中止。','optimizedContent','log','saveStateToMessage','2bLIkNz','【监察系统-步骤3】未检测到有效指令或变化,无需写入。','error','length','657203cgzKXu','success','mes','...\x22','is_user','apiUrl','2104036RaPlBF','slice','\x20是用户消息,无需处理。'];_0x305c=function(){return _0x1a4418;};return _0x305c();}import{log}from'./table-system/logger.js';async function handleTableUpdate(_0x3abbe1){const _0x12c4e6=_0x5838;log('【监察系统】接到圣旨,开始处理消息\x20ID:\x20'+_0x3abbe1,_0x12c4e6(0x203));const _0x110ec2=getContext(),_0x4ae586=_0x110ec2[_0x12c4e6(0x1f8)][_0x3abbe1];if(!_0x4ae586){log('【监察系统】错误:未找到消息\x20ID:\x20'+_0x3abbe1+_0x12c4e6(0x20b),_0x12c4e6(0x1e5));return;}if(_0x4ae586[_0x12c4e6(0x1eb)]){log(_0x12c4e6(0x1fc)+_0x3abbe1+_0x12c4e6(0x1ef),_0x12c4e6(0x205));return;}log(_0x12c4e6(0x20a)+_0x4ae586[_0x12c4e6(0x1e9)][_0x12c4e6(0x1f1)](0x0,0x32)+_0x12c4e6(0x1ea),_0x12c4e6(0x205));const _0x5d650f=_0xaaaca8[_0x12c4e6(0x1f0)](_0x3abbe1);log(_0x12c4e6(0x1f2)+_0x3abbe1+_0x12c4e6(0x1ff),_0x12c4e6(0x205),_0x5d650f);const {finalState:_0x3ee0cb,hasChanges:_0x28871a}=_0x188ba2[_0x12c4e6(0x202)](_0x4ae586[_0x12c4e6(0x1e9)],_0x5d650f);log(_0x12c4e6(0x1f7)+_0x28871a,_0x12c4e6(0x205),_0x3ee0cb),_0x28871a?(_0xaaaca8[_0x12c4e6(0x1e2)](_0x3ee0cb,_0x4ae586),_0xaaaca8[_0x12c4e6(0x1f9)](_0x3ee0cb),await saveChatConditional(),log(_0x12c4e6(0x209)+_0x3abbe1+'\x20并保存。',_0x12c4e6(0x1e8))):log(_0x12c4e6(0x1e4),_0x12c4e6(0x205)),renderTables();}import{checkAndFixWithAPI}from'./api.js';import{executeAutoHide}from'./autoHideManager.js';function _0x5838(_0x32597a,_0x26bc22){const _0x305ce1=_0x305c();return _0x5838=function(_0x58383a,_0x1708a8){_0x58383a=_0x58383a-0x1e1;let _0x2b95e8=_0x305ce1[_0x58383a];return _0x2b95e8;},_0x5838(_0x32597a,_0x26bc22);}import{checkAndTriggerAutoSummary}from'./historiographer.js';export async function onMessageReceived(_0x2cd466){const _0x2ab7b1=_0x5838,_0x5638d3=getContext();if(_0x2cd466&&_0x2cd466[_0x2ab7b1(0x1eb)]||_0x5638d3['isWaitingForUserInput'])return;const _0x33c3c2=extension_settings[extensionName],_0x2b0732=_0x5638d3[_0x2ab7b1(0x1f8)];if(!_0x2b0732||_0x2b0732['length']===0x0)return;const _0x54f1f2=_0x2b0732[_0x2b0732[_0x2ab7b1(0x1e6)]-0x1];if(_0x54f1f2['is_user'])return;await executeAutoHide();const _0x5726b1=_0x33c3c2[_0x2ab7b1(0x1fe)]&&_0x33c3c2[_0x2ab7b1(0x1f3)]&&_0x33c3c2[_0x2ab7b1(0x1ec)];if(_0x5726b1){if(_0x2b0732[_0x2ab7b1(0x1e6)]>=0x2&&_0x2b0732[_0x2b0732[_0x2ab7b1(0x1e6)]-0x2][_0x2ab7b1(0x1eb)]){const _0x37f82f=_0x33c3c2[_0x2ab7b1(0x1f5)]||0x2,_0x498824=Math[_0x2ab7b1(0x1fd)](0x0,_0x2b0732[_0x2ab7b1(0x1e6)]-0x1-_0x37f82f),_0x54401b=_0x2b0732[_0x2ab7b1(0x1ee)](_0x498824,_0x2b0732[_0x2ab7b1(0x1e6)]-0x1),_0x5b2396=await checkAndFixWithAPI(_0x54f1f2,_0x54401b);_0x5b2396&&_0x5b2396[_0x2ab7b1(0x20c)]&&_0x5b2396[_0x2ab7b1(0x20c)]!==_0x54f1f2['mes']&&(_0x54f1f2['mes']=_0x5b2396[_0x2ab7b1(0x20c)],await saveChatConditional(),_0x33c3c2[_0x2ab7b1(0x206)]===_0x2ab7b1(0x1f4)&&await reloadCurrentChat());}else console[_0x2ab7b1(0x1e1)](_0x2ab7b1(0x200));}((async()=>{const _0x5652de=_0x2ab7b1;try{await new Promise(_0x3b0896=>setTimeout(_0x3b0896,0x64)),await checkAndTriggerAutoSummary();}catch(_0x18303d){console[_0x5652de(0x1e5)]('[大史官]\x20后台自动总结任务执行时发生错误:',_0x18303d);}})());}export{handleTableUpdate};
|