mirror of
https://github.com/SilenceLurker/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 20:35:51 +00:00
1 line
7.2 KiB
JavaScript
1 line
7.2 KiB
JavaScript
(function(_0x4929c8,_0x25f4c1){const _0x9e2b26=_0x338b,_0x13cf90=_0x4929c8();while(!![]){try{const _0x2eea82=-parseInt(_0x9e2b26(0x1a4))/0x1+parseInt(_0x9e2b26(0x17d))/0x2*(-parseInt(_0x9e2b26(0x198))/0x3)+parseInt(_0x9e2b26(0x18e))/0x4+-parseInt(_0x9e2b26(0x1a3))/0x5*(-parseInt(_0x9e2b26(0x1af))/0x6)+-parseInt(_0x9e2b26(0x1be))/0x7+-parseInt(_0x9e2b26(0x1ca))/0x8*(parseInt(_0x9e2b26(0x189))/0x9)+parseInt(_0x9e2b26(0x194))/0xa*(parseInt(_0x9e2b26(0x18a))/0xb);if(_0x2eea82===_0x25f4c1)break;else _0x13cf90['push'](_0x13cf90['shift']());}catch(_0x50e344){_0x13cf90['push'](_0x13cf90['shift']());}}}(_0x2a97,0xcd015));function _0x338b(_0x44f213,_0x15ef03){const _0x2a97ce=_0x2a97();return _0x338b=function(_0x338bfe,_0x60275d){_0x338bfe=_0x338bfe-0x17a;let _0x193f22=_0x2a97ce[_0x338bfe];return _0x193f22;},_0x338b(_0x44f213,_0x15ef03);}function _0x2a97(){const _0x4ec353=['suppressToast','summarizationPrompt','#amily2_auto_hide_enabled','autoHideThreshold','#amily2_lore_depth_container','1416366ARAFld','hide','loreDepth','--\x20选择模型\x20--','historiographySmallAutoEnable','#amily2_lore_depth_input','#amily2_context_messages','selected','optimizationEnabled','val','worldbookEnabled','#amily2_optimization_exclusion_enabled','5692608qpjaGr','apiKey','<option\x20value=\x22\x22>无可用模型,请刷新</option>','#amily2_update_indicator','#amily2_model','19520eRSZlo','#amily2_main_prompt','\x20个可用模型','autoHideEnabled','loreActivationMode','showOptimizationToast','mainPrompt','html','lorebookTarget','#amily2_max_tokens','input[name=\x22amily2_optimization_mode\x22][value=\x22','append','9wrKPiB','71126vpNPXS','optimizationExclusionEnabled','#amily2_temperature_value','.plugin-features','5739932PXYQef','checked','temperature','apiUrl','summarizationEnabled','#amily2_output_format_prompt','5210Sobqcm','empty','#amily2_mhb_small_trigger_count','iconLocation','486FnZUFC','contextMessages','text','#amily2_api_url','historiographySmallTriggerThreshold','#amily2_context_messages_value','#amily2_api_key','#amily2_mhb_small_auto_enabled','#auth_panel','enabled','#amily2_optimization_target_tag','13315zczQVt','1642129UlGIsZ','input[name=\x22amily2_icon_location\x22][value=\x22','已选择:\x20<strong>','#amily2_model_notes','optimizationMode','#amily2_summarization_prompt','#amily2_temperature','<span\x20style=\x22color:\x20#ff9800;\x22>请检查API配置后点击\x22刷新模型\x22</span>','maxTokens','#amily2_update_button_new','#amily2_lore_activation_mode','390ovCfzD','at_depth','#amily2_show_optimization_toast','show','outputFormatPrompt','loreInsertionPosition','prop','length','#amily2_summarization_enabled','<option></option>'];_0x2a97=function(){return _0x4ec353;};return _0x2a97();}import{extension_settings}from'/scripts/extensions.js';import{extensionName}from'../utils/settings.js';import{pluginAuthStatus}from'../utils/auth.js';let availableModels=[],latestUpdateInfo=null,newVersionAvailable=![];export function setUpdateInfo(_0x280a1b,_0x557536){newVersionAvailable=_0x280a1b,latestUpdateInfo=_0x557536;}export function applyUpdateIndicator(){const _0x479bcc=_0x338b;newVersionAvailable?($(_0x479bcc(0x17b))[_0x479bcc(0x1b2)](),$(_0x479bcc(0x1ad))[_0x479bcc(0x1b2)]()):($(_0x479bcc(0x17b))[_0x479bcc(0x1bf)](),$('#amily2_update_button_new')['hide']());}export function getLatestUpdateInfo(){return latestUpdateInfo;}export function setAvailableModels(_0x230755){availableModels=_0x230755;}export function populateModelDropdown(){const _0x1f30db=_0x338b,_0x31cbc9=$(_0x1f30db(0x17c)),_0x3eba67=$(_0x1f30db(0x1a7));_0x31cbc9[_0x1f30db(0x195)]();const _0x35ebfb=extension_settings[extensionName]?.['model']||'';if(availableModels[_0x1f30db(0x1b6)]===0x0){_0x31cbc9[_0x1f30db(0x188)](_0x1f30db(0x17a)),_0x3eba67[_0x1f30db(0x184)](_0x1f30db(0x1ab));return;}const _0x5bd6f7=$(_0x1f30db(0x1b8))['val']('')['text'](_0x1f30db(0x1c1));_0x31cbc9[_0x1f30db(0x188)](_0x5bd6f7),availableModels['forEach'](_0x44880b=>{const _0x36a991=_0x1f30db,_0x1abab8=$(_0x36a991(0x1b8))[_0x36a991(0x1c7)](_0x44880b)[_0x36a991(0x19a)](_0x44880b);_0x44880b===_0x35ebfb&&_0x1abab8['attr'](_0x36a991(0x1c5),_0x36a991(0x1c5)),_0x31cbc9['append'](_0x1abab8);}),_0x35ebfb&&_0x31cbc9[_0x1f30db(0x1c7)]()===_0x35ebfb?_0x3eba67[_0x1f30db(0x184)](_0x1f30db(0x1a6)+_0x35ebfb+'</strong>'):_0x3eba67['html']('已加载\x20'+availableModels['length']+_0x1f30db(0x17f));}export function updateUI(){const _0x4823e1=_0x338b;if(!pluginAuthStatus['authorized'])$(_0x4823e1(0x1a0))['show'](),$(_0x4823e1(0x18d))['hide']();else{$(_0x4823e1(0x1a0))['hide'](),$(_0x4823e1(0x18d))[_0x4823e1(0x1b2)]();const _0x217344=extension_settings[extensionName];if(!_0x217344)return;$('#amily2_enabled')[_0x4823e1(0x1b5)](_0x4823e1(0x18f),_0x217344[_0x4823e1(0x1a1)]),$(_0x4823e1(0x19b))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x191)]),$(_0x4823e1(0x19e))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x1cb)]),$(_0x4823e1(0x17c))[_0x4823e1(0x1c7)](_0x217344['model']),$(_0x4823e1(0x186))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x1ac)]),$('#amily2_max_tokens_value')[_0x4823e1(0x19a)](_0x217344[_0x4823e1(0x1ac)]),$(_0x4823e1(0x1aa))[_0x4823e1(0x1c7)](_0x217344['temperature']),$(_0x4823e1(0x18c))['text'](_0x217344[_0x4823e1(0x190)]),$(_0x4823e1(0x1c4))['val'](_0x217344['contextMessages']),$(_0x4823e1(0x19d))[_0x4823e1(0x19a)](_0x217344[_0x4823e1(0x199)]),$(_0x4823e1(0x1a2))[_0x4823e1(0x1c7)](_0x217344['optimizationTargetTag']),$(_0x4823e1(0x187)+_0x217344[_0x4823e1(0x1a8)]+'\x22]')['prop'](_0x4823e1(0x18f),!![]),$('#amily2_optimization_enabled')[_0x4823e1(0x1b5)](_0x4823e1(0x18f),_0x217344[_0x4823e1(0x1c6)]),$(_0x4823e1(0x1c9))[_0x4823e1(0x1b5)]('checked',_0x217344[_0x4823e1(0x18b)]),$(_0x4823e1(0x1b1))['prop'](_0x4823e1(0x18f),_0x217344[_0x4823e1(0x182)]),$('#amily2_suppress_toast')['prop'](_0x4823e1(0x18f),_0x217344[_0x4823e1(0x1b9)]),$('#amily2_system_prompt')[_0x4823e1(0x1c7)](_0x217344['systemPrompt']),$(_0x4823e1(0x17e))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x183)]),$(_0x4823e1(0x193))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x1b3)]),$(_0x4823e1(0x1a9))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x1ba)]),$('#amily2_worldbook_enabled')[_0x4823e1(0x1b5)]('checked',_0x217344[_0x4823e1(0x1c8)]),$(_0x4823e1(0x1b7))[_0x4823e1(0x1b5)]('checked',_0x217344[_0x4823e1(0x192)]),$('input[name=\x22amily2_lorebook_target\x22][value=\x22'+_0x217344[_0x4823e1(0x185)]+'\x22]')[_0x4823e1(0x1b5)](_0x4823e1(0x18f),!![]),$(_0x4823e1(0x1a5)+_0x217344[_0x4823e1(0x197)]+'\x22]')[_0x4823e1(0x1b5)](_0x4823e1(0x18f),!![]),$(_0x4823e1(0x1bb))['prop'](_0x4823e1(0x18f),_0x217344[_0x4823e1(0x180)]),$('#amily2_auto_hide_threshold')['val'](_0x217344[_0x4823e1(0x1bc)]),$('#amily2_auto_hide_threshold_value')[_0x4823e1(0x19a)](_0x217344[_0x4823e1(0x1bc)]),$(_0x4823e1(0x1ae))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x181)]),$('#amily2_lore_insertion_position')['val'](_0x217344[_0x4823e1(0x1b4)]),$(_0x4823e1(0x1c3))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x1c0)]),_0x217344[_0x4823e1(0x1b4)]===_0x4823e1(0x1b0)?$(_0x4823e1(0x1bd))[_0x4823e1(0x1b2)]():$('#amily2_lore_depth_container')[_0x4823e1(0x1bf)](),_0x217344[_0x4823e1(0x1c2)]!==undefined&&$(_0x4823e1(0x19f))[_0x4823e1(0x1b5)](_0x4823e1(0x18f),_0x217344[_0x4823e1(0x1c2)]),_0x217344[_0x4823e1(0x19c)]!==undefined&&$(_0x4823e1(0x196))[_0x4823e1(0x1c7)](_0x217344[_0x4823e1(0x19c)]),populateModelDropdown();}} |