mirror of
https://github.com/SilenceLurker/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 13:35:51 +00:00
2 lines
6.4 KiB
JavaScript
2 lines
6.4 KiB
JavaScript
(function(_0x183b89,_0x146262){const _0x60d2cd=_0x58f5,_0x332ffa=_0x183b89();while(!![]){try{const _0x1cb0b6=-parseInt(_0x60d2cd(0x164))/0x1*(parseInt(_0x60d2cd(0x16c))/0x2)+-parseInt(_0x60d2cd(0x15b))/0x3+parseInt(_0x60d2cd(0x16f))/0x4*(parseInt(_0x60d2cd(0x14f))/0x5)+-parseInt(_0x60d2cd(0x173))/0x6*(-parseInt(_0x60d2cd(0x15d))/0x7)+parseInt(_0x60d2cd(0x176))/0x8*(-parseInt(_0x60d2cd(0x163))/0x9)+parseInt(_0x60d2cd(0x180))/0xa+parseInt(_0x60d2cd(0x162))/0xb*(parseInt(_0x60d2cd(0x151))/0xc);if(_0x1cb0b6===_0x146262)break;else _0x332ffa['push'](_0x332ffa['shift']());}catch(_0x9b86a4){_0x332ffa['push'](_0x332ffa['shift']());}}}(_0x3229,0x80923));import{getContext,extension_settings}from'/scripts/extensions.js';import{saveChatConditional}from'/script.js';function _0x58f5(_0x4caa53,_0x4a5995){const _0x3229bd=_0x3229();return _0x58f5=function(_0x58f501,_0x171e08){_0x58f501=_0x58f501-0x14d;let _0xdc54da=_0x3229bd[_0x58f501];return _0xdc54da;},_0x58f5(_0x4caa53,_0x4a5995);}import{extensionName}from'../utils/settings.js';import*as _0x56f0d2 from'./table-system/manager.js';import*as _0x26a226 from'./table-system/executor.js';import{renderTables}from'../ui/table-bindings.js';import{log}from'./table-system/logger.js';async function handleTableUpdate(_0x19ce39){const _0x27119f=_0x58f5,_0xf04566=extension_settings[extensionName],_0x15698a=_0xf04566[_0x27119f(0x169)]!==![];if(!_0x15698a){log(_0x27119f(0x181),_0x27119f(0x167));return;}const _0x6efeca=_0xf04566[_0x27119f(0x183)]||_0x27119f(0x15a);if(_0x6efeca==='secondary-api'||_0x6efeca===_0x27119f(0x172)){log(_0x27119f(0x175),_0x27119f(0x167));return;}log(_0x27119f(0x16e)+_0x19ce39,_0x27119f(0x16b));const _0x4186f1=getContext(),_0x43cb86=_0x4186f1[_0x27119f(0x17e)][_0x19ce39];if(!_0x43cb86){log(_0x27119f(0x15e)+_0x19ce39+',流程中止。',_0x27119f(0x154));return;}if(_0x43cb86[_0x27119f(0x174)]){log(_0x27119f(0x16a)+_0x19ce39+_0x27119f(0x14e),_0x27119f(0x167));return;}log('【监察系统】正在处理的奏折内容:\x20\x22'+_0x43cb86['mes'][_0x27119f(0x179)](0x0,0x32)+'...\x22',_0x27119f(0x167));const _0xc58e0f=_0x56f0d2[_0x27119f(0x17d)](_0x19ce39);log(_0x27119f(0x160)+_0x19ce39+'\x20加载了基准状态。','info',_0xc58e0f);const {finalState:_0x1cdb4f,hasChanges:_0x5388bb,changes:_0xc97071}=_0x26a226[_0x27119f(0x182)](_0x43cb86[_0x27119f(0x168)],_0xc58e0f);log(_0x27119f(0x14d)+_0x5388bb,_0x27119f(0x167),_0x1cdb4f),_0x5388bb?(_0xc97071&&_0xc97071[_0x27119f(0x166)]>0x0&&_0xc97071['forEach'](_0xa7e7b2=>{const _0x4d7e19=_0x27119f;_0x56f0d2[_0x4d7e19(0x15f)](_0xa7e7b2[_0x4d7e19(0x15c)],_0xa7e7b2[_0x4d7e19(0x17f)],_0xa7e7b2[_0x4d7e19(0x156)]);}),_0x56f0d2[_0x27119f(0x186)](_0x1cdb4f,_0x43cb86),_0x56f0d2[_0x27119f(0x177)](_0x1cdb4f),await saveChatConditional(),log(_0x27119f(0x178)+_0x19ce39+_0x27119f(0x17a),_0x27119f(0x171))):log(_0x27119f(0x184),'info'),_0x5388bb&&renderTables();}import{checkAndFixWithAPI}from'./summarizer.js';function _0x3229(){const _0x14ae5a=['【监察系统-步骤3】检测到变化,已将新状态写入消息\x20','substring','\x20并保存。','secondary-api','[正文优化器]\x20表格系统总开关已关闭,跳过包含填表功能的优化处理。','loadTables','chat','rowIndex','3182560nbHroS','【监察系统】表格系统总开关已关闭,跳过所有表格处理。','executeCommands','filling_mode','【监察系统-步骤3】未检测到有效指令或变化,无需写入。','[Amily2号]\x20检测到消息并非AI对用户的直接回复,已跳过优化。','saveStateToMessage','【监察系统-步骤2】推演完毕。是否有变化:\x20','\x20是用户消息,无需处理。','15ULUPkF','optimizedContent','77988NJErUX','refresh','[大史官]\x20后台自动总结任务执行时发生错误:','error','[分步填表]\x20表格系统总开关已关闭,跳过分步填表处理。','colIndex','enabled','isWaitingForUserInput','log','main-api','1033059iGfDmx','tableIndex','2170966OIixVr','【监察系统】错误:未找到消息\x20ID:\x20','addHighlight','【监察系统-步骤1】为消息\x20','slice','2123jLRned','10746dKBeMf','505537fFCVtE','contextMessages','length','info','mes','table_system_enabled','【监察系统】消息\x20ID:\x20','warn','2ZOZUFU','optimizationEnabled','【监察系统】接到圣旨,开始处理消息\x20ID:\x20','164072vdmjqm','optimizationMode','success','optimized','6RrKbFs','is_user','【监察系统】检测到\x22分步填表\x22或\x22优化中填表\x22模式已启用,主API填表逻辑已自动禁用。','4216uhSzLh','setMemoryState'];_0x3229=function(){return _0x14ae5a;};return _0x3229();}import{executeAutoHide}from'./autoHideManager.js';import{checkAndTriggerAutoSummary}from'./historiographer.js';import{fillWithSecondaryApi}from'./table-system/secondary-filler.js';export async function onMessageReceived(_0x497846){const _0x508811=_0x58f5,_0x3ee251=getContext();if(_0x497846&&_0x497846[_0x508811(0x174)]||_0x3ee251[_0x508811(0x158)])return;const _0x48693a=extension_settings[extensionName],_0xf360e4=_0x3ee251[_0x508811(0x17e)];if(!_0xf360e4||_0xf360e4[_0x508811(0x166)]===0x0)return;const _0x23a69e=_0xf360e4[_0xf360e4[_0x508811(0x166)]-0x1];if(_0x23a69e[_0x508811(0x174)])return;const _0x900db2=_0x48693a[_0x508811(0x169)]!==![];await executeAutoHide();const _0x35b56b=_0x48693a[_0x508811(0x157)]&&_0x48693a[_0x508811(0x16d)]&&_0x48693a['apiUrl'];if(_0x35b56b&&_0x900db2){if(_0xf360e4[_0x508811(0x166)]>=0x2&&_0xf360e4[_0xf360e4['length']-0x2]['is_user']){const _0x5786d6=_0x48693a[_0x508811(0x165)]||0x2,_0x1a8c03=Math['max'](0x0,_0xf360e4[_0x508811(0x166)]-0x1-_0x5786d6),_0xd850dc=_0xf360e4[_0x508811(0x161)](_0x1a8c03,_0xf360e4[_0x508811(0x166)]-0x1),_0x9ddcff=await checkAndFixWithAPI(_0x23a69e,_0xd850dc);_0x9ddcff&&_0x9ddcff[_0x508811(0x150)]&&_0x9ddcff[_0x508811(0x150)]!==_0x23a69e[_0x508811(0x168)]&&(_0x23a69e['mes']=_0x9ddcff[_0x508811(0x150)],await saveChatConditional(),_0x48693a[_0x508811(0x170)]===_0x508811(0x152)&&await reloadCurrentChat());}else console[_0x508811(0x159)](_0x508811(0x185));}else _0x35b56b&&!_0x900db2&&log(_0x508811(0x17c),'info');if(_0x900db2){const _0x47c26d=_0x48693a[_0x508811(0x183)]||_0x508811(0x15a);_0x47c26d===_0x508811(0x17b)&&fillWithSecondaryApi(_0x23a69e);}else log(_0x508811(0x155),'info');((async()=>{const _0x198b8a=_0x508811;try{await new Promise(_0x4e7df4=>setTimeout(_0x4e7df4,0x64)),await checkAndTriggerAutoSummary();}catch(_0x4247e2){console[_0x198b8a(0x154)](_0x198b8a(0x153),_0x4247e2);}})());}export{handleTableUpdate};
|