Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Refactor ChatBubble component to re-export IChatMessage interface and enhance SystemMessageBubble with optional thinkingMessage prop. Update rendering logic to display thinking messages inline when present.

Salman-Ahamed0aaa57be8aa4
diff --git a/packages/app/src/react/features/ai-chat/components/chat-bubble.tsx b/packages/app/src/react/features/ai-chat/components/chat-bubble.tsx
index acd77719..77484109 100644
--- a/packages/app/src/react/features/ai-chat/components/chat-bubble.tsx
+++ b/packages/app/src/react/features/ai-chat/components/chat-bubble.tsx
@@ -13,25 +13,13 @@ import {
ReplyLoader,
ThinkingMessage,
} from '@react/features/ai-chat/components';
-import { FileWithMetadata } from '@react/shared/types/chat.types';
+import { FileWithMetadata, IChatMessage } from '@react/shared/types/chat.types';
const DEFAULT_AVATAR_URL =
'https://gravatar.com/avatar/ccd5b19e810febbfd3d4321e27b15f77?s=400&d=mp&r=x';
-export interface IChatMessage {
- me?: boolean;
- message: string;
- type?: 'user' | 'system' | 'thinking';
- avatar?: string;
- isLast?: boolean;
- isError?: boolean;
- isReplying?: boolean;
- isRetrying?: boolean;
- isFirstMessage?: boolean;
- onRetryClick?: () => void;
- files?: FileWithMetadata[];
- hideMessageBubble?: boolean;
-}
+// Re-export the interface for use in other components
+export type { IChatMessage };
export const ChatBubble: FC<IChatMessage> = ({
me,
@@ -45,6 +33,7 @@ export const ChatBubble: FC<IChatMessage> = ({
onRetryClick,
isError = false,
hideMessageBubble,
+ thinkingMessage,
}) => {
if (me) {
return (
@@ -65,10 +54,12 @@ export const ChatBubble: FC<IChatMessage> = ({
<div className={me ? 'pl-[100px]' : ''}>
{!hideMessageBubble && (
<SystemMessageBubble
+ avatar={avatar}
message={message}
isError={isError}
onRetryClick={onRetryClick}
isRetrying={isRetrying}
+ thinkingMessage={thinkingMessage}
/>
)}
</div>
@@ -108,16 +99,20 @@ const UserMessageBubble: FC<IUserMessageBubble> = ({ message, files, hideMessage
interface ISystemMessageBubble {
message: string;
+ avatar?: string;
isError?: boolean;
isRetrying?: boolean;
onRetryClick?: () => void;
+ thinkingMessage?: string;
}
const SystemMessageBubble: FC<ISystemMessageBubble> = ({
+ avatar,
message,
isError,
isRetrying,
onRetryClick,
+ thinkingMessage,
}) => {
const [copied, setCopied] = useState(false);
const contentRef = useRef<HTMLDivElement>(null);
@@ -201,10 +196,13 @@ const SystemMessageBubble: FC<ISystemMessageBubble> = ({
p: ({ children }) => <p className="whitespace-pre-wrap">{children}</p>,
}}
/>
+
+ {/* Display thinking message inline if present */}
+ {thinkingMessage && <ThinkingMessage message={thinkingMessage} avatar={avatar} />}
</div>
)}
</div>
- {!isError && (
+ {!isError && !thinkingMessage && (
<div className="flex gap-4 p-4 pl-0">
<Tooltip content={copied ? 'Copied!' : 'Copy'} placement="bottom">
<button