Files
shinkan-jinkendo/backend/ai_model_roles.py
T
LarsandCursor b537750671
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Successful in 50s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 17s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 7m40s
Let superadmins assign one OpenRouter model per task group.
Reasoning, drafting, and matching prompts inherit that model, so each prompt does not need its own setting.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-23 09:59:28 +01:00

39 lines
1.1 KiB
Python

"""Aufgabengruppen für OpenRouter-Modelle. Die Zuordnung der Prompts lebt in ai_prompts.model_role."""
from __future__ import annotations
from typing import Optional, Tuple
ROLE_KEYS = frozenset({"reasoning", "drafting", "matching"})
_FALLBACK_MODEL = "anthropic/claude-sonnet-4"
def resolve_prompt_openrouter_model(
*,
prompt_model: Optional[str],
role_model: Optional[str],
platform_model: Optional[str],
env_model: Optional[str],
) -> Tuple[str, str]:
"""
Auflösung und Quelle.
Quelle ist `prompt`, `role`, `database` oder `environment`.
Ungültige IDs werden übersprungen.
"""
from openrouter_chat import normalize_openrouter_model_id
for raw, source in (
(prompt_model, "prompt"),
(role_model, "role"),
(platform_model, "database"),
):
try:
model = normalize_openrouter_model_id(raw)
except ValueError:
model = None
if model:
return model, source
env = (str(env_model or "").strip() or _FALLBACK_MODEL)
return env, "environment"