forked from React-Group/interstellar_ai
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:
commit
c0f95dc37e
3 changed files with 4 additions and 9 deletions
|
@ -14,7 +14,7 @@ const InputOutputBackend: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define state variables for user preferences and messages
|
// 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 [preferredCurrency, setPreferredCurrency] = useState<string>("USD");
|
||||||
const [preferredLanguage, setPreferredLanguage] = useState<string>("english");
|
const [preferredLanguage, setPreferredLanguage] = useState<string>("english");
|
||||||
const [timeFormat, setTimeFormat] = useState<string>("24-hour");
|
const [timeFormat, setTimeFormat] = useState<string>("24-hour");
|
||||||
|
|
|
@ -2,18 +2,13 @@ import React, { useState } from 'react';
|
||||||
import { useChatHistory } from '../hooks/useChatHistory';
|
import { useChatHistory } from '../hooks/useChatHistory';
|
||||||
|
|
||||||
const History: React.FC = () => {
|
const History: React.FC = () => {
|
||||||
const [chatHistory, setChatHistory, setSelectedIndex] = useChatHistory()
|
const [chatHistory, setSelectedIndex] = useChatHistory()
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const [inputValue, setInputValue] = useState<string>('');
|
const [inputValue, setInputValue] = useState<string>('');
|
||||||
|
|
||||||
setChatHistory(chatHistory)
|
|
||||||
|
|
||||||
const handleEditButtonClick = () => {
|
const handleEditButtonClick = () => {
|
||||||
setIsEditing(true);
|
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>) => {
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|
|
@ -31,7 +31,7 @@ const setGlobalState = (newState: GlobalChatHistory): void => {
|
||||||
listeners.forEach((listener) => listener(globalChatHistory))
|
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)
|
const [state, setState] = useState<GlobalChatHistory>(globalChatHistory)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -65,5 +65,5 @@ export const useChatHistory = (): [GlobalChatHistory, (newState:GlobalChatHistor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [state, setGlobalState, setSelectedIndex, updateMessage]
|
return [state, setSelectedIndex, setGlobalState, updateMessage]
|
||||||
}
|
}
|
Loading…
Reference in a new issue