diff --git a/apps/api/src/services/openclaw.py b/apps/api/src/services/openclaw.py index d3ef3afa2..7b33be2e7 100644 --- a/apps/api/src/services/openclaw.py +++ b/apps/api/src/services/openclaw.py @@ -1261,7 +1261,8 @@ Focus on: "severity": severity, } - raw_response, provider, success, from_cache = await self._call_with_cache( + # 2026-03-29 ogt: 修復 tuple unpacking (Token/Cost 追蹤) + raw_response, provider, success, from_cache, ai_tokens, ai_cost = await self._call_with_cache( proposal_prompt, alert_context, signoz_metrics, @@ -1290,6 +1291,7 @@ Focus on: ) # 轉換為 proposal dict (optimization_suggestions 是 list[dict]) + # 2026-03-29 ogt: 加入 ai_tokens/ai_cost 追蹤 proposal_dict = { "action": result.action_title, "description": result.description, @@ -1311,6 +1313,8 @@ Focus on: "signoz_correlation": result.signoz_correlation, "from_cache": from_cache, "provider": provider, + "ai_tokens": ai_tokens, + "ai_cost": ai_cost, } return proposal_dict, provider, True