diff --git a/frontend/src/app/page.module.css b/frontend/src/app/page.module.css index 11d58a395..1c22bef19 100644 --- a/frontend/src/app/page.module.css +++ b/frontend/src/app/page.module.css @@ -84,8 +84,10 @@ padding: 1rem; margin-bottom: auto; font-size: 13px; + padding-bottom: 100px; } + .message { display: inline; flex-direction: column; diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 435c1bae6..8f71ac088 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -40,16 +40,17 @@ export default function Chat() { const [chatVisible, setChatVisible] = useState(false); const [isAuthenticated, setIsAuthenticated] = useState(false); - const [selectedSeason, setSelectedSeason] = useState(''); - const [selectedAreas, setSelectedAreas] = useState(''); + const [selectedSeason, setSelectedSeason] = useState>([]); + const [selectedAreas, setSelectedAreas] = useState>([]); - const handleSeasonChange = (e: React.ChangeEvent) => { - setSelectedSeason(e.target.value); -}; - -const handleAreaChange = (e: React.ChangeEvent) => { - setSelectedAreas(e.target.value); -}; + const handleSeasonChange = (selectedOptions: MultiValue) => { + setSelectedSeason(selectedOptions); + }; + + const handleAreaChange = (selectedOptions: MultiValue) => { + setSelectedAreas(selectedOptions); + }; + const [expanded, setExpanded] = useState(false); @@ -153,7 +154,7 @@ const handleAreaChange = (e: React.ChangeEvent) => { setMessages((messages) => [...messages, newUserMessage]); setIsTyping(true); console.log(selectedSeason, selectedAreas, selectedSubjects); - + console.log(messages) const response = await fetch("http://127.0.0.1:8000/api/chat", { method: "POST", headers: { @@ -161,12 +162,13 @@ const handleAreaChange = (e: React.ChangeEvent) => { }, body: JSON.stringify({ message: [...messages, newUserMessage], - season_codes: selectedSeason ? [selectedSeason] : [], + season_codes: selectedSeason.map(season => season.value), subject: selectedSubjects.map(subject => subject.value), - areas: selectedAreas ? [selectedAreas] : [] + areas: selectedAreas.map(area => area.value) }), }); - + + console.log(response) setIsTyping(false); if (response.ok) { const data = await response.json(); @@ -322,40 +324,46 @@ const handleAreaChange = (e: React.ChangeEvent) => {
- - {/* */} - + setExpanded(true)} + onMenuClose={() => setExpanded(false)} + />