From fa2f2a255d710eb68e10118897f79e079d35887b Mon Sep 17 00:00:00 2001 From: MarkLo Date: Tue, 25 Nov 2025 19:22:42 +0800 Subject: [PATCH] --- backend/app/services/trading_service.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/app/services/trading_service.py b/backend/app/services/trading_service.py index 947729cd..3c505178 100644 --- a/backend/app/services/trading_service.py +++ b/backend/app/services/trading_service.py @@ -123,6 +123,17 @@ class TradingService: config["embedding_api_key"] = embedding_api_key if embedding_api_key else openai_api_key # Initialize TradingAgentsX graph + # Validate model compatibility with provider + for model_type, url_key, model_key in [ + ("Quick Thinking", "quick_think_base_url", "quick_think_llm"), + ("Deep Thinking", "deep_think_base_url", "deep_think_llm") + ]: + base_url = config.get(url_key, "") + model = config.get(model_key, "") + + if "googleapis.com" in base_url and not model.lower().startswith("gemini"): + raise ValueError(f"Google Gemini API (detected in {model_type} Base URL) only supports 'gemini' models. You selected '{model}'. Please select a Gemini model.") + graph = TradingAgentsXGraph(analysts, config=config, debug=True) # Run analysis