Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/agents/tradingagents/auto_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def _read_auto_trigger_config(db: Session) -> dict | None:
"""从 AgentConfig.raw_config 读 auto_trigger 配置。
"""从 AgentConfig.config 读 auto_trigger 配置。

Returns:
{
Expand All @@ -42,7 +42,7 @@ def _read_auto_trigger_config(db: Session) -> dict | None:
agent = db.query(AgentConfig).filter(AgentConfig.name == "tradingagents").first()
if not agent:
return None
raw = agent.raw_config or {}
raw = agent.config or {}
auto = raw.get("auto_trigger") or {}
if not auto.get("enabled"):
return None
Expand All @@ -69,7 +69,7 @@ def _within_cooldown(db: Session, stock_symbol: str, cooldown_hours: int) -> boo


def _budget_allows(db: Session) -> bool:
"""检查月度预算是否还有余量。预算从 tradingagents 的 raw_config.monthly_budget_usd 读。"""
"""检查月度预算是否还有余量。预算从 tradingagents 的 config.monthly_budget_usd 读。"""
try:
from src.agents.tradingagents.cost_tracker import check_budget
except ImportError:
Expand All @@ -78,7 +78,7 @@ def _budget_allows(db: Session) -> bool:
agent = db.query(AgentConfig).filter(AgentConfig.name == "tradingagents").first()
if not agent:
return True
raw = agent.raw_config or {}
raw = agent.config or {}
budget = float(raw.get("monthly_budget_usd") or 0.0)
if budget <= 0:
return True # 没设上限 = 不限制
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tradingagents_auto_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def _make_agent(raw_config: dict):
agent = MagicMock()
agent.raw_config = raw_config
agent.config = raw_config
return agent


Expand Down