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.

Fix/chat module simple query error (#127)

Salman Ahamed06dce4a1ed45
diff --git a/packages/app/src/react/features/ai-chat/components/chat.tsx b/packages/app/src/react/features/ai-chat/components/chat.tsx
index 13479197..d30472c3 100644
--- a/packages/app/src/react/features/ai-chat/components/chat.tsx
+++ b/packages/app/src/react/features/ai-chat/components/chat.tsx
@@ -16,15 +16,15 @@ interface ChatProps extends IChatMessage {
export const Chat: FC<ChatProps> = ({
me,
+ type,
files,
avatar,
message,
- type,
isReplying,
isRetrying,
+ hideMessage,
onRetryClick,
isError = false,
- hideMessage,
thinkingMessage,
scrollToBottom,
}) => {
@@ -32,19 +32,19 @@ export const Chat: FC<ChatProps> = ({
if (me && !hideMessage) return <UserMessage message={message} files={files} />;
if (type === 'thinking') return <ThinkingMessage message={message} avatar={avatar} />;
- return (
- !hideMessage && (
- <SystemMessage
- avatar={avatar}
- message={message}
- isError={isError}
- onRetryClick={onRetryClick}
- isRetrying={isRetrying}
- thinkingMessage={thinkingMessage}
- onTypingProgress={() => scrollToBottom?.()}
- onTypingComplete={() => scrollToBottom?.()}
- typingAnimation={!isReplying && !isRetrying && !isError}
- />
- )
+ return !hideMessage ? (
+ <SystemMessage
+ avatar={avatar}
+ message={message}
+ isError={isError}
+ onRetryClick={onRetryClick}
+ isRetrying={isRetrying}
+ thinkingMessage={thinkingMessage}
+ onTypingProgress={() => scrollToBottom?.()}
+ onTypingComplete={() => scrollToBottom?.()}
+ typingAnimation={!isReplying && !isRetrying && !isError}
+ />
+ ) : (
+ <SystemMessage message="Something went wrong" />
);
};
diff --git a/packages/app/src/react/features/ai-chat/hooks/use-chat-actions.ts b/packages/app/src/react/features/ai-chat/hooks/use-chat-actions.ts
index 8410c6ad..d742c06a 100644
--- a/packages/app/src/react/features/ai-chat/hooks/use-chat-actions.ts
+++ b/packages/app/src/react/features/ai-chat/hooks/use-chat-actions.ts
@@ -406,7 +406,7 @@ export const useChatActions = ({
const lastMessage = newMessages[newMessages.length - 1];
if (lastMessage) {
lastMessage.isReplying = false;
- lastMessage.message = CHAT_ERROR_MESSAGE;
+ lastMessage.message = error.error || error.message || CHAT_ERROR_MESSAGE;
lastMessage.isError = true;
}
return newMessages;
diff --git a/packages/app/src/react/features/ai-chat/pages/ai-chat.tsx b/packages/app/src/react/features/ai-chat/pages/ai-chat.tsx
index 2e6d7ce9..8a3ac093 100644
--- a/packages/app/src/react/features/ai-chat/pages/ai-chat.tsx
+++ b/packages/app/src/react/features/ai-chat/pages/ai-chat.tsx
@@ -60,7 +60,7 @@ const AIChat = () => {
clearFiles,
} = useFileUpload({
agentId: agentId || '',
- chatId: agentSettingsData?.settings?.lastConversationId,
+ chatId: agentSettings?.lastConversationId,
});
const {