chat history.

This commit is contained in:
Patrick_Pluto 2024-09-18 16:16:53 +02:00
parent 74945cb18b
commit 30edc6e795

View file

@ -40,7 +40,6 @@ const InputBackend:React.FC = () => {
if (chatResponse && chatResponse.choices && chatResponse.choices.length > 0) { if (chatResponse && chatResponse.choices && chatResponse.choices.length > 0) {
if (chatResponse.choices[0].message.content) { if (chatResponse.choices[0].message.content) {
addMessage('AI: ' + chatResponse.choices[0].message.content); addMessage('AI: ' + chatResponse.choices[0].message.content);
console.error('Error: Brain Not Found');
console.log(messages) console.log(messages)
} }
} else { } else {
@ -49,9 +48,15 @@ const InputBackend:React.FC = () => {
} }
const handleSendClick = (message: string) => { const handleSendClick = (message: string) => {
addMessage('User: ' + message); var system = "You are a helpful assistant. The following is the chat history."
prompt_mistral("mistral-large-latest", message, "You are a helpful assistant.") for (let index = 0; index < messages.length; index++) {
system += messages[index] + " ";
}; };
addMessage('User: ' + message);
prompt_mistral("mistral-large-latest", message, system)
};
const [messages, setMessages] = useState([ const [messages, setMessages] = useState([
'User: Hello!', 'User: Hello!',
'AI: Hi there!', 'AI: Hi there!',