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 Chat Components for Improved Type Consistency and Import Paths

Salman-Ahamed2afcc6a122a0
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 fa846536..67a0d554 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
@@ -1,9 +1,4 @@
/* eslint-disable no-unused-vars, @typescript-eslint/no-unused-vars */
-// import { Tooltip } from 'flowbite-react';
-// import { FC, useRef, useState } from 'react';
-// import { FaCheck, FaRegCopy } from 'react-icons/fa6';
-// import ReactMarkdown from 'react-markdown';
-// import remarkGfm from 'remark-gfm';
import '../styles/index.css';
@@ -13,12 +8,12 @@ import {
ReplyLoader,
ThinkingMessage,
} from '@react/features/ai-chat/components';
+import { IChatMessage, IMessageFile } from '@react/features/ai-chat/types/chat.types';
import { Tooltip } from 'flowbite-react';
import { FC, useCallback, useRef, useState } from 'react';
import { FaCheck, FaRegCopy } from 'react-icons/fa6';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
-import { FileWithMetadata, IChatMessage } from '../types/chat.types';
const DEFAULT_AVATAR_URL =
'https://gravatar.com/avatar/ccd5b19e810febbfd3d4321e27b15f77?s=400&d=mp&r=x';
@@ -90,7 +85,7 @@ export const ChatBubble: FC<IChatMessage> = ({
*/
interface IUserMessageBubble {
message: string;
- files?: FileWithMetadata[];
+ files?: IMessageFile[];
}
/**
diff --git a/packages/app/src/react/features/ai-chat/components/chat.tsx b/packages/app/src/react/features/ai-chat/components/chat.tsx
index a7e4d8ae..ff4b1235 100644
--- a/packages/app/src/react/features/ai-chat/components/chat.tsx
+++ b/packages/app/src/react/features/ai-chat/components/chat.tsx
@@ -4,13 +4,13 @@
*/
import { FC } from 'react';
+import { IChatMessage } from '@react/features/ai-chat';
import {
ReplyLoader,
SystemMessage,
ThinkingMessage,
UserMessage,
} from '@react/features/ai-chat/components';
-import { IChatMessage } from '../types/chat.types';
import '../styles/index.css';
diff --git a/packages/app/src/react/features/ai-chat/components/chats.tsx b/packages/app/src/react/features/ai-chat/components/chats.tsx
index 7a6804f2..f90901c4 100644
--- a/packages/app/src/react/features/ai-chat/components/chats.tsx
+++ b/packages/app/src/react/features/ai-chat/components/chats.tsx
@@ -3,12 +3,12 @@
* Displays chat messages with auto-scroll, drag-and-drop, and retry functionality
*/
/* eslint-disable no-unused-vars */
+import { IChatMessage } from '@react/features/ai-chat';
import { Chat } from '@react/features/ai-chat/components';
import { useChatContext } from '@react/features/ai-chat/contexts';
import { useDragAndDrop } from '@react/features/ai-chat/hooks';
import { AgentDetails } from '@src/react/shared/types/agent-data.types';
import { FC, MutableRefObject, RefObject, useEffect, useRef } from 'react';
-import { IChatMessage } from '../types/chat.types';
/**
* Chats component properties
diff --git a/packages/app/src/react/features/ai-chat/components/file-item-preview.tsx b/packages/app/src/react/features/ai-chat/components/file-item-preview.tsx
index 517e9588..af97da29 100644
--- a/packages/app/src/react/features/ai-chat/components/file-item-preview.tsx
+++ b/packages/app/src/react/features/ai-chat/components/file-item-preview.tsx
@@ -1,4 +1,4 @@
-import { FileWithMetadata } from '../types/chat.types';
+import { IMessageFile } from '@react/features/ai-chat';
import classNames from 'classnames';
import { FC, useEffect, useMemo, useState } from 'react';
import {
@@ -13,7 +13,7 @@ import {
import { CloseIcon } from './icons';
interface FileItemPreviewProps {
- file: FileWithMetadata;
+ file: IMessageFile;
onRemove?: () => void;
isUploading?: boolean;
fileKey?: string;
diff --git a/packages/app/src/react/features/ai-chat/components/user-message.tsx b/packages/app/src/react/features/ai-chat/components/user-message.tsx
index 26ce0c64..13d48612 100644
--- a/packages/app/src/react/features/ai-chat/components/user-message.tsx
+++ b/packages/app/src/react/features/ai-chat/components/user-message.tsx
@@ -1,13 +1,13 @@
+import { IMessageFile } from '@react/features/ai-chat';
import { FileItemPreview } from '@react/features/ai-chat/components';
import { FC } from 'react';
-import { FileWithMetadata } from '../types/chat.types';
/**
* User Message Component Properties
*/
interface IUserMessage {
message: string;
- files?: FileWithMetadata[];
+ files?: IMessageFile[];
}
/**