openclawsetup 2.8.7 → 2.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.mjs +10 -1
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -2549,7 +2549,16 @@ function testModelChat(cliName, timeoutMs = MODEL_CHAT_TIMEOUT_MS) {
|
|
|
2549
2549
|
const message = parsed?.result?.payloads?.[0]?.text || '';
|
|
2550
2550
|
const provider = parsed?.result?.meta?.agentMeta?.provider || '';
|
|
2551
2551
|
const modelId = parsed?.result?.meta?.agentMeta?.model || '';
|
|
2552
|
-
|
|
2552
|
+
|
|
2553
|
+
// 检查回复内容是否实际上是错误信息
|
|
2554
|
+
const msgLower = message.toLowerCase();
|
|
2555
|
+
if (msgLower.includes('401') && (msgLower.includes('invalid api key') || msgLower.includes('unauthorized'))) {
|
|
2556
|
+
resolve({ success: false, error: 'API Key 无效 (401)' });
|
|
2557
|
+
} else if (msgLower.includes('403') && (msgLower.includes('forbidden') || msgLower.includes('access denied'))) {
|
|
2558
|
+
resolve({ success: false, error: 'API 访问被拒绝 (403)' });
|
|
2559
|
+
} else if (/^http\s+\d{3}:/i.test(message.trim())) {
|
|
2560
|
+
resolve({ success: false, error: message.substring(0, 200) });
|
|
2561
|
+
} else if (message || (provider && modelId)) {
|
|
2553
2562
|
resolve({ success: true, message, provider, model: modelId });
|
|
2554
2563
|
} else {
|
|
2555
2564
|
resolve({ success: false, error: '模型未返回内容' });
|