Compare commits

...

1 Commits

Author SHA1 Message Date
rohitvinodmalhotra@gmail.com
51bf321a01 create defaults 2025-03-27 17:21:41 -04:00
2 changed files with 19 additions and 30 deletions

View File

@@ -79,19 +79,7 @@ async def reset_settings(
)
existing_settings = await settings_store.load()
settings = Settings(language="en",
agent="CodeActAgent",
security_analyzer="",
confirmation_mode=False,
llm_model="anthropic/claude-3-5-sonnet-20241022",
llm_api_key="",
llm_base_url="",
remote_runtime_resource_factor=1,
enable_default_condenser=True,
enable_sound_notifications=False,
user_consents_to_analytics=existing_settings.user_consents_to_analytics if existing_settings else False
)
settings = Settings(user_consents_to_analytics=existing_settings.user_consents_to_analytics if existing_settings else False)
server_config_values = server_config.get_config()
is_hide_llm_settings_enabled = server_config_values.get("FEATURE_FLAGS", {}).get("HIDE_LLM_SETTINGS", False)
# We don't want the user to be able to modify these settings in SaaS
@@ -150,15 +138,15 @@ async def store_settings(
# Convert to Settings model and merge with existing settings
if existing_settings:
# Keep existing LLM settings if not provided
if settings.llm_api_key is None:
if not settings.llm_api_key:
settings.llm_api_key = existing_settings.llm_api_key
if settings.llm_model is None:
if not settings.llm_model:
settings.llm_model = existing_settings.llm_model
if settings.llm_base_url is None:
if not settings.llm_base_url:
settings.llm_base_url = existing_settings.llm_base_url
# Keep existing analytics consent if not provided
if settings.user_consents_to_analytics is None:
if not settings.user_consents_to_analytics:
settings.user_consents_to_analytics = (
existing_settings.user_consents_to_analytics
)

View File

@@ -10,6 +10,7 @@ from pydantic import (
)
from pydantic.json import pydantic_encoder
from openhands.core.config.config_utils import OH_MAX_ITERATIONS
from openhands.core.config.llm_config import LLMConfig
from openhands.core.config.utils import load_app_config
from openhands.integrations.provider import SecretStore
@@ -20,21 +21,21 @@ class Settings(BaseModel):
Persisted settings for OpenHands sessions
"""
language: str | None = None
agent: str | None = None
max_iterations: int | None = None
security_analyzer: str | None = None
confirmation_mode: bool | None = None
llm_model: str | None = None
llm_api_key: SecretStr | None = None
llm_base_url: str | None = None
remote_runtime_resource_factor: int | None = None
language: str = 'en'
agent: str = 'CodeActAgent'
max_iterations: int = OH_MAX_ITERATIONS
security_analyzer: str = ''
confirmation_mode: bool = False
llm_model: str = 'anthropic/claude-3-5-sonnet-20241022'
llm_api_key: SecretStr = SecretStr('')
llm_base_url: str = ''
remote_runtime_resource_factor: int = 1
secrets_store: SecretStore = Field(default_factory=SecretStore, frozen=True)
enable_default_condenser: bool = False
enable_default_condenser: bool = True
enable_sound_notifications: bool = False
user_consents_to_analytics: bool | None = None
sandbox_base_container_image: str | None = None
sandbox_runtime_container_image: str | None = None
user_consents_to_analytics: bool = False
sandbox_base_container_image: str = ''
sandbox_runtime_container_image: str = ''
model_config = {
'validate_assignment': True,