refactor(openclaw): SuggestedAction 改用頂部 import (避免 inline 三重巢狀)
IDE 對 inline "from src.models.ai import" 誤報(但運行正常)。 改為頂部 import 既滿足 IDE 也更 Pythonic。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,7 @@ from src.core.prompts import NEMOTRON_SYSTEM_PROMPT, OPENCLAW_SYSTEM_PROMPT
|
||||
from src.core.redis_client import get_redis
|
||||
from src.models.ai import (
|
||||
OpenClawDecision,
|
||||
SuggestedAction,
|
||||
)
|
||||
from src.services.langfuse_client import langfuse_trace
|
||||
from src.services.model_registry import get_model_registry
|
||||
@@ -1344,10 +1345,9 @@ Trace URL: {signoz_trace_url}
|
||||
# 降級為安全調查動作,不執行破壞性操作
|
||||
result.kubectl_command = f"kubectl get deploy -n {_k8s_ns}"
|
||||
result.target_resource = "unknown(hallucinated)"
|
||||
# Pydantic enum 處理: 若不能直接賦 str 就跳過
|
||||
# Pydantic enum 處理 — SuggestedAction 已在檔頂 import (line 34)
|
||||
try:
|
||||
from src.models.ai import SuggestedAction as _SA
|
||||
result.suggested_action = _SA.NO_ACTION
|
||||
result.suggested_action = SuggestedAction.NO_ACTION
|
||||
except Exception:
|
||||
pass
|
||||
result.description = (
|
||||
|
||||
Reference in New Issue
Block a user