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 useChat Hook for Improved Clarity and Consistency

Salman-Ahamed2365c30883e5
diff --git a/packages/app/src/react/features/ai-chat/hooks/use-chat.ts b/packages/app/src/react/features/ai-chat/hooks/use-chat.ts
index 20c35cf0..8ac99ea6 100644
--- a/packages/app/src/react/features/ai-chat/hooks/use-chat.ts
+++ b/packages/app/src/react/features/ai-chat/hooks/use-chat.ts
@@ -20,20 +20,13 @@ import { useChatStream } from './use-chat-stream';
* Hook configuration interface
*/
interface IUseChatConfig {
- /** Agent ID */
agentId: string;
- /** Chat/Conversation ID */
- chatId: string;
- /** Avatar URL for AI messages */
+ chatId: string; // Chat/Conversation ID
avatar?: string;
- /** Custom chat API client */
- client?: ChatAPIClient;
- /** Custom headers for requests */
- headers?: Record<string, string>;
- /** Called when chat completes successfully */
- onChatComplete?: (message: string) => void;
- /** Called when error occurs */
- onError?: (error: Error) => void;
+ client?: ChatAPIClient; // Custom chat API client
+ headers?: Record<string, string>; // Custom headers for requests
+ onChatComplete?: (message: string) => void; // Called when chat completes successfully
+ onError?: (error: Error) => void; // Called when error occurs
}
/**