fix(decision): add missing actions to AI prompt (#983)

问题:AI 返回 adjust_stop_loss 导致决策验证失败
根因:prompt 只列出 6 个 action,缺少 3 个有效 action

修复(TDD):
1. 添加测试验证 prompt 包含所有 9 个有效 action
2. 最小修改:在 action 列表中补充 3 个缺失项
   - update_stop_loss
   - update_take_profit
   - partial_close

测试:
- TestBuildSystemPrompt_ContainsAllValidActions 
- TestBuildSystemPrompt_ActionListCompleteness 

Fixes: 无效的action: adjust_stop_loss
This commit is contained in:
Lawrence Liu
2025-11-16 08:13:34 +08:00
committed by tangmengqiu
parent b690debf5e
commit a74aed5a20
2 changed files with 51 additions and 1 deletions

View File

@@ -350,7 +350,7 @@ func buildSystemPrompt(accountEquity float64, btcEthLeverage, altcoinLeverage in
sb.WriteString("]\n```\n")
sb.WriteString("</decision>\n\n")
sb.WriteString("## 字段说明\n\n")
sb.WriteString("- `action`: open_long | open_short | close_long | close_short | hold | wait\n")
sb.WriteString("- `action`: open_long | open_short | close_long | close_short | update_stop_loss | update_take_profit | partial_close | hold | wait\n")
sb.WriteString("- `confidence`: 0-100开仓建议≥75\n")
sb.WriteString("- 开仓时必填: leverage, position_size_usd, stop_loss, take_profit, confidence, risk_usd, reasoning\n\n")