'use client'; import { useState } from 'react'; import axios from 'axios'; export default function ChatPage() { const [question, setQuestion] = useState(''); const [history, setHistory] = useState([['User', 'Hello!']]); const askQuestion = async () => { const response = await axios.post('http://localhost:8000/chat/', { model: 'gpt-3.5-turbo', question, history }); setHistory(response.data.history); setQuestion(''); }; return (
{speaker}: {text}
))}