feat: Provide default values for required fields in user settings during global settings update

This commit is contained in:
Slipstream 2025-05-26 15:37:15 -06:00
parent 0571033ca2
commit f6e70a85c0
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -1075,19 +1075,20 @@ async def update_global_settings(
)
# Convert from GlobalSettings to UserSettings
# Provide default values for required fields when they are None
user_settings = UserSettings(
model_id=settings.model,
temperature=settings.temperature,
max_tokens=settings.max_tokens,
model_id=settings.model or "openai/gpt-3.5-turbo",
temperature=settings.temperature if settings.temperature is not None else 0.7,
max_tokens=settings.max_tokens if settings.max_tokens is not None else 1000,
system_message=settings.system_message,
character=settings.character,
character_info=settings.character_info,
custom_instructions=settings.custom_instructions,
custom_bot_token=settings.custom_bot_token,
custom_bot_enabled=settings.custom_bot_enabled,
custom_bot_prefix=settings.custom_bot_prefix,
custom_bot_status_text=settings.custom_bot_status_text,
custom_bot_status_type=settings.custom_bot_status_type
custom_bot_enabled=settings.custom_bot_enabled if settings.custom_bot_enabled is not None else False,
custom_bot_prefix=settings.custom_bot_prefix or "!",
custom_bot_status_text=settings.custom_bot_status_text or "!help",
custom_bot_status_type=settings.custom_bot_status_type or "listening"
)
# Add theme settings if provided