mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-27 06:56:39 +03:00
refactor: one name per decision in the state and its log
- the Research Manager's plan and the Portfolio Manager's decision live only in investment_plan and final_trade_decision; the debate states no longer copy them as judge_decision - the saved state log writes the Trader's plan as trader_investment_plan, its state key - the report tree, the final display and the live CLI read the decisions from those fields
This commit is contained in:
@@ -48,9 +48,9 @@ def _state(ticker, final="评级: 买入"):
|
||||
"fundamentals_report": "基本面", "investment_plan": "计划",
|
||||
"trader_investment_plan": "交易计划", "final_trade_decision": final, "final_rating": "REVIEW",
|
||||
"investment_debate_state": {"bull_history": "", "bear_history": "", "history": "",
|
||||
"current_response": "", "judge_decision": "", "count": 0},
|
||||
"current_response": "", "count": 0},
|
||||
"risk_debate_state": {"aggressive_history": "", "conservative_history": "",
|
||||
"neutral_history": "", "history": "", "judge_decision": "",
|
||||
"neutral_history": "", "history": "",
|
||||
"latest_speaker": "", "current_aggressive_response": "",
|
||||
"current_conservative_response": "", "current_neutral_response": "",
|
||||
"count": 0},
|
||||
@@ -76,6 +76,19 @@ def test_the_state_log_keeps_non_ascii_readable(tmp_path):
|
||||
assert json.loads(written) # still valid JSON
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_the_state_log_names_each_field_as_the_state_does(tmp_path):
|
||||
"""One name per field: the Trader's plan under its state key, and no second
|
||||
copy of the managers' decisions under the debate states."""
|
||||
_bare_graph(tmp_path)._log_state("2026-09-01", _state("NVDA"))
|
||||
|
||||
logged = json.loads(next(tmp_path.rglob("full_states_log*.json")).read_text(encoding="utf-8"))
|
||||
assert logged["trader_investment_plan"] == "交易计划"
|
||||
assert logged["investment_plan"] == "计划"
|
||||
assert "trader_investment_decision" not in logged
|
||||
assert "judge_decision" not in json.dumps(logged)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_the_live_display_does_not_scroll_the_terminal():
|
||||
"""A layout taller than the window makes rich redraw by scrolling, which
|
||||
|
||||
Reference in New Issue
Block a user