start chatHistory

This commit is contained in:
YasinOnm08 2024-10-07 16:41:31 +02:00
parent a60cc7e941
commit 76da6aed0e
8 changed files with 89 additions and 38 deletions

View file

@ -4,14 +4,26 @@ import ConversationFrontend from '../components/ConversationFrontend';
import InputFrontend from "../components/InputFrontend";
import { sendToVoiceRecognition } from "./voice_backend"
import axios from "axios";
import { changeHistory, checkCredentials, getHistory } from './database';
import { addMessageToHistory, removeMessageFromHistory } from "./ChatHistory";
const InputOutputBackend: React.FC = () => {
interface InputOutputHandlerProps {
selectedIndex: number;
}
const InputOutputBackend: React.FC<InputOutputHandlerProps> = ({selectedIndex}) => {
// # variables
type Message = {
role: string
content: string
}
type Chat = {
name?: string
messages: Message[]
timestamp: string
}
// Define state variables for user preferences and messages
const [preferredCurrency, setPreferredCurrency] = useState<string>("USD");
const [preferredLanguage, setPreferredLanguage] = useState<string>("english");
@ -242,6 +254,7 @@ const InputOutputBackend: React.FC = () => {
const handleStopClick = () => {
endGetWorker()
getNewToken()
setInputDisabled(false)
}
const handleResendClick = () => {