From f70128f3091a72d3e3d01b75cdcdebd06c6bd427 Mon Sep 17 00:00:00 2001 From: Tetiana Mohorian Date: Tue, 29 Apr 2025 22:44:06 +0000 Subject: [PATCH] Odstranit sk1/frontend/src/components/ChatInput.jsx --- sk1/frontend/src/components/ChatInput.jsx | 67 ----------------------- 1 file changed, 67 deletions(-) delete mode 100644 sk1/frontend/src/components/ChatInput.jsx diff --git a/sk1/frontend/src/components/ChatInput.jsx b/sk1/frontend/src/components/ChatInput.jsx deleted file mode 100644 index 745b167..0000000 --- a/sk1/frontend/src/components/ChatInput.jsx +++ /dev/null @@ -1,67 +0,0 @@ -import React, { useState } from 'react'; -import { Send } from 'lucide-react'; - -const ChatInput = ({ onSubmit }) => { - const [input, setInput] = useState(''); - const [error, setError] = useState(''); - - const handleSubmit = async (e) => { - e.preventDefault(); - setError(""); // reset chyby - - if (input.trim()) { - try { - const response = await fetch("https://hate-backend-production.up.railway.app/api/predict", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ text: input }), - }); - - const data = await response.json(); - - if (!response.ok) { - setError(data.error || "Chyba pri analýze textu."); - return; - } - - if (onSubmit) { - onSubmit(input, data.prediction); - } - - setInput(''); - } catch (error) { - console.error("Chyba požiadavky:", error); - setError("Nepodarilo sa spojiť so serverom."); - } - } else { - setError("Text nesmie byť prázdny."); - } - }; - - return ( -
-
- setInput(e.target.value)} - placeholder="Zadajte text na analýzu" - className="text-input" - /> - -
- - {error && ( -
- ⚠️ {error} -
- )} -
- ); -}; - -export default ChatInput; - -