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 status message formatting in UnifiedThinkingManager and chatUtils
Salman-Ahamed6aaa59a4c972
diff --git a/packages/app/src/react/features/ai-chat/utils/index.ts b/packages/app/src/react/features/ai-chat/utils/index.tsindex 79d23407..01eb1bb1 100644--- a/packages/app/src/react/features/ai-chat/utils/index.ts+++ b/packages/app/src/react/features/ai-chat/utils/index.ts@@ -106,8 +106,10 @@ class UnifiedThinkingManager {updateStatus(newStatusMessage: string): void {if (this.currentType === 'status' && this.onThinking) {- this.statusMessage = newStatusMessage;- this.onThinking({ message: newStatusMessage });+ // Format the status message before storing and displaying+ const formattedMessage = chatUtils.formatStatusMessage(newStatusMessage);+ this.statusMessage = formattedMessage;+ this.onThinking({ message: formattedMessage });}}@@ -169,7 +171,9 @@ export const chatUtils = {onThinking: (thinking: { message: string }) => void,): boolean => {if (statusMessage) {- chatUtils.thinkingManager.start('status', onThinking, undefined, statusMessage);+ // Format the status message for better display+ const formattedStatusMessage = chatUtils.formatStatusMessage(statusMessage);+ chatUtils.thinkingManager.start('status', onThinking, undefined, formattedStatusMessage);return true;}return false;@@ -218,6 +222,44 @@ export const chatUtils = {return formatted;},++ /**+ * Formats status message with proper function name and duration display+ * @param statusMessage - The raw status message containing function names and durations in curly braces+ * @returns Formatted status message for user display+ */+ formatStatusMessage: (statusMessage: string): string => {+ let formatted = statusMessage;++ // Pattern to match function names in curly braces: {function_name} or {functionName}+ const functionPattern = /\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g;+ formatted = formatted.replace(functionPattern, (match, functionName) => {+ // Check if this looks like a duration (contains numbers and time units)+ if (/^\d+\s*(ms|s|sec|seconds?|minutes?|mins?|hours?|hrs?)$/i.test(functionName)) {+ // This is actually a duration, not a function name+ return functionName;+ }+ // Format as function name+ return chatUtils.formatFunctionNameForDisplay(functionName);+ });++ // Pattern to match durations in curly braces: {50 ms}, {2 seconds}, etc.+ const durationPattern =+ /\{(\d+(?:\.\d+)?\s*(?:ms|s|sec|seconds?|minutes?|mins?|hours?|hrs?))\}/gi;+ formatted = formatted.replace(durationPattern, (match, duration) => {+ // Clean up the duration formatting+ return duration.trim();+ });++ // Pattern to match pure numbers in curly braces that might be durations: {50}+ const numberPattern = /\{(\d+(?:\.\d+)?)\}/g;+ formatted = formatted.replace(numberPattern, (match, number) => {+ // Assume it's milliseconds if it's just a number+ return `${number} ms`;+ });++ return formatted;+ },getChatStreamURL: (agentId: string, isLocal = false) => {const remoteDomain = config.env.IS_DEV ? 'agent.stage.smyth.ai' : 'agent.a.smyth.ai';return isLocal