(ui) update build

This commit is contained in:
ishaan-jaff 2024-02-13 21:42:02 -08:00
parent b4d951fea3
commit 9e36fb8f0a
33 changed files with 94 additions and 63 deletions

View file

@ -51,8 +51,11 @@ const ChatUI: React.FC<ChatUIProps> = ({ accessToken, token, userRole, userID })
const [chatHistory, setChatHistory] = useState<any[]>([]);
const [selectedModel, setSelectedModel] = useState<string | undefined>(undefined);
const [modelInfo, setModelInfo] = useState<any | null>(null); // Declare modelInfo at the component level
useEffect(() => {
if (!accessToken || !token || !userRole || !userID) {
return;
}
// Fetch model info and set the default selected model
const fetchModelInfo = async () => {
const fetchedModelInfo = await modelInfoCall(accessToken, userID, userRole);
@ -85,6 +88,10 @@ const ChatUI: React.FC<ChatUIProps> = ({ accessToken, token, userRole, userID })
const handleSendMessage = async () => {
if (inputMessage.trim() === "") return;
if (!accessToken || !token || !userRole || !userID) {
return;
}
setChatHistory((prevHistory) => [
...prevHistory,
{ role: "user", content: inputMessage },