forked from React-Group/interstellar_ai
npm build fixes half
This commit is contained in:
parent
61faa7612c
commit
db4a24b5cd
4 changed files with 9 additions and 28 deletions
|
@ -4,7 +4,6 @@ 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 { useChatHistory } from '../hooks/useChatHistory';
|
||||
|
||||
const InputOutputBackend: React.FC = () => {
|
||||
|
@ -80,13 +79,9 @@ const InputOutputBackend: React.FC = () => {
|
|||
}, [preferredCurrency, preferredLanguage, timeFormat, preferredMeasurement, timeZone, dateFormat, myBoolean]);
|
||||
|
||||
useEffect(() => {
|
||||
const updateSystemprompt = (prompt: string) => {
|
||||
setMessages(prevMessages => {
|
||||
const newMessage = { role: "system", content: prompt }
|
||||
return [newMessage, ...prevMessages]
|
||||
})
|
||||
}
|
||||
updateSystemprompt
|
||||
const messageIndex = 0 // system prompt is the first so index 0
|
||||
updateMessage(messageIndex, systemMessage)
|
||||
console.log(messages)
|
||||
},[systemMessage])
|
||||
|
||||
|
||||
|
@ -188,17 +183,6 @@ const InputOutputBackend: React.FC = () => {
|
|||
}
|
||||
const messageIndex = chatHistory.chats[chatHistory.selectedIndex].messages.length-1
|
||||
updateMessage(messageIndex,newContent)
|
||||
// setMessages((prevMessages) => {
|
||||
// const updatedMessages = prevMessages.slice(); // Create a shallow copy of the current messages
|
||||
// if (updatedMessages.length > 0) {
|
||||
// const lastMessage = updatedMessages[updatedMessages.length - 1];
|
||||
// updatedMessages[updatedMessages.length - 1] = {
|
||||
// ...lastMessage, // Keep the existing role and other properties
|
||||
// content: newContent, // Update only the content
|
||||
// };
|
||||
// }
|
||||
// return updatedMessages; // Return the updated array
|
||||
// });
|
||||
};
|
||||
|
||||
const addMessage = (role: string, content: string) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue