fix(api): fix optimization_suggestions dict access in proposal generation
The optimization_suggestions field is list[dict], not list[object]. Use .get() to access dict keys instead of attribute access. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1155,7 +1155,7 @@ Focus on:
|
||||
from_cache=from_cache,
|
||||
)
|
||||
|
||||
# 轉換為 proposal dict
|
||||
# 轉換為 proposal dict (optimization_suggestions 是 list[dict])
|
||||
proposal_dict = {
|
||||
"action": result.action_title,
|
||||
"description": result.description,
|
||||
@@ -1168,9 +1168,9 @@ Focus on:
|
||||
"primary_responsibility": result.primary_responsibility,
|
||||
"optimization_suggestions": [
|
||||
{
|
||||
"type": s.type,
|
||||
"description": s.description,
|
||||
"kubectl_or_config": s.kubectl_or_config,
|
||||
"type": s.get("type", "UNKNOWN"),
|
||||
"description": s.get("description", ""),
|
||||
"kubectl_or_config": s.get("kubectl_or_config", ""),
|
||||
}
|
||||
for s in result.optimization_suggestions
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user