mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 22:05:50 +00:00
2 lines
5.5 KiB
JavaScript
2 lines
5.5 KiB
JavaScript
(function(_0x54139f,_0x40eb23){const _0x5f3415=_0x88a3,_0x2863b4=_0x54139f();while(!![]){try{const _0x1d9c55=parseInt(_0x5f3415(0x13a))/0x1*(-parseInt(_0x5f3415(0x141))/0x2)+-parseInt(_0x5f3415(0x155))/0x3*(parseInt(_0x5f3415(0x139))/0x4)+parseInt(_0x5f3415(0x13c))/0x5+parseInt(_0x5f3415(0x131))/0x6+parseInt(_0x5f3415(0x130))/0x7*(-parseInt(_0x5f3415(0x146))/0x8)+parseInt(_0x5f3415(0x159))/0x9+-parseInt(_0x5f3415(0x13b))/0xa*(-parseInt(_0x5f3415(0x134))/0xb);if(_0x1d9c55===_0x40eb23)break;else _0x2863b4['push'](_0x2863b4['shift']());}catch(_0x3da60f){_0x2863b4['push'](_0x2863b4['shift']());}}}(_0x5aba,0x315b3));function _0x5aba(){const _0x1dc1b7=['【监察系统】错误:未找到消息\x20ID:\x20','main-api','476mrhJiX','281437mOyVkG','10RvLKRf','489980qRVEyR','optimizedContent','【监察系统-步骤1】为消息\x20','isWaitingForUserInput','\x20加载了基准状态。','2syUPyk','optimizationEnabled','optimizationMode','setMemoryState','\x20是用户消息,无需处理。','248WmSYCW','secondary-api','apiUrl','[Amily2号]\x20检测到消息并非AI对用户的直接回复,已跳过优化。','[大史官]\x20后台自动总结任务执行时发生错误:','is_user','contextMessages','filling_mode','【监察系统-步骤3】未检测到有效指令或变化,无需写入。','...\x22','max','【监察系统】消息\x20ID:\x20','【监察系统-步骤2】推演完毕。是否有变化:\x20','\x20并保存。','optimized','2397YgVdgm','refresh','info','chat','3013407BxNyOO','error','log','warn','length','51219pFiXJg','1924902RRenew','executeCommands','mes','570592hbVPIT','【监察系统】检测到“分步填表”或“优化中填表”模式已启用,主API填表逻辑已自动禁用。','slice'];_0x5aba=function(){return _0x1dc1b7;};return _0x5aba();}import{getContext,extension_settings}from'/scripts/extensions.js';import{saveChatConditional}from'/script.js';import{extensionName}from'../utils/settings.js';import*as _0x25611c from'./table-system/manager.js';import*as _0x24cfb0 from'./table-system/executor.js';import{renderTables}from'../ui/table-bindings.js';import{log}from'./table-system/logger.js';function _0x88a3(_0x2df3cb,_0x37f405){const _0x5aba3e=_0x5aba();return _0x88a3=function(_0x88a30d,_0x2e326b){_0x88a30d=_0x88a30d-0x12d;let _0x11f484=_0x5aba3e[_0x88a30d];return _0x11f484;},_0x88a3(_0x2df3cb,_0x37f405);}async function handleTableUpdate(_0xb70c1b){const _0x313ccc=_0x88a3,_0x1dc388=extension_settings[extensionName],_0x3ab750=_0x1dc388[_0x313ccc(0x14d)]||_0x313ccc(0x138);if(_0x3ab750==='secondary-api'||_0x3ab750===_0x313ccc(0x154)){log(_0x313ccc(0x135),'info');return;}log('【监察系统】接到圣旨,开始处理消息\x20ID:\x20'+_0xb70c1b,_0x313ccc(0x12e));const _0x43c3f3=getContext(),_0x4875ef=_0x43c3f3['chat'][_0xb70c1b];if(!_0x4875ef){log(_0x313ccc(0x137)+_0xb70c1b+',流程中止。',_0x313ccc(0x15a));return;}if(_0x4875ef[_0x313ccc(0x14b)]){log(_0x313ccc(0x151)+_0xb70c1b+_0x313ccc(0x145),'info');return;}log('【监察系统】正在处理的奏折内容:\x20\x22'+_0x4875ef[_0x313ccc(0x133)]['substring'](0x0,0x32)+_0x313ccc(0x14f),_0x313ccc(0x157));const _0x33171d=_0x25611c['loadTables'](_0xb70c1b);log(_0x313ccc(0x13e)+_0xb70c1b+_0x313ccc(0x140),'info',_0x33171d);const {finalState:_0x128627,hasChanges:_0x3e2564}=_0x24cfb0[_0x313ccc(0x132)](_0x4875ef[_0x313ccc(0x133)],_0x33171d);log(_0x313ccc(0x152)+_0x3e2564,_0x313ccc(0x157),_0x128627),_0x3e2564?(_0x25611c['saveStateToMessage'](_0x128627,_0x4875ef),_0x25611c[_0x313ccc(0x144)](_0x128627),await saveChatConditional(),log('【监察系统-步骤3】检测到变化,已将新状态写入消息\x20'+_0xb70c1b+_0x313ccc(0x153),'success')):log(_0x313ccc(0x14e),'info'),renderTables();}import{checkAndFixWithAPI}from'./summarizer.js';import{executeAutoHide}from'./autoHideManager.js';import{checkAndTriggerAutoSummary}from'./historiographer.js';import{fillWithSecondaryApi}from'./table-system/secondary-filler.js';export async function onMessageReceived(_0x3be1f5){const _0xf15244=_0x88a3,_0x72cbbb=getContext();if(_0x3be1f5&&_0x3be1f5[_0xf15244(0x14b)]||_0x72cbbb[_0xf15244(0x13f)])return;const _0x51940b=extension_settings[extensionName],_0x26e217=_0x72cbbb[_0xf15244(0x158)];if(!_0x26e217||_0x26e217[_0xf15244(0x12f)]===0x0)return;const _0x24158a=_0x26e217[_0x26e217['length']-0x1];if(_0x24158a[_0xf15244(0x14b)])return;await executeAutoHide();const _0x8fc3e5=_0x51940b['filling_mode']||_0xf15244(0x138);if(_0x8fc3e5===_0xf15244(0x147))fillWithSecondaryApi(_0x24158a);else{if(_0x8fc3e5===_0xf15244(0x154)){const _0x204fc5=_0x51940b['enabled']&&_0x51940b[_0xf15244(0x142)]&&_0x51940b[_0xf15244(0x148)];if(_0x204fc5){if(_0x26e217[_0xf15244(0x12f)]>=0x2&&_0x26e217[_0x26e217[_0xf15244(0x12f)]-0x2][_0xf15244(0x14b)]){const _0x4c7ea2=_0x51940b[_0xf15244(0x14c)]||0x2,_0x1e834b=Math[_0xf15244(0x150)](0x0,_0x26e217[_0xf15244(0x12f)]-0x1-_0x4c7ea2),_0x4a779c=_0x26e217[_0xf15244(0x136)](_0x1e834b,_0x26e217[_0xf15244(0x12f)]-0x1),_0x19d52a=await checkAndFixWithAPI(_0x24158a,_0x4a779c);_0x19d52a&&_0x19d52a[_0xf15244(0x13d)]&&_0x19d52a[_0xf15244(0x13d)]!==_0x24158a[_0xf15244(0x133)]&&(_0x24158a[_0xf15244(0x133)]=_0x19d52a[_0xf15244(0x13d)],await saveChatConditional(),_0x51940b[_0xf15244(0x143)]===_0xf15244(0x156)&&await reloadCurrentChat());}else console[_0xf15244(0x12d)](_0xf15244(0x149));}}}((async()=>{const _0x4cbe4f=_0xf15244;try{await new Promise(_0xf47eae=>setTimeout(_0xf47eae,0x64)),await checkAndTriggerAutoSummary();}catch(_0x3ee920){console[_0x4cbe4f(0x15a)](_0x4cbe4f(0x14a),_0x3ee920);}})());}export{handleTableUpdate};
|