Let superadmins assign one OpenRouter model per task group.
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
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
Reasoning, drafting, and matching prompts inherit that model, so each prompt does not need its own setting. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0431c9e160
commit
b537750671
14 files changed
+720
-65
No files matched your search
@@ -305,17 +305,52 @@ def default_openrouter_model_id() -> str:
|
||||
return effective
|
||||
|
||||
|
||||
def read_platform_role_models() -> Dict[str, str]:
|
||||
"""Gespeicherte Gruppenmodelle. Fehlende Tabelle oder DB-Fehler: leeres Dict."""
|
||||
try:
|
||||
from db import get_cursor, get_db
|
||||
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
cur.execute(
|
||||
"SELECT role_key, openrouter_model FROM platform_ai_model_roles"
|
||||
)
|
||||
rows = cur.fetchall()
|
||||
except Exception as exc:
|
||||
_logger.warning("Aufgabengruppen-Modelle nicht lesbar: %s", exc)
|
||||
return {}
|
||||
out: Dict[str, str] = {}
|
||||
for row in rows or []:
|
||||
key = str((row.get("role_key") if isinstance(row, dict) else row[0]) or "").strip()
|
||||
raw = row.get("openrouter_model") if isinstance(row, dict) else row[1]
|
||||
text = str(raw or "").strip()
|
||||
if key and text:
|
||||
out[key] = text
|
||||
return out
|
||||
|
||||
|
||||
def effective_openrouter_model_for_prompt_row(row: Optional[Mapping[str, Any]]) -> str:
|
||||
"""
|
||||
Pro-Prompt-Override in ai_prompts.openrouter_model, sonst Plattform-Standard.
|
||||
Prompt-Ausnahme, sonst Aufgabengruppe, sonst Plattform-Standard, sonst Umgebung.
|
||||
|
||||
`row` kann eine partial Row aus load_ai_prompt_row sein (Felder slug, openrouter_model, …).
|
||||
`row` kann eine partial Row aus load_ai_prompt_row sein
|
||||
(Felder slug, openrouter_model, model_role, …).
|
||||
"""
|
||||
from ai_model_roles import resolve_prompt_openrouter_model
|
||||
|
||||
prompt_model = None
|
||||
role_key = ""
|
||||
if row:
|
||||
custom = str(row.get("openrouter_model") or "").strip()
|
||||
if custom:
|
||||
return custom
|
||||
return default_openrouter_model_id()
|
||||
prompt_model = row.get("openrouter_model")
|
||||
role_key = str(row.get("model_role") or "").strip()
|
||||
role_model = read_platform_role_models().get(role_key) if role_key else None
|
||||
effective, _source = resolve_prompt_openrouter_model(
|
||||
prompt_model=None if prompt_model is None else str(prompt_model),
|
||||
role_model=role_model,
|
||||
platform_model=read_stored_platform_openrouter_model(),
|
||||
env_model=env_openrouter_model_id(),
|
||||
)
|
||||
return effective
|
||||
|
||||
|
||||
def _price_str(pricing: Any, key: str) -> Optional[str]:
|
||||
|
||||
Reference in new issue
Block a user