🐛 fix: show fallback title for custom assistant in chat messages (#11820)

When avatar.title is empty or null, display 'Untitled Agent' as fallback instead of showing nothing.

Closes LOBE-2232
This commit is contained in:
Arvin Xu
2026-01-26 00:11:19 +08:00
committed by GitHub
parent d088d60b0d
commit 0c96b5a034

View File

@@ -1,6 +1,7 @@
import { Text } from '@lobehub/ui';
import dayjs from 'dayjs';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { type ChatItemProps } from '../type';
@@ -12,11 +13,14 @@ export interface TitleProps {
}
const Title = memo<TitleProps>(({ showTitle, time, avatar, titleAddon }) => {
const { t } = useTranslation('chat');
const title = avatar.title || t('untitledAgent');
return (
<>
{showTitle && avatar.title && (
{showTitle && (
<Text fontSize={14} weight={500}>
{avatar.title}
{title}
</Text>
)}
{showTitle ? titleAddon : undefined}