fix: config saving and config loading
Build Release EXE / build-windows-exe (release) Successful in 50s

This commit is contained in:
2026-05-06 15:18:51 -04:00
parent 11adcc160a
commit 58a57ddc6a
9 changed files with 38 additions and 13 deletions
+9 -1
View File
@@ -62,7 +62,7 @@ class Settings(BaseSettings):
ollama_base_url: str = "http://localhost:11434"
ollama_model: str = "qwen3.5:9b"
ollama_num_ctx: int = 64000
ollama_num_ctx: int = 64512
uex_base_url: str = "https://api.uexcorp.space/2.0"
uex_secret_key: str | None = Field(default=None)
uex_bearer_token: str | None = Field(default=None)
@@ -90,6 +90,11 @@ def get_settings() -> Settings:
def settings_payload(settings: Settings | None = None) -> dict[str, Any]:
current = settings or get_settings()
values = current.model_dump()
secrets_configured = {}
for key, meta in CONFIG_FIELDS.items():
if meta.get("secret"):
secrets_configured[key] = bool(values.get(key))
values[key] = ""
return {
"app_data_dir": str(ensure_app_data_dir()),
"config_path": str(user_config_path()),
@@ -97,6 +102,7 @@ def settings_payload(settings: Settings | None = None) -> dict[str, Any]:
"edge_profile_dir": str(edge_profile_dir()),
"values": values,
"fields": CONFIG_FIELDS,
"secrets_configured": secrets_configured,
}
@@ -106,6 +112,8 @@ def save_settings(values: dict[str, Any]) -> dict[str, Any]:
for key, value in values.items():
if key not in CONFIG_FIELDS:
continue
if CONFIG_FIELDS[key].get("secret") and value == "":
continue
next_values[key] = _coerce_value(key, value)
path = user_config_path()