feat: Provide default values for required fields in user settings during global settings update
This commit is contained in:
parent
0571033ca2
commit
f6e70a85c0
@ -1075,19 +1075,20 @@ async def update_global_settings(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Convert from GlobalSettings to UserSettings
|
# Convert from GlobalSettings to UserSettings
|
||||||
|
# Provide default values for required fields when they are None
|
||||||
user_settings = UserSettings(
|
user_settings = UserSettings(
|
||||||
model_id=settings.model,
|
model_id=settings.model or "openai/gpt-3.5-turbo",
|
||||||
temperature=settings.temperature,
|
temperature=settings.temperature if settings.temperature is not None else 0.7,
|
||||||
max_tokens=settings.max_tokens,
|
max_tokens=settings.max_tokens if settings.max_tokens is not None else 1000,
|
||||||
system_message=settings.system_message,
|
system_message=settings.system_message,
|
||||||
character=settings.character,
|
character=settings.character,
|
||||||
character_info=settings.character_info,
|
character_info=settings.character_info,
|
||||||
custom_instructions=settings.custom_instructions,
|
custom_instructions=settings.custom_instructions,
|
||||||
custom_bot_token=settings.custom_bot_token,
|
custom_bot_token=settings.custom_bot_token,
|
||||||
custom_bot_enabled=settings.custom_bot_enabled,
|
custom_bot_enabled=settings.custom_bot_enabled if settings.custom_bot_enabled is not None else False,
|
||||||
custom_bot_prefix=settings.custom_bot_prefix,
|
custom_bot_prefix=settings.custom_bot_prefix or "!",
|
||||||
custom_bot_status_text=settings.custom_bot_status_text,
|
custom_bot_status_text=settings.custom_bot_status_text or "!help",
|
||||||
custom_bot_status_type=settings.custom_bot_status_type
|
custom_bot_status_type=settings.custom_bot_status_type or "listening"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add theme settings if provided
|
# Add theme settings if provided
|
||||||
|
Loading…
x
Reference in New Issue
Block a user