INNER CODE UNIT · Python
_sync_app_config_to_system_app
derisk-ai/OpenDerisk · packages/derisk-app/src/derisk_app/app.py:377
def _sync_app_config_to_system_app():
"""Sync LLM config to system_app.config on startup.
Priority: TOML config > JSON config. If TOML defines providers, they always
override the JSON (derisk.json) providers. This ensures edits to TOML files
take effect on next restart, while the Web UI can still hot-reload within a
session (Web UI writes to derisk.json, which takes effect until next restart).
"""
try:
from derisk_core.config import ConfigManager
from derisk.agent.util.llm.model_config_cache import (
ModelConfigCache,
parse_provider_configs,
)
cfg = ConfigManager.get()
agent_llm_conf = getattr(cfg, "agent_llm", None)