Files
ST-Amily2-Chat-Optimisation/core/api.js
2025-08-13 09:30:12 +08:00

2 lines
16 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const _0xdf9786=_0x374c;(function(_0x41f4ba,_0x2f1e5c){const _0x1d4f9a=_0x374c,_0x1e9dfd=_0x41f4ba();while(!![]){try{const _0x4216dc=parseInt(_0x1d4f9a(0x1ed))/0x1+parseInt(_0x1d4f9a(0x1d5))/0x2*(-parseInt(_0x1d4f9a(0x207))/0x3)+-parseInt(_0x1d4f9a(0x235))/0x4*(-parseInt(_0x1d4f9a(0x1ef))/0x5)+parseInt(_0x1d4f9a(0x1e1))/0x6*(-parseInt(_0x1d4f9a(0x1ea))/0x7)+parseInt(_0x1d4f9a(0x24d))/0x8+-parseInt(_0x1d4f9a(0x25d))/0x9+parseInt(_0x1d4f9a(0x1eb))/0xa*(parseInt(_0x1d4f9a(0x202))/0xb);if(_0x4216dc===_0x2f1e5c)break;else _0x1e9dfd['push'](_0x1e9dfd['shift']());}catch(_0x377c8d){_0x1e9dfd['push'](_0x1e9dfd['shift']());}}}(_0x5444,0xa2df2));import{extension_settings,getContext}from'/scripts/extensions.js';import{characters}from'/script.js';import{world_names}from'/scripts/world-info.js';function _0x5444(){const _0xfb47b0=['[Amily2号-外交部]\x20使节团尝试使用地址:\x20','648905yVxlDJ','陛下,请先赐予\x20API\x20地址与至少一枚\x20API\x20Key。','340oBJTJE','json','content','choices','isArray','similarity','/v1/chat/completions','responseJSON','<i\x20class=\x22fas\x20fa-spinner\x20fa-spin\x22></i>\x20加载中','string','toLowerCase','/v1/','[Amily2号-使节团]\x20已启用“皇家密道”后端代理模式获取模型列表。','[Amily2号-外交部]\x20情报已成功获取并解析。','object','html','\x20位使节任务失败:','replace','[Amily2号-使节团]\x20失败详情汇总:\x0a','33KBADTN','name','API返回错误:\x20','embed','\x20个\x20Google\x20模型\x20(使用第\x20','8679fNtaou','search','cors','log','系统错误','YourUsername','/v1','\x20个模型','配置缺失','length','success','/models','正在轮换使节团获取模型...','info','sort','code','\x20个可用模型','href','split','Google','[Amily2号-外交部]\x20已派遣使者前往云端获取最新情报...','prop','aiplatform.googleapis.com','[Amily2号-内务府]\x20任务取消陛下尚未配置留言板URL。','\x20位使节\x20(Key:\x20...','任务成功','[Amily2号-使节团]\x20全局错误:','map','forceProxyForCustomApi','所有使节均未能完成任务。详情请见控制台(F12)。',']\x20通过后端代理获取模型列表时发生错误:','includes','[Amily2号-使节团]\x20最终带回\x20','陛下,请先赐予\x20API\x20地址。','Key\x20...','[Amily2号-外交部]\x20API\x20类型:\x20',']\x20API响应JSON解析失败:','API错误','trim','https://raw.githubusercontent.com/Wx-2025/ST-Amily2-Chat-Optimisation/refs/heads/main/amily2_message_board.json','localeCompare','append','<option>','origin','audio','\x20失败:\x20','45256UkgclC','[Amily2号-外交部]\x20已成功召唤“皇家信使”(ChatCompletionService)。','\x20个Key)','message','endsWith','substring','X-Custom-Proxy','AMILY2_LOCK_MODEL_FETCHING','models','成功获取\x20','任务排队中','statusText','join','OpenAI\x20兼容','#amily2_api_url','[Amily2号-外交部]\x20任务取消陛下尚未配置情报来源URL。','slice','val','服务器响应异常:\x20',']\x20获取模型列表失败:','filter','warn','application/json','任务总结','1161336cSpjbm','Authorization','stringify','GET','status','获取模型列表失败:\x20','/v1beta/projects/locations/global/models','Bearer\x20','陛下,您提供的\x20API\x20Key\x20无效或为空。','所有使节团任务完成,找到\x20','<i\x20class=\x22fas\x20fa-sync-alt\x22></i>\x20刷新模型','#amily2_model','[Amily2号-使节团]\x20上次任务尚未完成本次任务取消。','无法识别的\x20Google\x20API\x20端点','[Amily2号-外交部]\x20紧急军情外交任务失败','model','5943114oTfTjz','\x20个模型','Invalid\x20JSON\x20response','未知的\x20Google\x20模型列表格式','love.qinyan.xyz','location','546FSGBwY','whisper','no-store','外交任务失败','模型获取失败:\x20','hostname','error','POST','请检查控制台日志','pathname','disabled','/scripts/custom-request.js','2670JNwNyR','\x20个模型\x20(使用第\x20','[Amily2号-使节团]\x20第\x20','empty','data','generativelanguage.googleapis.com','[Amily2号-内务府]\x20获取留言板内容失败:','[Amily2号-使节团]\x20使用\x20Google\x20API\x20Key:\x20...','text','14238lgiheA','4863210ulwxno'];_0x5444=function(){return _0xfb47b0;};return _0x5444();}import{extensionName}from'../utils/settings.js';import{extractContentByTag,replaceContentByTag,extractFullTagBlock}from'../utils/tagProcessor.js';import{getCombinedWorldbookContent,findLatestSummaryLore,DEDICATED_LOREBOOK_NAME,getChatIdentifier}from'./lore.js';function _0x374c(_0x580131,_0x3bb4f2){const _0x54440a=_0x5444();return _0x374c=function(_0x374cac,_0x439059){_0x374cac=_0x374cac-0x1d5;let _0x3ff80c=_0x54440a[_0x374cac];return _0x3ff80c;},_0x374c(_0x580131,_0x3bb4f2);}import{checkAndFixWithAPI as _0x4f69b8}from'./summarizer.js';import{isGoogleEndpoint,convertToGoogleRequest,parseGoogleResponse,buildGoogleApiUrl}from'../core/utils/googleAdapter.js';import{intelligentPoll,createGooglePollingTask,progressTracker}from'../core/utils/pollingManager.js';let ChatCompletionService=undefined;try{const module=await import(_0xdf9786(0x1e0));ChatCompletionService=module['ChatCompletionService'],console[_0xdf9786(0x20a)](_0xdf9786(0x236));}catch(_0x5de69b){console['warn']('[Amily2号-外交部]\x20未能召唤“皇家信使”部分高级功能如Claw代理将受限。请考虑更新SillyTavern版本。',_0x5de69b);}const UPDATE_CHECK_URL='https://raw.githubusercontent.com/Wx-2025/ST-Amily2-Chat-Optimisation/refs/heads/main/amily2_update_info.json',MESSAGE_BOARD_URL=_0xdf9786(0x22e);export async function fetchMessageBoardContent(){const _0x14b8b8=_0xdf9786;if(!MESSAGE_BOARD_URL)return console[_0x14b8b8(0x20a)](_0x14b8b8(0x21e)),null;try{const _0x402226=await fetch(MESSAGE_BOARD_URL,{'cache':_0x14b8b8(0x1d7)});if(!_0x402226['ok'])throw new Error(_0x14b8b8(0x247)+_0x402226[_0x14b8b8(0x251)]);const _0x2e1f2a=await _0x402226['json']();return _0x2e1f2a;}catch(_0x376146){return console[_0x14b8b8(0x1db)](_0x14b8b8(0x1e7),_0x376146),null;}}export async function checkForUpdates(){const _0x51f8bc=_0xdf9786;if(!UPDATE_CHECK_URL||UPDATE_CHECK_URL[_0x51f8bc(0x226)](_0x51f8bc(0x20c)))return console[_0x51f8bc(0x20a)](_0x51f8bc(0x244)),null;try{console[_0x51f8bc(0x20a)](_0x51f8bc(0x21b));const _0x914ebd=await fetch(UPDATE_CHECK_URL,{'method':_0x51f8bc(0x250),'cache':'no-store','mode':_0x51f8bc(0x209)});if(!_0x914ebd['ok'])throw new Error('远方服务器响应异常,状态:\x20'+_0x914ebd[_0x51f8bc(0x251)]);const _0x2b97b9=await _0x914ebd[_0x51f8bc(0x1f0)]();return console[_0x51f8bc(0x20a)](_0x51f8bc(0x1fc)),_0x2b97b9;}catch(_0x4d83fb){return console[_0x51f8bc(0x1db)](_0x51f8bc(0x25b),_0x4d83fb),null;}}function normalizeApiResponse(_0x230fc9){const _0x1ba26c=_0xdf9786;let _0xc0c804=_0x230fc9;if(typeof _0xc0c804==='string')try{_0xc0c804=JSON['parse'](_0xc0c804);}catch(_0xdb2f02){return console['error']('['+extensionName+_0x1ba26c(0x22b),_0xdb2f02),{'error':{'message':_0x1ba26c(0x25f)}};}_0xc0c804&&typeof _0xc0c804[_0x1ba26c(0x1e5)]===_0x1ba26c(0x1fd)&&_0xc0c804[_0x1ba26c(0x1e5)]!==null&&!Array[_0x1ba26c(0x1f3)](_0xc0c804[_0x1ba26c(0x1e5)])&&(Object['hasOwn'](_0xc0c804[_0x1ba26c(0x1e5)],_0x1ba26c(0x1e5))&&(_0xc0c804=_0xc0c804['data']));if(_0xc0c804&&_0xc0c804[_0x1ba26c(0x1f2)]&&_0xc0c804[_0x1ba26c(0x1f2)][0x0])return{'content':_0xc0c804['choices'][0x0][_0x1ba26c(0x238)]?.[_0x1ba26c(0x1f1)]?.[_0x1ba26c(0x22d)]()};if(_0xc0c804&&_0xc0c804['content'])return{'content':_0xc0c804[_0x1ba26c(0x1f1)]['trim']()};if(_0xc0c804&&_0xc0c804[_0x1ba26c(0x1e5)])return{'data':_0xc0c804[_0x1ba26c(0x1e5)]};if(_0xc0c804&&_0xc0c804[_0x1ba26c(0x1db)])return{'error':_0xc0c804['error']};return _0xc0c804;}let isFetchingModels=![];export async function fetchModels(){const _0x3d13e3=_0xdf9786,_0x47dd10=extension_settings[extensionName];if(_0x47dd10&&_0x47dd10[_0x3d13e3(0x223)]){console[_0x3d13e3(0x20a)](_0x3d13e3(0x1fb));const _0x6b2fc3=$(_0x3d13e3(0x243))[_0x3d13e3(0x246)]()[_0x3d13e3(0x22d)](),_0x57119d=$('#amily2_refresh_models');if(!_0x6b2fc3)return toastr[_0x3d13e3(0x1db)](_0x3d13e3(0x228),_0x3d13e3(0x20f)),[];_0x57119d[_0x3d13e3(0x21c)](_0x3d13e3(0x1df),!![])[_0x3d13e3(0x1fe)](_0x3d13e3(0x1f7));try{const _0x4f1780=await $['ajax']({'url':'/api/backends/chat-completions/status','type':_0x3d13e3(0x1dc),'contentType':_0x3d13e3(0x24b),'data':JSON[_0x3d13e3(0x24f)]({'chat_completion_source':'custom','custom_url':_0x6b2fc3})}),_0x3466e6=normalizeApiResponse(_0x4f1780),_0x2e4988=_0x3466e6[_0x3d13e3(0x1e5)]||[];if(_0x3466e6[_0x3d13e3(0x1db)]||!Array[_0x3d13e3(0x1f3)](_0x2e4988)){const _0x462c96=_0x3466e6['error']?.[_0x3d13e3(0x238)]||'API未返回有效的模型列表数组。';return toastr[_0x3d13e3(0x1db)](_0x3d13e3(0x252)+_0x462c96,_0x3d13e3(0x22c)),console[_0x3d13e3(0x1db)]('['+extensionName+_0x3d13e3(0x248),_0x4f1780),[];}const _0x256c7a=_0x2e4988[_0x3d13e3(0x215)]((_0x15ae75,_0x4b8fb4)=>(_0x15ae75['id']||_0x15ae75['model']||'')['localeCompare'](_0x4b8fb4['id']||_0x4b8fb4[_0x3d13e3(0x25c)]||''));return toastr[_0x3d13e3(0x211)]('通过后端代理成功获取\x20'+_0x256c7a['length']+_0x3d13e3(0x25e),'操作成功'),_0x256c7a[_0x3d13e3(0x222)](_0x298495=>_0x298495['id']||_0x298495[_0x3d13e3(0x25c)])[_0x3d13e3(0x249)](Boolean);}catch(_0x29b01b){console[_0x3d13e3(0x1db)]('['+extensionName+_0x3d13e3(0x225),_0x29b01b);const _0x4bbc17=_0x29b01b[_0x3d13e3(0x1f6)]?.[_0x3d13e3(0x1db)]?.[_0x3d13e3(0x238)]||_0x29b01b[_0x3d13e3(0x240)]||_0x29b01b[_0x3d13e3(0x238)]||_0x3d13e3(0x1dd);return toastr[_0x3d13e3(0x1db)](_0x3d13e3(0x252)+_0x4bbc17,_0x3d13e3(0x22c)),[];}finally{_0x57119d[_0x3d13e3(0x21c)](_0x3d13e3(0x1df),![])[_0x3d13e3(0x1fe)](_0x3d13e3(0x257));}}if(window[_0x3d13e3(0x23c)])return console[_0x3d13e3(0x24a)](_0x3d13e3(0x259)),toastr[_0x3d13e3(0x214)]('上次任务尚未完成,请稍后再试。',_0x3d13e3(0x23f)),[];window[_0x3d13e3(0x23c)]=!![];try{const _0x3f8e09=$('#amily2_api_url')[_0x3d13e3(0x246)]()['trim'](),_0xfe878b=$('#amily2_api_key')['val']()[_0x3d13e3(0x22d)](),_0x1d6173=$('#amily2_refresh_models'),_0x4e0878=$(_0x3d13e3(0x258));if(!_0x3f8e09||!_0xfe878b)return toastr[_0x3d13e3(0x1db)](_0x3d13e3(0x1ee),_0x3d13e3(0x20f)),[];_0x1d6173[_0x3d13e3(0x21c)](_0x3d13e3(0x1df),!![])[_0x3d13e3(0x1fe)](_0x3d13e3(0x1f7)),_0x4e0878[_0x3d13e3(0x1e4)]()['append']($(_0x3d13e3(0x231),{'value':'','text':_0x3d13e3(0x213)}));const _0x2d510e=_0xfe878b[_0x3d13e3(0x219)](',')[_0x3d13e3(0x222)](_0x3066f6=>_0x3066f6[_0x3d13e3(0x22d)]())[_0x3d13e3(0x249)](Boolean);if(_0x2d510e['length']===0x0)return toastr[_0x3d13e3(0x1db)](_0x3d13e3(0x255),'API\x20Key无效'),_0x4e0878[_0x3d13e3(0x1e4)]()[_0x3d13e3(0x230)]($(_0x3d13e3(0x231),{'value':'','text':'API\x20Key无效'})),[];const _0x1e8178=[];let _0x219ca3=[];for(let _0x28c338=0x0;_0x28c338<_0x2d510e[_0x3d13e3(0x210)];_0x28c338++){const _0x5e0f83=_0x2d510e[_0x28c338];console[_0x3d13e3(0x20a)]('[Amily2号-使节团]\x20派遣第\x20'+(_0x28c338+0x1)+'/'+_0x2d510e[_0x3d13e3(0x210)]+_0x3d13e3(0x21f)+_0x5e0f83['slice'](-0x4)+')\x20...');try{let _0x5794a4;const _0x5aa97b=new URL(_0x3f8e09),_0x545943=isGoogleEndpoint(_0x3f8e09);if(_0x545943){if(_0x5aa97b[_0x3d13e3(0x1da)][_0x3d13e3(0x226)]('generativelanguage.googleapis.com')||_0x5aa97b[_0x3d13e3(0x1da)][_0x3d13e3(0x226)]('ai.google.dev'))_0x5aa97b['pathname']='/v1beta/models';else{if(_0x5aa97b[_0x3d13e3(0x1da)]['includes'](_0x3d13e3(0x21d)))_0x5aa97b[_0x3d13e3(0x1de)]=_0x3d13e3(0x253);else throw new Error(_0x3d13e3(0x25a));}_0x5794a4=_0x5aa97b[_0x3d13e3(0x218)];}else{let _0x530591=_0x5aa97b[_0x3d13e3(0x1de)];if(_0x530591[_0x3d13e3(0x1f9)]()['includes']('/openai'))_0x530591=_0x530591[_0x3d13e3(0x200)](/\/$/,'');else{if(_0x530591[_0x3d13e3(0x239)](_0x3d13e3(0x1f5)))_0x530591=_0x530591[_0x3d13e3(0x23a)](0x0,_0x530591[_0x3d13e3(0x210)]-'/chat/completions'['length']);else{if(_0x530591[_0x3d13e3(0x239)](_0x3d13e3(0x1fa)))_0x530591=_0x530591['slice'](0x0,-0x1);else!_0x530591[_0x3d13e3(0x239)](_0x3d13e3(0x20d))&&(_0x530591=_0x530591['replace'](/\/$/,'')+_0x3d13e3(0x20d));}}_0x5aa97b[_0x3d13e3(0x1de)]=_0x530591[_0x3d13e3(0x200)](/\/$/,'')+_0x3d13e3(0x212),_0x5794a4=_0x5aa97b[_0x3d13e3(0x218)];}console[_0x3d13e3(0x20a)](_0x3d13e3(0x1ec)+_0x5794a4),console[_0x3d13e3(0x20a)](_0x3d13e3(0x22a)+(_0x545943?_0x3d13e3(0x21a):_0x3d13e3(0x242)));const _0x108441={'Content-Type':_0x3d13e3(0x24b),'Accept':_0x3d13e3(0x24b)};if(_0x545943){console['log'](_0x3d13e3(0x1e8)+_0x5e0f83[_0x3d13e3(0x245)](-0x4));if(_0x5aa97b[_0x3d13e3(0x1da)][_0x3d13e3(0x226)](_0x3d13e3(0x1e6))||_0x5aa97b['hostname'][_0x3d13e3(0x226)]('ai.google.dev'))_0x108441['X-goog-api-key']=_0x5e0f83;else _0x5aa97b[_0x3d13e3(0x1da)][_0x3d13e3(0x226)]('aiplatform.googleapis.com')&&(_0x108441[_0x3d13e3(0x24e)]=_0x3d13e3(0x254)+_0x5e0f83);}else _0x108441[_0x3d13e3(0x24e)]=_0x3d13e3(0x254)+_0x5e0f83;_0x5794a4[_0x3d13e3(0x226)](_0x3d13e3(0x261))&&(_0x108441[_0x3d13e3(0x23b)]='Amily2-ChatPlugin',_0x108441['Origin']=window[_0x3d13e3(0x262)][_0x3d13e3(0x232)]);const _0x5888f3=await fetch(_0x5794a4,{'method':_0x3d13e3(0x250),'headers':_0x108441,'mode':_0x3d13e3(0x209),'credentials':'omit'});if(!_0x5888f3['ok']){let _0x5972c0='';try{const _0x2f6ef5=await _0x5888f3[_0x3d13e3(0x1f0)]();_0x5972c0=JSON[_0x3d13e3(0x24f)](_0x2f6ef5,null,0x2);}catch{try{_0x5972c0=await _0x5888f3[_0x3d13e3(0x1e9)]();}catch(_0x30be88){_0x5972c0='<无法提取错误正文>';}}throw new Error(_0x3d13e3(0x204)+_0x5888f3[_0x3d13e3(0x251)]+'\x20'+_0x5888f3[_0x3d13e3(0x240)]+'\x0a'+_0x5972c0);}const _0x21933e=await _0x5888f3['json']();let _0x22fdb9=[];if(_0x545943){if(_0x21933e[_0x3d13e3(0x23d)]&&Array[_0x3d13e3(0x1f3)](_0x21933e['models']))_0x22fdb9=_0x21933e[_0x3d13e3(0x23d)][_0x3d13e3(0x222)](_0xf6522d=>_0xf6522d[_0x3d13e3(0x203)]);else{if(_0x21933e['data']&&Array[_0x3d13e3(0x1f3)](_0x21933e[_0x3d13e3(0x1e5)]))_0x22fdb9=_0x21933e[_0x3d13e3(0x1e5)][_0x3d13e3(0x222)](_0x511e5c=>_0x511e5c['name']||_0x511e5c['id']);else{if(Array[_0x3d13e3(0x1f3)](_0x21933e))_0x22fdb9=_0x21933e[_0x3d13e3(0x222)](_0x640981=>_0x640981[_0x3d13e3(0x203)]);else throw new Error(_0x3d13e3(0x260));}}}else{if(Array[_0x3d13e3(0x1f3)](_0x21933e))_0x22fdb9=_0x21933e[_0x3d13e3(0x222)](_0x3bab39=>_0x3bab39['id']||_0x3bab39);else{if(_0x21933e['data']&&Array[_0x3d13e3(0x1f3)](_0x21933e[_0x3d13e3(0x1e5)]))_0x22fdb9=_0x21933e[_0x3d13e3(0x1e5)][_0x3d13e3(0x222)](_0x4882eb=>_0x4882eb['id']);else{if(_0x21933e['models']&&Array[_0x3d13e3(0x1f3)](_0x21933e['models']))_0x22fdb9=_0x21933e[_0x3d13e3(0x23d)][_0x3d13e3(0x222)](_0x44d9a1=>_0x44d9a1['id']);else throw new Error('未知的模型列表格式');}}}const _0x2c7bef=_0x22fdb9[_0x3d13e3(0x249)](_0x503765=>typeof _0x503765===_0x3d13e3(0x1f8))[_0x3d13e3(0x249)](_0x3aa010=>!_0x3aa010[_0x3d13e3(0x1f9)]()[_0x3d13e3(0x226)](_0x3d13e3(0x205)))['filter'](_0x5be006=>!_0x5be006[_0x3d13e3(0x1f9)]()[_0x3d13e3(0x226)](_0x3d13e3(0x208)))['filter'](_0x1c437e=>!_0x1c437e[_0x3d13e3(0x1f9)]()['includes'](_0x3d13e3(0x1f4)))[_0x3d13e3(0x249)](_0x45c6d6=>!_0x45c6d6[_0x3d13e3(0x1f9)]()[_0x3d13e3(0x226)](_0x3d13e3(0x233)))[_0x3d13e3(0x249)](_0x3e2069=>!_0x3e2069[_0x3d13e3(0x1f9)]()['includes'](_0x3d13e3(0x216)))[_0x3d13e3(0x249)](_0x19bcf9=>!_0x19bcf9['toLowerCase']()[_0x3d13e3(0x226)](_0x3d13e3(0x1d6)));_0x2c7bef[_0x3d13e3(0x215)]((_0x431958,_0x56ebe7)=>_0x431958[_0x3d13e3(0x22f)](_0x56ebe7)),console[_0x3d13e3(0x20a)](_0x3d13e3(0x1e3)+(_0x28c338+0x1)+'\x20位使节成功带回\x20'+_0x2c7bef[_0x3d13e3(0x210)]+_0x3d13e3(0x20e)),_0x219ca3=[...new Set([..._0x219ca3,..._0x2c7bef])],_0x219ca3[_0x3d13e3(0x215)]();_0x545943?toastr['success'](_0x3d13e3(0x23e)+_0x2c7bef[_0x3d13e3(0x210)]+_0x3d13e3(0x206)+(_0x28c338+0x1)+_0x3d13e3(0x237),_0x3d13e3(0x220)):toastr[_0x3d13e3(0x211)](_0x3d13e3(0x23e)+_0x2c7bef[_0x3d13e3(0x210)]+_0x3d13e3(0x1e2)+(_0x28c338+0x1)+_0x3d13e3(0x237),_0x3d13e3(0x220));break;}catch(_0x230862){const _0x2e97e3=_0x3d13e3(0x229)+_0x5e0f83[_0x3d13e3(0x245)](-0x4)+_0x3d13e3(0x234)+_0x230862[_0x3d13e3(0x238)];console[_0x3d13e3(0x1db)](_0x3d13e3(0x1e3)+(_0x28c338+0x1)+_0x3d13e3(0x1ff),_0x230862),_0x1e8178['push'](_0x2e97e3);}}if(_0x219ca3[_0x3d13e3(0x210)]>0x0)return console[_0x3d13e3(0x20a)](_0x3d13e3(0x227)+_0x219ca3[_0x3d13e3(0x210)]+_0x3d13e3(0x217)),toastr[_0x3d13e3(0x214)](_0x3d13e3(0x256)+_0x219ca3[_0x3d13e3(0x210)]+_0x3d13e3(0x217),_0x3d13e3(0x24c)),_0x219ca3;return toastr[_0x3d13e3(0x1db)](_0x3d13e3(0x224),_0x3d13e3(0x1d8)),console[_0x3d13e3(0x1db)](_0x3d13e3(0x201)+_0x1e8178[_0x3d13e3(0x241)]('\x0a')),[];}catch(_0x4b810c){return console[_0x3d13e3(0x1db)](_0x3d13e3(0x221),_0x4b810c),toastr['error'](_0x3d13e3(0x1d9)+_0x4b810c['message'],_0x3d13e3(0x20b)),[];}finally{window[_0x3d13e3(0x23c)]=![];const _0x85a690=$('#amily2_refresh_models');_0x85a690[_0x3d13e3(0x21c)]('disabled',![])['html']('<i\x20class=\x22fas\x20fa-sync-alt\x22></i>\x20刷新模型');}}export async function checkAndFixWithAPI(_0x263832,_0x30b114){return await _0x4f69b8(_0x263832,_0x30b114);}