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 File Utilities and Stream Utilities for Enhanced Type Consistency

Salman-Ahamed93b4c2ded968
diff --git a/packages/app/src/react/features/ai-chat/utils/file.ts b/packages/app/src/react/features/ai-chat/utils/file.ts
index 3932c151..ea153e52 100644
--- a/packages/app/src/react/features/ai-chat/utils/file.ts
+++ b/packages/app/src/react/features/ai-chat/utils/file.ts
@@ -1,4 +1,4 @@
-import { FileWithMetadata } from '../types/chat.types';
+import { IMessageFile } from '@react/features/ai-chat';
/**
* Constants for file upload limitations
@@ -142,7 +142,7 @@ export const deleteFile = async (key: string): Promise<boolean> => {
* @param file The file to create metadata for
* @returns FileWithMetadata object
*/
-export const createFileMetadata = (file: File): FileWithMetadata => ({
+export const createFileMetadata = (file: File): IMessageFile => ({
file,
id: `${file.name}-${file.size}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
metadata: { fileType: file.type, previewUrl: getLocalPreviewUrl(file), isUploading: true },
diff --git a/packages/app/src/react/features/ai-chat/utils/stream.utils.ts b/packages/app/src/react/features/ai-chat/utils/stream.utils.ts
index bb1359dc..009fc79c 100644
--- a/packages/app/src/react/features/ai-chat/utils/stream.utils.ts
+++ b/packages/app/src/react/features/ai-chat/utils/stream.utils.ts
@@ -1,10 +1,11 @@
+/* eslint-disable no-unused-vars */
/**
* Stream processing utilities for chat responses
* Handles JSON parsing, message formatting, and status updates
* Updated: callback signatures now include TThinkingType parameter
*/
-import { IStreamChunk, TThinkingType } from '../types/chat.types';
+import { IStreamChunk, TThinkingType } from '@react/features/ai-chat/types/chat.types';
/**
* Function-specific thinking messages that cycle during function execution
@@ -372,7 +373,6 @@ export const processStreamChunk = (chunk: IStreamChunk) => {
statusMessage: chunk.status_message || null,
content: chunk.content || '',
error: chunk.error || null,
- errorType: chunk.errorType || null,
};
};