fix: correctly pass modelsData to newConversation, also prevent navigation in this case (#1162)

This commit is contained in:
Danny Avila 2023-11-09 14:32:03 -05:00 committed by GitHub
parent 5ab9802aa9
commit efe057e0d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -51,7 +51,7 @@ const useConversation = () => {
setSubmission({} as TSubmission);
resetLatestMessage();
if (conversation.conversationId === 'new') {
if (conversation.conversationId === 'new' && !modelsData) {
navigate('/chat/new');
}
},

View file

@ -38,7 +38,8 @@ export default function Root() {
useEffect(() => {
if (modelsQuery.data) {
setModelsConfig(modelsQuery.data);
newConversation(modelsQuery.data);
// Note: passing modelsQuery.data prevents navigation
newConversation({}, undefined, modelsQuery.data);
} else if (modelsQuery.isError) {
console.error('Failed to get models', modelsQuery.error);
}