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.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Enhance IChatMessage Interface for Type Safety and Legacy Support
Salman-Ahamed99f8ac08e391
diff --git a/packages/app/src/react/shared/types/chat.types.ts b/packages/app/src/react/shared/types/chat.types.tsindex 8b14b5e8..4cd0cc7a 100644--- a/packages/app/src/react/shared/types/chat.types.ts+++ b/packages/app/src/react/shared/types/chat.types.ts@@ -12,18 +12,46 @@ export interface FileWithMetadata {id: string;}+/**+ * Shared chat message interface+ * Backward compatible with legacy code while supporting new type system+ *+ * Note: Prefer using type-based discrimination for new code:+ * - Use `type === 'user'` instead of `me` boolean+ * - Use `type === 'loading'` instead of `isReplying`/`isRetrying`+ * - Use `type === 'error'` instead of `isError` boolean+ */export interface IChatMessage {+ /** Legacy: whether message is from current user. Use `type === 'user'` instead */me: boolean;++ /** Message content */message: string;- type?: 'user' | 'system' | 'thinking';++ /**+ * Message type - determines rendering and state+ * New types: 'loading' (replaces isReplying/isRetrying), 'error' (replaces isError)+ */+ type?: 'user' | 'system' | 'thinking' | 'loading' | 'error';++ /** Avatar URL for system messages */avatar?: string;++ /** Legacy: AI is generating response. Use `type === 'loading'` instead */isReplying?: boolean;++ /** Legacy: Error state. Use `type === 'error'` instead */isError?: boolean;- isFirstMessage?: boolean;++ /** Attached files */files?: FileWithMetadata[];- hideMessage?: boolean;- thinkingMessage?: string; // Inline thinking message to show with system messages- isLast?: boolean; // Whether this is the last message in the chat- isRetrying?: boolean; // Whether this message is being retried- onRetryClick?: () => void; // Function to call when retry is clicked++ /** Inline thinking message */+ thinkingMessage?: string;++ /** Legacy: Retry in progress. Use `type === 'loading'` instead */+ isRetrying?: boolean;++ /** Retry callback */+ onRetryClick?: () => void;}