Merge pull request 'build fix for sure for sure' (#128) from YasinOnm08/interstellar_ai:main into main

Reviewed-on: https://interstellardevelopment.org/code/code/React-Group/interstellar_ai/pulls/128
This commit is contained in:
Patrick 2024-10-09 14:23:38 +02:00
commit c0f95dc37e
3 changed files with 4 additions and 9 deletions

View file

@ -14,7 +14,7 @@ const InputOutputBackend: React.FC = () => {
}
// Define state variables for user preferences and messages
const [chatHistory, setChatHistory, setSelectedIndex, updateMessage] = useChatHistory()
const [chatHistory, setSelectedIndex, setChatHistory, updateMessage] = useChatHistory()
const [preferredCurrency, setPreferredCurrency] = useState<string>("USD");
const [preferredLanguage, setPreferredLanguage] = useState<string>("english");
const [timeFormat, setTimeFormat] = useState<string>("24-hour");

View file

@ -2,18 +2,13 @@ import React, { useState } from 'react';
import { useChatHistory } from '../hooks/useChatHistory';
const History: React.FC = () => {
const [chatHistory, setChatHistory, setSelectedIndex] = useChatHistory()
const [chatHistory, setSelectedIndex] = useChatHistory()
const [isEditing, setIsEditing] = useState(false);
const [inputValue, setInputValue] = useState<string>('');
setChatHistory(chatHistory)
const handleEditButtonClick = () => {
setIsEditing(true);
/* Thank you Eslint for this masterpiece of a code snippet */
setChatHistory(chatHistory)
/* Wow i feel so secure now */
};
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {

View file

@ -31,7 +31,7 @@ const setGlobalState = (newState: GlobalChatHistory): void => {
listeners.forEach((listener) => listener(globalChatHistory))
}
export const useChatHistory = (): [GlobalChatHistory, (newState:GlobalChatHistory) => void, (index:number)=>void, (messageIndex: number, newContent:string)=> void] => {
export const useChatHistory = (): [GlobalChatHistory, (index:number)=>void, (newState:GlobalChatHistory) => void,(messageIndex: number, newContent:string)=> void] => {
const [state, setState] = useState<GlobalChatHistory>(globalChatHistory)
useEffect(() => {
@ -65,5 +65,5 @@ export const useChatHistory = (): [GlobalChatHistory, (newState:GlobalChatHistor
}
}
return [state, setGlobalState, setSelectedIndex, updateMessage]
return [state, setSelectedIndex, setGlobalState, updateMessage]
}