fix: use provider_type for model prefix and base_url for Ollama Cloud

- _get_llm_api_key now returns provider_type
- Model string built with provider_type prefix (openai/deepseek-v4 instead of ollama/deepseek-v4)
- api_base set from provider.base_url (https://ollama.com/v1)
- Fixes: litellm tried localhost:11434 instead of Ollama Cloud
This commit is contained in:
Agent Zero
2026-07-19 01:51:14 +02:00
parent 7f8344bc24
commit ef4f0cc494
2 changed files with 20 additions and 7 deletions
+7 -1
View File
@@ -190,10 +190,16 @@ async def deep_analysis(
# Get API key from DB (like ai_assistant does) or fall back to env
from app.plugins.builtins.ai_proactive.services import _get_llm_api_key
api_key, api_base = await _get_llm_api_key(db, tid)
api_key, api_base, provider_type = await _get_llm_api_key(db, tid)
if not api_key:
api_key = os.environ.get('API_KEY_OLLAMA_CLOUD', '') or None
# Build model string with provider prefix
model = settings.model or "ollama/deepseek-v4"
if provider_type:
model_parts = model.split("/", 1)
model = f"{provider_type}/{model_parts[-1]}"
litellm_kwargs: dict[str, Any] = dict(
model=model,
messages=[