- Create framework for chat-client, including logo, explanatory text, color settings, ...
- remove allowed_langages from tenant - Correct bugs in Tenant, TenantMake, SpecialistMagicLink - Change chat client customisation elements
This commit is contained in:
@@ -223,10 +223,11 @@ class SpecialistServices:
|
||||
|
||||
@staticmethod
|
||||
def get_specialist_system_field(specialist_id, config_name, system_name):
|
||||
"""Get the value of a system field in a specialist's configuration. Returns the actual value, or None."""
|
||||
specialist = Specialist.query.get(specialist_id)
|
||||
if not specialist:
|
||||
raise ValueError(f"Specialist with ID {specialist_id} not found")
|
||||
config = cache_manager.specialists_config_cache.get_config(specialist.type, specialist.version)
|
||||
config = cache_manager.specialists_config_cache.get_config(specialist.type, specialist.type_version)
|
||||
if not config:
|
||||
raise ValueError(f"No configuration found for {specialist.type} version {specialist.version}")
|
||||
potential_field = config.get(config_name, None)
|
||||
|
||||
@@ -5,11 +5,11 @@ Utility functions for chat customization.
|
||||
def get_default_chat_customisation(tenant_customisation=None):
|
||||
"""
|
||||
Get chat customization options with default values for missing options.
|
||||
|
||||
|
||||
Args:
|
||||
tenant_customization (dict, optional): The tenant's customization options.
|
||||
Defaults to None.
|
||||
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing all customization options with default values
|
||||
for any missing options.
|
||||
@@ -21,22 +21,25 @@ def get_default_chat_customisation(tenant_customisation=None):
|
||||
'background_color': '#ffffff',
|
||||
'text_color': '#212529',
|
||||
'sidebar_color': '#f8f9fa',
|
||||
'logo_url': None,
|
||||
'sidebar_text': None,
|
||||
'sidebar_background': '#2c3e50',
|
||||
'gradient_start_color': '#f5f7fa',
|
||||
'gradient_end_color': '#c3cfe2',
|
||||
'markdown_background_color': 'transparent',
|
||||
'markdown_text_color': '#ffffff',
|
||||
'sidebar_markdown': '',
|
||||
'welcome_message': 'Hello! How can I help you today?',
|
||||
'team_info': []
|
||||
}
|
||||
|
||||
|
||||
# If no tenant customization is provided, return the defaults
|
||||
if tenant_customisation is None:
|
||||
return default_customisation
|
||||
|
||||
|
||||
# Start with the default customization
|
||||
customisation = default_customisation.copy()
|
||||
|
||||
|
||||
# Update with tenant customization
|
||||
for key, value in tenant_customisation.items():
|
||||
if key in customisation:
|
||||
customisation[key] = value
|
||||
|
||||
return customisation
|
||||
|
||||
return customisation
|
||||
|
||||
Reference in New Issue
Block a user