Files
wehub-resource-sync e4dcfc49aa
Tests / Import Check (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.14) (push) Has been cancelled
Tests / Python Tests (Python 3.11) (push) Has been cancelled
Tests / Python Tests (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.14) (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Tests / Lint and Format (push) Has been cancelled
Tests / Web Node Tests (push) Has been cancelled
Tests / Import Check (Python 3.11) (push) Has been cancelled
Tests / Import Check (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.13) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:00:43 +08:00

39 lines
832 B
Python

from typing import Any, Dict
from pydantic import BaseModel, field_validator
class LLMConfig(BaseModel):
model: str
provider: str = "openai"
class PathsConfig(BaseModel):
user_data_dir: str
knowledge_bases_dir: str
user_log_dir: str
class AppConfig(BaseModel):
llm: LLMConfig
paths: PathsConfig
@field_validator("llm", mode="before")
@classmethod
def ensure_llm(cls, v: Any) -> Dict[str, Any]:
if not isinstance(v, dict):
raise ValueError("llm section must be a mapping")
if "model" not in v:
raise ValueError("llm.model is required")
return v
CURRENT_SCHEMA_VERSION = 1
def migrate_config(cfg: Dict[str, Any]) -> Dict[str, Any]:
"""
No-op migration for now; placeholder for future versioned changes.
"""
return cfg