From 8ba2cae1a13cef01380b5635242f0cf3ba7e203c Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Mon, 26 Jan 2026 14:20:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=B1=B3=20M?= =?UTF-8?q?imo=20API=20=E7=AB=AF=E7=82=B9=E9=97=AE=E9=A2=98=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除无效的默认端点 api.mimo.xiaomi.com(DNS 无法解析) - 小米 Mimo 现在要求用户在 API 端点字段中填写平台提供的自定义端点 - 添加针对小米 Mimo 的友好错误提示,引导用户访问 platform.xiaomimimo.com - 在 JavaScript 中添加 console.log 调试输出,便于排查问题 - 改进错误处理,显示完整的 xhr 响应信息 --- functions.php | 8 ++++++-- settings.php | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 0e17d58..f89a869 100644 --- a/functions.php +++ b/functions.php @@ -8804,7 +8804,7 @@ function argon_ajax_test_unified_api() { 'openai' => 'https://api.openai.com/v1/chat/completions', 'anthropic' => 'https://api.anthropic.com/v1/messages', 'deepseek' => 'https://api.deepseek.com/v1/chat/completions', - 'xiaomi' => 'https://api.mimo.xiaomi.com/v1/chat/completions', + 'xiaomi' => '', // 小米 Mimo 需要在平台获取自定义端点 'qianwen' => 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions', 'wenxin' => 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions', 'doubao' => 'https://ark.cn-beijing.volces.com/api/v3/chat/completions', @@ -8816,7 +8816,11 @@ function argon_ajax_test_unified_api() { $api_endpoint = !empty($api['api_endpoint']) ? $api['api_endpoint'] : (isset($default_endpoints[$api['provider']]) ? $default_endpoints[$api['provider']] : ''); if (empty($api_endpoint)) { - wp_send_json_error('未配置 API 端点'); + if ($api['provider'] === 'xiaomi') { + wp_send_json_error('小米 Mimo 需要配置自定义 API 端点。请访问 https://platform.xiaomimimo.com 获取您的专属端点地址'); + } else { + wp_send_json_error('未配置 API 端点'); + } return; } diff --git a/settings.php b/settings.php index 2ce5a8a..4d47fe9 100644 --- a/settings.php +++ b/settings.php @@ -2451,6 +2451,7 @@ function themeoptions_page(){ nonce: '', api_id: apiId }, function(response) { + console.log('Response:', response); if (response.success) { alert('✓ ' + response.data.message); } else { @@ -2461,7 +2462,8 @@ function themeoptions_page(){ $btn.prop('disabled', false).html(originalHtml); }).fail(function(xhr, status, error) { // AJAX 请求本身失败 - console.error('AJAX Error:', status, error); + console.error('AJAX Error:', xhr, status, error); + console.error('Response Text:', xhr.responseText); alert(''); $btn.prop('disabled', false).html(originalHtml); });