1313from app .services .kronos_predict_service import KronosPredictService
1414from app .services .sqlite_store import SQLiteStateStore
1515from app .services .time_utils import now_cn
16- from app .services .tradingagents_adapter import TradingAgentsAdapter
16+ from app .services .tradingagents_adapter import (
17+ DEFAULT_DEEP_MODEL ,
18+ DEFAULT_QUICK_MODEL ,
19+ DEEPSEEK_PROVIDER ,
20+ TradingAgentsAdapter ,
21+ )
1722
1823log = logging .getLogger (__name__ )
1924
3742 "tradingagents_enabled" : True ,
3843 "tradingagents_top_n" : 20 ,
3944 "tradingagents_timeout_seconds" : 240 ,
40- "tradingagents_provider" : "deepseek" ,
41- "tradingagents_quick_model" : "deepseek-chat" ,
42- "tradingagents_deep_model" : "deepseek-chat" ,
45+ "tradingagents_provider" : DEEPSEEK_PROVIDER ,
46+ "tradingagents_quick_model" : DEFAULT_QUICK_MODEL ,
47+ "tradingagents_deep_model" : DEFAULT_DEEP_MODEL ,
4348}
4449
4550AUTO_LIGHT_TOP_N = 12
@@ -127,6 +132,9 @@ def update_config(self, patch: dict[str, Any]) -> dict[str, Any]:
127132 cfg ["tradingagents_enabled" ] = bool (cfg ["tradingagents_enabled" ])
128133 cfg ["tradingagents_top_n" ] = max (0 , min (int (cfg ["tradingagents_top_n" ]), 20 ))
129134 cfg ["tradingagents_timeout_seconds" ] = max (30 , min (int (cfg ["tradingagents_timeout_seconds" ]), 900 ))
135+ cfg ["tradingagents_provider" ] = DEEPSEEK_PROVIDER
136+ cfg ["tradingagents_quick_model" ] = str (cfg .get ("tradingagents_quick_model" ) or DEFAULT_QUICK_MODEL ).strip () or DEFAULT_QUICK_MODEL
137+ cfg ["tradingagents_deep_model" ] = str (cfg .get ("tradingagents_deep_model" ) or DEFAULT_DEEP_MODEL ).strip () or DEFAULT_DEEP_MODEL
130138 self ._snapshot ["config" ] = cfg
131139 self ._save_state ()
132140 return cfg
@@ -214,6 +222,11 @@ async def _execute(self, trigger: str) -> dict[str, Any]:
214222 pools = self ._build_pools (entries , cfg )
215223 trade_date = entries [0 ]["trade_date" ] if entries else now_cn ().date ().isoformat ()
216224 avg_score = round (sum (float (item ["score" ]) for item in entries ) / max (len (entries ), 1 ), 2 ) if entries else 0.0
225+ ta_runtime = (
226+ self .tradingagents .describe_runtime ()
227+ if self .tradingagents is not None and hasattr (self .tradingagents , "describe_runtime" )
228+ else {}
229+ )
217230 self .progress .update (phase = "done" , current = total , total = total , detail = f"完成分析 { len (entries )} 只" )
218231 return {
219232 "trade_date" : trade_date ,
@@ -238,6 +251,10 @@ async def _execute(self, trigger: str) -> dict[str, Any]:
238251 "tradingagents_discussed" : discussion_meta .get ("discussed_count" , 0 ),
239252 "tradingagents_cache_hits" : discussion_meta .get ("cache_hits" , 0 ),
240253 "tradingagents_failures" : discussion_meta .get ("failed" , 0 ),
254+ "tradingagents_backend" : "TradingAgents + DeepSeek" if self .tradingagents is not None else "disabled" ,
255+ "tradingagents_repo_path" : ta_runtime .get ("repo_path" , "" ),
256+ "tradingagents_provider" : ta_runtime .get ("provider" , DEEPSEEK_PROVIDER ),
257+ "tradingagents_backend_url" : ta_runtime .get ("backend_url" , "" ),
241258 "execution_mode" : "light_auto" if trigger == "auto" else "full_manual" ,
242259 "runtime_top_n" : int (runtime_cfg ["top_n" ]),
243260 "thresholds" : {
0 commit comments