diff --git a/backend/chainlit/config.py b/backend/chainlit/config.py index 5f32be958a..c103895e96 100644 --- a/backend/chainlit/config.py +++ b/backend/chainlit/config.py @@ -226,6 +226,9 @@ # Load assistant avatar image directly from URL. default_avatar_file_url = "" +# Avatar size in pixels (default: 20). +# avatar_size = 20 + # Specify a custom build directory for the frontend. # This can be used to customize the frontend code. # Be careful: If this is a relative path, it should not start with a slash. @@ -372,6 +375,7 @@ class UISettings(BaseModel): custom_meta_image_url: Optional[str] = None logo_file_url: Optional[str] = None default_avatar_file_url: Optional[str] = None + avatar_size: Optional[int] = None custom_build: Optional[str] = None header_links: Optional[List[HeaderLink]] = None diff --git a/frontend/src/components/chat/Messages/Message/Avatar.tsx b/frontend/src/components/chat/Messages/Message/Avatar.tsx index e9e2626d84..b9e5d49f8f 100644 --- a/frontend/src/components/chat/Messages/Message/Avatar.tsx +++ b/frontend/src/components/chat/Messages/Message/Avatar.tsx @@ -42,6 +42,11 @@ const MessageAvatar = ({ author, hide, isError }: Props) => { return apiClient?.buildEndpoint(`/avatars/${author || 'default'}`); }, [apiClient, selectedChatProfile, config, author]); + const avatarSize = config?.ui?.avatar_size; + const sizeStyle = avatarSize + ? { width: `${avatarSize}px`, height: `${avatarSize}px` } + : undefined; + if (isError) { return ( @@ -55,7 +60,10 @@ const MessageAvatar = ({ author, hide, isError }: Props) => { - +