mirror of
https://github.com/SilenceLurker/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 08:55:50 +00:00
2 lines
6.9 KiB
JavaScript
2 lines
6.9 KiB
JavaScript
function _0x13df(){const _0x47d610=['maxTokens','apiUrl','#amily2_model','optimizationTargetTag','systemPrompt','#amily2_temperature','#amily2_summarization_enabled','#amily2_lore_depth_input','#amily2_context_messages','loreDepth','1600efXTSA','<span\x20style=\x22color:\x20#ff9800;\x22>请检查API配置后点击\x22刷新模型\x22</span>','hide','#amily2_api_url','2608245UcBJQB','#amily2_auto_hide_threshold_value','#amily2_output_format_prompt','已选择:\x20<strong>','#amily2_max_tokens_value','#auth_panel','mainPrompt','show','checked','input[name=\x22amily2_lorebook_target\x22][value=\x22','#amily2_temperature_value','4593970pTFMrZ','</strong>','38KQwLTP','selected','11FlhtsO','loreInsertionPosition','已加载\x20','2637790CBNeCy','#amily2_main_prompt','attr','autoHideEnabled','contextMessages','13979yyvuti','html','#amily2_mhb_small_auto_enabled','input[name=\x22amily2_optimization_mode\x22][value=\x22','text','#amily2_context_messages_value','3918HRtUNZ','#amily2_enabled','#amily2_lore_depth_container','.plugin-features','#amily2_worldbook_enabled','autoHideThreshold','#amily2_optimization_enabled','lorebookTarget','#amily2_show_optimization_toast','693318adBwMA','prop','showOptimizationToast','input[name=\x22amily2_icon_location\x22][value=\x22','historiographySmallAutoEnable','append','1027950sWhadr','summarizationEnabled','historiographySmallTriggerThreshold','length','#amily2_max_tokens','suppressToast','#amily2_optimization_target_tag','<option></option>','empty','at_depth','val','#amily2_suppress_toast','worldbookEnabled','4rCIAoz','authorized','#amily2_summarization_prompt','forEach','#amily2_model_notes'];_0x13df=function(){return _0x47d610;};return _0x13df();}(function(_0xb5c45a,_0x5b32d2){const _0x3c5c0c=_0x521b,_0x4a5fbb=_0xb5c45a();while(!![]){try{const _0x4b91b7=-parseInt(_0x3c5c0c(0x14e))/0x1*(-parseInt(_0x3c5c0c(0x18a))/0x2)+parseInt(_0x3c5c0c(0x157))/0x3*(-parseInt(_0x3c5c0c(0x16a))/0x4)+parseInt(_0x3c5c0c(0x143))/0x5+-parseInt(_0x3c5c0c(0x15d))/0x6+parseInt(_0x3c5c0c(0x148))/0x7*(-parseInt(_0x3c5c0c(0x179))/0x8)+parseInt(_0x3c5c0c(0x17d))/0x9+parseInt(_0x3c5c0c(0x188))/0xa*(parseInt(_0x3c5c0c(0x18c))/0xb);if(_0x4b91b7===_0x5b32d2)break;else _0x4a5fbb['push'](_0x4a5fbb['shift']());}catch(_0x252f52){_0x4a5fbb['push'](_0x4a5fbb['shift']());}}}(_0x13df,0x861fb));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(_0x54361a,_0x2e2957){newVersionAvailable=_0x54361a,latestUpdateInfo=_0x2e2957;}export function applyUpdateIndicator(){const _0x5ee720=_0x521b;if(newVersionAvailable)$('#amily2_update_indicator')[_0x5ee720(0x184)]();else{}}function _0x521b(_0xce26cc,_0x501069){const _0x13df70=_0x13df();return _0x521b=function(_0x521bf8,_0x433e4a){_0x521bf8=_0x521bf8-0x143;let _0x216f11=_0x13df70[_0x521bf8];return _0x216f11;},_0x521b(_0xce26cc,_0x501069);}export function getLatestUpdateInfo(){return latestUpdateInfo;}export function setAvailableModels(_0xd5f627){availableModels=_0xd5f627;}export function populateModelDropdown(){const _0x2eb2a5=_0x521b,_0x5edf38=$(_0x2eb2a5(0x171)),_0x19dcec=$(_0x2eb2a5(0x16e));_0x5edf38[_0x2eb2a5(0x165)]();const _0x2a7d27=extension_settings[extensionName]?.['model']||'';if(availableModels[_0x2eb2a5(0x160)]===0x0){_0x5edf38[_0x2eb2a5(0x15c)]('<option\x20value=\x22\x22>无可用模型,请刷新</option>'),_0x19dcec[_0x2eb2a5(0x149)](_0x2eb2a5(0x17a));return;}const _0x3e8083=$(_0x2eb2a5(0x164))[_0x2eb2a5(0x167)]('')[_0x2eb2a5(0x14c)]('--\x20选择模型\x20--');_0x5edf38[_0x2eb2a5(0x15c)](_0x3e8083),availableModels[_0x2eb2a5(0x16d)](_0x3268f3=>{const _0x1eca1e=_0x2eb2a5,_0x50bcd1=$(_0x1eca1e(0x164))[_0x1eca1e(0x167)](_0x3268f3)['text'](_0x3268f3);_0x3268f3===_0x2a7d27&&_0x50bcd1[_0x1eca1e(0x145)]('selected',_0x1eca1e(0x18b)),_0x5edf38[_0x1eca1e(0x15c)](_0x50bcd1);}),_0x2a7d27&&_0x5edf38['val']()===_0x2a7d27?_0x19dcec[_0x2eb2a5(0x149)](_0x2eb2a5(0x180)+_0x2a7d27+_0x2eb2a5(0x189)):_0x19dcec[_0x2eb2a5(0x149)](_0x2eb2a5(0x18e)+availableModels[_0x2eb2a5(0x160)]+'\x20个可用模型');}export function updateUI(){const _0x2e0995=_0x521b;if(!pluginAuthStatus[_0x2e0995(0x16b)])$(_0x2e0995(0x182))[_0x2e0995(0x184)](),$(_0x2e0995(0x151))['hide']();else{$(_0x2e0995(0x182))[_0x2e0995(0x17b)](),$(_0x2e0995(0x151))[_0x2e0995(0x184)]();const _0x4823d6=extension_settings[extensionName];if(!_0x4823d6)return;$(_0x2e0995(0x14f))['prop'](_0x2e0995(0x185),_0x4823d6['enabled']),$(_0x2e0995(0x17c))['val'](_0x4823d6[_0x2e0995(0x170)]),$('#amily2_api_key')[_0x2e0995(0x167)](_0x4823d6['apiKey']),$(_0x2e0995(0x171))[_0x2e0995(0x167)](_0x4823d6['model']),$(_0x2e0995(0x161))['val'](_0x4823d6[_0x2e0995(0x16f)]),$(_0x2e0995(0x181))[_0x2e0995(0x14c)](_0x4823d6[_0x2e0995(0x16f)]),$(_0x2e0995(0x174))[_0x2e0995(0x167)](_0x4823d6['temperature']),$(_0x2e0995(0x187))['text'](_0x4823d6['temperature']),$(_0x2e0995(0x177))[_0x2e0995(0x167)](_0x4823d6['contextMessages']),$(_0x2e0995(0x14d))['text'](_0x4823d6[_0x2e0995(0x147)]),$(_0x2e0995(0x163))[_0x2e0995(0x167)](_0x4823d6[_0x2e0995(0x172)]),$(_0x2e0995(0x14b)+_0x4823d6['optimizationMode']+'\x22]')[_0x2e0995(0x158)](_0x2e0995(0x185),!![]),$(_0x2e0995(0x154))[_0x2e0995(0x158)](_0x2e0995(0x185),_0x4823d6['optimizationEnabled']),$(_0x2e0995(0x156))[_0x2e0995(0x158)](_0x2e0995(0x185),_0x4823d6[_0x2e0995(0x159)]),$(_0x2e0995(0x168))[_0x2e0995(0x158)](_0x2e0995(0x185),_0x4823d6[_0x2e0995(0x162)]),$('#amily2_system_prompt')[_0x2e0995(0x167)](_0x4823d6[_0x2e0995(0x173)]),$(_0x2e0995(0x144))[_0x2e0995(0x167)](_0x4823d6[_0x2e0995(0x183)]),$(_0x2e0995(0x17f))['val'](_0x4823d6['outputFormatPrompt']),$(_0x2e0995(0x16c))['val'](_0x4823d6['summarizationPrompt']),$(_0x2e0995(0x152))[_0x2e0995(0x158)](_0x2e0995(0x185),_0x4823d6[_0x2e0995(0x169)]),$(_0x2e0995(0x175))[_0x2e0995(0x158)]('checked',_0x4823d6[_0x2e0995(0x15e)]),$(_0x2e0995(0x186)+_0x4823d6[_0x2e0995(0x155)]+'\x22]')[_0x2e0995(0x158)](_0x2e0995(0x185),!![]),$(_0x2e0995(0x15a)+_0x4823d6['iconLocation']+'\x22]')[_0x2e0995(0x158)](_0x2e0995(0x185),!![]),$('#amily2_auto_hide_enabled')[_0x2e0995(0x158)]('checked',_0x4823d6[_0x2e0995(0x146)]),$('#amily2_auto_hide_threshold')['val'](_0x4823d6['autoHideThreshold']),$(_0x2e0995(0x17e))[_0x2e0995(0x14c)](_0x4823d6[_0x2e0995(0x153)]),$('#amily2_lore_activation_mode')[_0x2e0995(0x167)](_0x4823d6['loreActivationMode']),$('#amily2_lore_insertion_position')[_0x2e0995(0x167)](_0x4823d6['loreInsertionPosition']),$(_0x2e0995(0x176))[_0x2e0995(0x167)](_0x4823d6[_0x2e0995(0x178)]),_0x4823d6[_0x2e0995(0x18d)]===_0x2e0995(0x166)?$(_0x2e0995(0x150))[_0x2e0995(0x184)]():$(_0x2e0995(0x150))[_0x2e0995(0x17b)](),_0x4823d6[_0x2e0995(0x15b)]!==undefined&&$(_0x2e0995(0x14a))[_0x2e0995(0x158)](_0x2e0995(0x185),_0x4823d6[_0x2e0995(0x15b)]),_0x4823d6[_0x2e0995(0x15f)]!==undefined&&$('#amily2_mhb_small_trigger_count')[_0x2e0995(0x167)](_0x4823d6[_0x2e0995(0x15f)]),populateModelDropdown();}}
|