new load behavior

This commit is contained in:
Mckay Wrigley
2023-03-23 08:54:22 -06:00
parent 2b1ef7be3e
commit 83217c6d83
3 changed files with 19 additions and 9 deletions
+7 -5
View File
@@ -82,7 +82,7 @@ export default function Home() {
}
if (updatedConversation.messages.length === 1) {
const {content} = message
const { content } = message;
const customName = content.length > 30 ? content.substring(0, 30) + "..." : content;
updatedConversation = {
@@ -291,7 +291,9 @@ export default function Home() {
}, [selectedConversation]);
useEffect(() => {
fetchModels(apiKey);
if (apiKey) {
fetchModels(apiKey);
}
}, [apiKey]);
useEffect(() => {
@@ -300,9 +302,10 @@ export default function Home() {
setLightMode(theme as "dark" | "light");
}
const apiKey = localStorage.getItem("apiKey") || "";
const apiKey = localStorage.getItem("apiKey");
if (apiKey) {
setApiKey(apiKey);
fetchModels(apiKey);
}
if (window.innerWidth < 640) {
@@ -330,8 +333,6 @@ export default function Home() {
prompt: DEFAULT_SYSTEM_PROMPT
});
}
fetchModels(apiKey);
}, []);
return (
@@ -396,6 +397,7 @@ export default function Home() {
<Chat
conversation={selectedConversation}
messageIsStreaming={messageIsStreaming}
apiKey={apiKey}
modelError={modelError}
messageError={messageError}
models={models}