mirror of
https://github.com/SilenceLurker/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 21:45:51 +00:00
2 lines
5.3 KiB
JavaScript
2 lines
5.3 KiB
JavaScript
(function(_0x3de457,_0x2948cc){const _0x59ade8=_0xe535,_0x5289a1=_0x3de457();while(!![]){try{const _0x4c598c=parseInt(_0x59ade8(0xe7))/0x1+parseInt(_0x59ade8(0xda))/0x2*(-parseInt(_0x59ade8(0xe5))/0x3)+parseInt(_0x59ade8(0xea))/0x4+-parseInt(_0x59ade8(0xca))/0x5+-parseInt(_0x59ade8(0xd3))/0x6*(-parseInt(_0x59ade8(0xe4))/0x7)+parseInt(_0x59ade8(0xeb))/0x8+parseInt(_0x59ade8(0xc8))/0x9;if(_0x4c598c===_0x2948cc)break;else _0x5289a1['push'](_0x5289a1['shift']());}catch(_0x101218){_0x5289a1['push'](_0x5289a1['shift']());}}}(_0x3569,0xd2eb2));import{getContext,extension_settings}from'/scripts/extensions.js';import{saveChatConditional}from'/script.js';import{extensionName}from'../utils/settings.js';import*as _0x41cd54 from'./table-system/manager.js';function _0x3569(){const _0x2aed93=['7089000BBFhvu','chat','length','apiUrl','【监察系统】消息\x20ID:\x20','【监察系统】正在处理的奏折内容:\x20\x22','【监察系统】错误:未找到消息\x20ID:\x20','【监察系统-步骤1】为消息\x20','success','24VZjbyP','substring','【监察系统】接到圣旨,开始处理消息\x20ID:\x20','enabled','\x20并保存。','【监察系统】检测到“分步填表”或“优化中填表”模式已启用,主API填表逻辑已自动禁用。','log','2914qCLuIt','warn',',流程中止。','【监察系统-步骤3】检测到变化,已将新状态写入消息\x20','filling_mode','【监察系统-步骤2】推演完毕。是否有变化:\x20','optimized','error','isWaitingForUserInput','optimizationMode','1358756aDtiSe','2943AhNMPg','optimizedContent','612150LNMxJb','max','[Amily2号]\x20检测到消息并非AI对用户的直接回复,已跳过优化。','524976hSituX','7537808xMjOwG','mes','\x20是用户消息,无需处理。','contextMessages','main-api','is_user','setMemoryState','info','11240883aFRjgP','secondary-api'];_0x3569=function(){return _0x2aed93;};return _0x3569();}import*as _0x36e01b from'./table-system/executor.js';import{renderTables}from'../ui/table-bindings.js';import{log}from'./table-system/logger.js';async function handleTableUpdate(_0x4926c3){const _0x47f9c0=_0xe535,_0x1b2ba1=extension_settings[extensionName],_0x11cf84=_0x1b2ba1[_0x47f9c0(0xde)]||_0x47f9c0(0xef);if(_0x11cf84===_0x47f9c0(0xc9)||_0x11cf84===_0x47f9c0(0xe0)){log(_0x47f9c0(0xd8),'info');return;}log(_0x47f9c0(0xd5)+_0x4926c3,_0x47f9c0(0xdb));const _0x273dff=getContext(),_0x209925=_0x273dff['chat'][_0x4926c3];if(!_0x209925){log(_0x47f9c0(0xd0)+_0x4926c3+_0x47f9c0(0xdc),_0x47f9c0(0xe1));return;}if(_0x209925[_0x47f9c0(0xc5)]){log(_0x47f9c0(0xce)+_0x4926c3+_0x47f9c0(0xed),_0x47f9c0(0xc7));return;}log(_0x47f9c0(0xcf)+_0x209925[_0x47f9c0(0xec)][_0x47f9c0(0xd4)](0x0,0x32)+'...\x22',_0x47f9c0(0xc7));const _0x54154c=_0x41cd54['loadTables'](_0x4926c3);log(_0x47f9c0(0xd1)+_0x4926c3+'\x20加载了基准状态。','info',_0x54154c);const {finalState:_0x34edc0,hasChanges:_0x2e45e9}=_0x36e01b['executeCommands'](_0x209925[_0x47f9c0(0xec)],_0x54154c);log(_0x47f9c0(0xdf)+_0x2e45e9,_0x47f9c0(0xc7),_0x34edc0),_0x2e45e9?(_0x41cd54['saveStateToMessage'](_0x34edc0,_0x209925),_0x41cd54[_0x47f9c0(0xc6)](_0x34edc0),await saveChatConditional(),log(_0x47f9c0(0xdd)+_0x4926c3+_0x47f9c0(0xd7),_0x47f9c0(0xd2))):log('【监察系统-步骤3】未检测到有效指令或变化,无需写入。',_0x47f9c0(0xc7)),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(_0xfb7aa8){const _0x3f1bdc=_0xe535,_0x239437=getContext();if(_0xfb7aa8&&_0xfb7aa8['is_user']||_0x239437[_0x3f1bdc(0xe2)])return;const _0x320650=extension_settings[extensionName],_0x17a335=_0x239437[_0x3f1bdc(0xcb)];if(!_0x17a335||_0x17a335[_0x3f1bdc(0xcc)]===0x0)return;const _0x6ee609=_0x17a335[_0x17a335[_0x3f1bdc(0xcc)]-0x1];if(_0x6ee609[_0x3f1bdc(0xc5)])return;await executeAutoHide();const _0x25625c=_0x320650[_0x3f1bdc(0xd6)]&&_0x320650['optimizationEnabled']&&_0x320650[_0x3f1bdc(0xcd)];if(_0x25625c){if(_0x17a335[_0x3f1bdc(0xcc)]>=0x2&&_0x17a335[_0x17a335[_0x3f1bdc(0xcc)]-0x2][_0x3f1bdc(0xc5)]){const _0x1fa123=_0x320650[_0x3f1bdc(0xee)]||0x2,_0x11026a=Math[_0x3f1bdc(0xe8)](0x0,_0x17a335[_0x3f1bdc(0xcc)]-0x1-_0x1fa123),_0x3f7a43=_0x17a335['slice'](_0x11026a,_0x17a335['length']-0x1),_0x1b6156=await checkAndFixWithAPI(_0x6ee609,_0x3f7a43);_0x1b6156&&_0x1b6156[_0x3f1bdc(0xe6)]&&_0x1b6156['optimizedContent']!==_0x6ee609[_0x3f1bdc(0xec)]&&(_0x6ee609[_0x3f1bdc(0xec)]=_0x1b6156[_0x3f1bdc(0xe6)],await saveChatConditional(),_0x320650[_0x3f1bdc(0xe3)]==='refresh'&&await reloadCurrentChat());}else console[_0x3f1bdc(0xd9)](_0x3f1bdc(0xe9));}const _0x4e8b75=_0x320650['filling_mode']||_0x3f1bdc(0xef);_0x4e8b75===_0x3f1bdc(0xc9)&&fillWithSecondaryApi(_0x6ee609),((async()=>{const _0x2ae57b=_0x3f1bdc;try{await new Promise(_0x2c567e=>setTimeout(_0x2c567e,0x64)),await checkAndTriggerAutoSummary();}catch(_0x173127){console[_0x2ae57b(0xe1)]('[大史官]\x20后台自动总结任务执行时发生错误:',_0x173127);}})());}function _0xe535(_0x3d8899,_0xfecf2d){const _0x356959=_0x3569();return _0xe535=function(_0xe535dc,_0x6a64a3){_0xe535dc=_0xe535dc-0xc5;let _0x574ad2=_0x356959[_0xe535dc];return _0x574ad2;},_0xe535(_0x3d8899,_0xfecf2d);}export{handleTableUpdate};
|