From ff85b0581aac311bb26b0ab1f56b6487e4ba34ec Mon Sep 17 00:00:00 2001 From: OG T Date: Wed, 1 Apr 2026 22:33:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(ai):=20=E4=BF=AE=E5=BE=A9=20analyze=5Fand?= =?UTF-8?q?=5Fpropose=20=E6=96=B9=E6=B3=95=E5=91=BC=E5=8F=AB=E9=8C=AF?= =?UTF-8?q?=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - OpenClawService 沒有 analyze(), 正確方法是 analyze_alert(alert_context) - 包裝 host_statuses 為 alert_ctx 傳入 - 解包返回值 (8-tuple) 用 *_ 忽略尾端 Co-Authored-By: Claude Sonnet 4.6 --- apps/api/src/api/v1/ai.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/api/src/api/v1/ai.py b/apps/api/src/api/v1/ai.py index 320aaddb0..9e49f551f 100644 --- a/apps/api/src/api/v1/ai.py +++ b/apps/api/src/api/v1/ai.py @@ -174,7 +174,17 @@ async def analyze_and_propose( # Step 2: 呼叫 OpenClaw AI try: openclaw = get_openclaw() - decision, provider, raw_response = await openclaw.analyze(host_statuses) + # 2026-04-01 Claude Code: 修復方法呼叫 analyze → analyze_alert + # OpenClawService 只有 analyze_alert(alert_context), 無 analyze(host_statuses) + alert_ctx = { + "alert_type": "host_status_check", + "severity": "medium", + "target_resource": "awoooi-api", + "namespace": "awoooi-prod", + "host_statuses": host_statuses, + } + analysis_result, provider, raw_response, *_ = await openclaw.analyze_alert(alert_ctx) + decision = analysis_result logger.info( "ai_analysis_complete",