diff --git a/webui/react-ui/src/hooks/useChat.js b/webui/react-ui/src/hooks/useChat.js index 03aa113..0c0d12e 100644 --- a/webui/react-ui/src/hooks/useChat.js +++ b/webui/react-ui/src/hooks/useChat.js @@ -150,6 +150,11 @@ export function useChat(agentName) { localMessageContents.current.clear(); // Clear tracked local messages }, []); + // Clear error state + const clearError = useCallback(() => { + setError(null); + }, []); + return { messages, sending, @@ -157,5 +162,6 @@ export function useChat(agentName) { isConnected, sendMessage, clearChat, + clearError, }; } \ No newline at end of file diff --git a/webui/react-ui/src/pages/Chat.jsx b/webui/react-ui/src/pages/Chat.jsx index a33e38f..bf88639 100644 --- a/webui/react-ui/src/pages/Chat.jsx +++ b/webui/react-ui/src/pages/Chat.jsx @@ -15,7 +15,8 @@ function Chat() { error, isConnected, sendMessage, - clearChat + clearChat, + clearError } = useChat(name); // Scroll to bottom when messages change @@ -27,8 +28,9 @@ function Chat() { useEffect(() => { if (error) { showToast(error, 'error'); + clearError(); } - }, [error, showToast]); + }, [error, showToast, clearError]); // Handle form submission const handleSubmit = async (e) => { @@ -115,7 +117,7 @@ function Chat() { placeholder="Type your message... (Press Enter to send, Shift+Enter for new line)" disabled={sending || !isConnected} className="form-control" - rows={2} + rows={5} style={{ flex: 1, resize: 'vertical', minHeight: '38px', maxHeight: '150px' }} />