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 message handling in chatUtils to retain processing messages during debug state and ensure final content transition only occurs when content is available. This improves user experience by preventing premature message clearing.

Salman-Ahamed55657e6b25e1
diff --git a/packages/app/src/react/features/ai-chat/utils/index.ts b/packages/app/src/react/features/ai-chat/utils/index.ts
index 67a8c6df..cb24418f 100644
--- a/packages/app/src/react/features/ai-chat/utils/index.ts
+++ b/packages/app/src/react/features/ai-chat/utils/index.ts
@@ -205,11 +205,13 @@ export const chatUtils = {
// Smooth Transition Handler
const handleMessageTransition = (newState: MessageState) => {
if (messageState === 'initial' && newState === 'debug') {
- // Show processing message instead of empty
- const processingMessage = 'Processing your request...';
- input.onResponse(processingMessage);
+ // Don't clear message immediately when debug starts - keep the processing message
+ // The message will be cleared only when debug ends and content starts arriving
+ // const processingMessage = 'Processing your request...';
+ // input.onResponse(processingMessage);
} else if (messageState === 'debug' && newState === 'final') {
- // Clear and prepare for final content
+ // Clear and prepare for final content - only when debug is completely finished
+ // console.log('Debug ended - clearing message for final content');
input.onResponse('');
}
messageState = newState;
@@ -374,7 +376,7 @@ export const chatUtils = {
}
if (jsonObject.content && jsonObject.content !== '') {
- // Handle final content transition
+ // Handle final content transition - only when we're actually getting content
if (messageState === ('debug' as MessageState)) {
handleMessageTransition('final');
message = ''; // Start fresh for final content