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
Update onResponse callback to include error handling in AI chat utilities
Salman-Ahamed30cb9b70906c
diff --git a/packages/app/src/react/features/ai-chat/utils/index.ts b/packages/app/src/react/features/ai-chat/utils/index.tsindex a218632b..67a8c6df 100644--- a/packages/app/src/react/features/ai-chat/utils/index.ts+++ b/packages/app/src/react/features/ai-chat/utils/index.ts@@ -8,7 +8,7 @@ type GenerateResponseInput = {query: string;fileKeys?: string[];signal: AbortSignal;- onResponse: (value: string) => void;+ onResponse: (value: string, errorInfo?: { isError?: boolean; errorType?: string }) => void;onStart: () => void;onEnd: () => void;onThinking?: (thinking: { message: string }) => void;@@ -22,6 +22,8 @@ type ResponseFormat = {function?: string;function_call?: { name?: string; arguments?: any[] };error?: string;+ isError?: boolean;+ errorType?: string;};// Function-specific thinking messages that cycle every 5 seconds@@ -392,8 +394,11 @@ export const chatUtils = {// Handle regular content - response shows immediatelymessage += jsonObject.content;- // INSTANT DISPLAY: Show response immediately- input.onResponse(message);+ // INSTANT DISPLAY: Show response immediately with error flags if present+ input.onResponse(message, {+ isError: jsonObject.isError || false,+ errorType: jsonObject.errorType || undefined,+ });}}