()
| 4 | import Button from '../Common/Button'; |
| 5 | |
| 6 | const InputArea: React.FC = () => { |
| 7 | const [message, setMessage] = useState(''); |
| 8 | const { sendMessage, isLoading } = useChatStore(); |
| 9 | const { currentPipeline } = usePipelineStore(); |
| 10 | |
| 11 | const quickActions = [ |
| 12 | { |
| 13 | label: 'Add URL', |
| 14 | prompt: 'I want to add a new URL to scrape', |
| 15 | icon: '🔗' |
| 16 | }, |
| 17 | { |
| 18 | label: 'Define Schema', |
| 19 | prompt: 'Help me define the data schema for extraction', |
| 20 | icon: '📋' |
| 21 | }, |
| 22 | { |
| 23 | label: 'Generate Code', |
| 24 | prompt: 'Generate the Python code for my scraping pipeline', |
| 25 | icon: '💻' |
| 26 | }, |
| 27 | { |
| 28 | label: 'Run Pipeline', |
| 29 | prompt: 'Execute the scraping pipeline', |
| 30 | icon: '▶️' |
| 31 | } |
| 32 | ]; |
| 33 | |
| 34 | const handleSubmit = (e: React.FormEvent) => { |
| 35 | e.preventDefault(); |
| 36 | if (message.trim() && !isLoading && currentPipeline) { |
| 37 | sendMessage(message, currentPipeline.id); |
| 38 | setMessage(''); |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => { |
| 43 | if (e.key === 'Enter' && !e.shiftKey) { |
| 44 | e.preventDefault(); |
| 45 | handleSubmit(e); |
| 46 | } |
| 47 | }; |
| 48 | |
| 49 | const handleQuickAction = (action: typeof quickActions[0]) => { |
| 50 | if (currentPipeline) { |
| 51 | if (action.label === 'Run Pipeline') { |
| 52 | // Handle Run Pipeline differently - actually execute it |
| 53 | usePipelineStore.getState().runPipeline(currentPipeline.id); |
| 54 | } else { |
| 55 | sendMessage(action.prompt, currentPipeline.id); |
| 56 | } |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | return ( |
| 61 | <div className="border-t border-border p-4"> |
| 62 | <div className="flex flex-wrap gap-2 mb-3"> |
| 63 | {quickActions.map((action) => ( |
nothing calls this directly
no test coverage detected