From a9425007121ca4c31d46528e0e6dedd3651f1f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Mon, 24 Aug 2026 20:46:03 -0400 Subject: [PATCH] AI test: correct http code capture on connection failure Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp --- bin/omarchy-cn-ai-test | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/omarchy-cn-ai-test b/bin/omarchy-cn-ai-test index 2c3dfcfb..c8485ce6 100755 --- a/bin/omarchy-cn-ai-test +++ b/bin/omarchy-cn-ai-test @@ -40,19 +40,20 @@ anthropic) -X POST "${base%/}/v1/messages" \ -H "x-api-key: $key" -H "authorization: Bearer $key" \ -H "anthropic-version: 2023-06-01" -H "content-type: application/json" \ - -d "{\"model\":\"$model\",\"max_tokens\":8,\"messages\":[{\"role\":\"user\",\"content\":\"ping\"}]}" || echo 000) + -d "{\"model\":\"$model\",\"max_tokens\":8,\"messages\":[{\"role\":\"user\",\"content\":\"ping\"}]}" || true) ;; openai) code=$(curl -sS -o /tmp/omarchycn-ai-test-body -w '%{http_code}' -m 30 --connect-timeout 8 \ -X POST "${base%/}/chat/completions" \ -H "Authorization: Bearer $key" -H "content-type: application/json" \ - -d "{\"model\":\"$model\",\"max_tokens\":8,\"messages\":[{\"role\":\"user\",\"content\":\"ping\"}]}" || echo 000) + -d "{\"model\":\"$model\",\"max_tokens\":8,\"messages\":[{\"role\":\"user\",\"content\":\"ping\"}]}" || true) ;; *) echo "FAIL ai-test: unknown protocol $proto" exit 1 ;; esac +[[ -z $code ]] && code=000 case "$code" in 200)