From 2ec01aea2fefd4375036333194c249eb43c09b2e Mon Sep 17 00:00:00 2001 From: Br1an67 <932039080@qq.com> Date: Mon, 2 Mar 2026 01:54:59 +0800 Subject: [PATCH 1/3] feat: make avatar size configurable via config.toml Add avatar_size option to [UI] in config.toml. When set, the avatar renders at the specified pixel size instead of the default 20x20px. --- backend/chainlit/config.py | 4 ++++ .../src/components/chat/Messages/Message/Avatar.tsx | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) 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) => { - + Date: Mon, 2 Mar 2026 22:41:00 +0800 Subject: [PATCH 2/3] fix: add avatar_size to IChainlitConfig TypeScript type definition --- libs/react-client/src/types/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/react-client/src/types/config.ts b/libs/react-client/src/types/config.ts index 895022da46..0872d28cf4 100644 --- a/libs/react-client/src/types/config.ts +++ b/libs/react-client/src/types/config.ts @@ -57,6 +57,7 @@ export interface IChainlitConfig { custom_meta_image_url?: string; logo_file_url?: string; default_avatar_file_url?: string; + avatar_size?: number; header_links?: { name: string; display_name: string; From 3dfe61ad86a901b5be6890f269e3ffd0cd1fc14a Mon Sep 17 00:00:00 2001 From: hayescode <35790761+hayescode@users.noreply.github.com> Date: Thu, 5 Mar 2026 12:30:43 -0600 Subject: [PATCH 3/3] chore: trigger checks