new load behavior
This commit is contained in:
+7
-5
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user