Skip to content

Commit 3bf0c2c

Browse files
committed
Separate default assistant title from chat title for animation
1 parent f516247 commit 3bf0c2c

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

packages/react-ui/src/app/features/ai/assistant/assistant-ui-chat.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ const AssistantUiChat = ({
139139
runtime={runtime}
140140
onNewChat={onNewChatClick}
141141
title={currentChatTitle}
142+
defaultTitle={title}
142143
availableModels={availableModels}
143144
onModelSelected={onModelSelected}
144145
isModelSelectorLoading={isModelSelectorLoading}

packages/ui-components/src/components/assistant-ui/assistant-top-bar.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ type AssistantTopBarProps = {
1111
onClose: () => void;
1212
onNewChat: () => void;
1313
title?: string;
14+
defaultTitle?: string;
1415
onHistoryOpenChange?: (open: boolean) => void;
1516
isHistoryOpen?: boolean;
1617
historyContent?: ReactNode;
1718
children: ReactNode;
1819
chatId?: string | null;
1920
};
2021

21-
const AI_ASSISTANT_DEFAULT_TITLE = t('OpenOps Assistant');
22-
2322
const AssistantTopBar = ({
2423
onNewChat,
2524
onClose,
@@ -29,12 +28,14 @@ const AssistantTopBar = ({
2928
historyContent,
3029
children,
3130
chatId,
31+
defaultTitle,
3232
}: AssistantTopBarProps) => {
33+
const baseTitle = defaultTitle ?? t('OpenOps Assistant');
3334
const animatedTitle = useTypingAnimation({
34-
text: title || AI_ASSISTANT_DEFAULT_TITLE,
35+
text: title || baseTitle,
3536
speed: 50,
36-
fromText: AI_ASSISTANT_DEFAULT_TITLE,
37-
defaultText: AI_ASSISTANT_DEFAULT_TITLE,
37+
fromText: baseTitle,
38+
defaultText: baseTitle,
3839
chatId: chatId,
3940
});
4041

packages/ui-components/src/components/assistant-ui/assistant-ui-chat-container.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const AssistantUiChatContainer = ({
3636
isShowingSlowWarning,
3737
connectionError,
3838
chatId,
39+
defaultTitle,
3940
}: AssistantUiChatContainerProps) => {
4041
const codeVariation = useMemo(() => {
4142
return handleInject
@@ -53,6 +54,7 @@ const AssistantUiChatContainer = ({
5354
isHistoryOpen={isHistoryOpen}
5455
historyContent={children}
5556
chatId={chatId}
57+
defaultTitle={defaultTitle}
5658
>
5759
{null}
5860
</AssistantTopBar>

0 commit comments

Comments
 (0)