diff --git a/apps/api/src/models/ai.py b/apps/api/src/models/ai.py index 50e72d70..9986ec1c 100644 --- a/apps/api/src/models/ai.py +++ b/apps/api/src/models/ai.py @@ -94,11 +94,18 @@ class OpenClawDecision(BaseModel): default="default", description="Kubernetes namespace", ) - kubectl_command: str = Field( + # 2026-03-29 ogt: 允許 None,LLM 可能返回 null + kubectl_command: str | None = Field( default="", description="具體的 kubectl 指令", ) + @field_validator("kubectl_command", mode="before") + @classmethod + def normalize_kubectl_command(cls, v): + """將 null 轉換為空字串""" + return v if v is not None else "" + # === 風險評估欄位 === risk_level: AIRiskLevel = Field( ...,