feat(settings): enhance settings handling and add startup messages, fixes #593 and fixes #594

- Add standalone mode detection via LORA_MANAGER_STANDALONE environment variable
- Improve error handling for settings file loading with specific JSON decode errors
- Add startup messages system to communicate configuration warnings and errors to users
- Include settings file path and startup messages in settings API response
- Automatically save settings when bootstrapping from defaults due to missing/invalid settings file
- Add configuration warnings collection for environment variables and other settings issues

The changes improve robustness of settings management and provide better user feedback when configuration issues occur.
This commit is contained in:
Will Miao
2025-10-26 18:06:37 +08:00
parent 7892df21ec
commit b5ee4a6408
6 changed files with 372 additions and 54 deletions

View File

@@ -108,9 +108,10 @@ def test_validate_settings_warns_for_missing_model_paths(caplog, standalone_modu
}
)
assert standalone_module.validate_settings() is False
assert standalone_module.validate_settings() is True
warning_lines = [record.message for record in caplog.records if record.levelname == "WARNING"]
assert any("CONFIGURATION WARNING" in line for line in warning_lines)
assert any("Standalone mode is using fallback" in line for line in warning_lines)
assert any("Model folders need setup" in line for line in warning_lines)
def test_standalone_lora_manager_registers_routes(monkeypatch, tmp_path, standalone_module):