-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix saving model between chats #2843
Conversation
} | ||
}, [config, formState.isDirty]); | ||
setConfigCache(config); | ||
}, [config]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when we change presets, we use the function reset
, which sets the isDirty
to false, so we are not saving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isDirty check is require to avoid update on the first render which use the first model config from serverside, not the one from localstorage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should pass keepDirty option when update the preset:
reset({ ...config, model_config_name: selectedModel }, {
keepDirty: true,
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored it, I added keep dirty like you said, and switched to using Controller
instead of register
and it works now
@AbdBarho I just the pushed the change with correct fix by using |
You can see this bug on dev or staging if you try changing the model couple of times. Somewhere within the mess of server side / client side rendering the model config gets overwritten. --------- Co-authored-by: notmd <notmd1811@gmail.com>
You can see this bug on dev or staging if you try changing the model couple of times.
Somewhere within the mess of server side / client side rendering the model config gets overwritten.