5769c1cd22
- Auto-Registration-Bug behoben (register_project/get_project_id/resolve_project Trennung) - 25 Tests gruen (Pytest) - block_compactor-Tool refactored (Option B: Soft-Check statt Hard-Block) - 4 Restbaustellen gefixt - DB-Schema: plugin_settings-Tabelle hinzugefuegt - 3 Schattenprojekte aus DB geloescht - Plan v3 + Refactor-Plan + Worklog dokumentiert
28 lines
881 B
Python
28 lines
881 B
Python
"""Model routing configuration management."""
|
|
import yaml
|
|
import os
|
|
from typing import Dict, Any, Optional
|
|
|
|
|
|
def load_config(plugin_dir: str) -> Dict[str, Any]:
|
|
"""Load model routing config from default_config.yaml."""
|
|
config_path = os.path.join(plugin_dir, "default_config.yaml")
|
|
try:
|
|
with open(config_path, "r") as f:
|
|
config = yaml.safe_load(f) or {}
|
|
return config.get("model_routing", {})
|
|
except (FileNotFoundError, yaml.YAMLError) as e:
|
|
return {}
|
|
|
|
|
|
def get_role_preset(role: str, config: Dict[str, Any]) -> Optional[str]:
|
|
"""Get the model preset for a given role."""
|
|
roles = config.get("roles", {})
|
|
role_config = roles.get(role, {})
|
|
return role_config.get("preset")
|
|
|
|
|
|
def list_roles(config: Dict[str, Any]) -> list:
|
|
"""Return list of defined role names."""
|
|
return list(config.get("roles", {}).keys())
|