import React, { useState } from 'react'; import axios from 'axios'; const TextRequest = () => { const [input, setInput] = useState(''); const [response, setResponse] = useState(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleSubmit = async () => { setLoading(true); setError(null); try { const result = await axios.post('http://localhost:8000/execute', { task: { type: "text_task", input: input, auto_team: true // Let the system select appropriate agents } }); setResponse(result.data); setInput(''); // Clear input after successful submission } catch (err) { setError(err.response?.data?.error || 'Error processing request'); console.error('Request error:', err); } setLoading(false); }; return (