modellist: fix cloning of chat template and system message #3262
+23
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When you change a model's system message and chat template from the defaults, and then clone it, one would expect the "Reset" and/or "Clear" options on these settings to still be available (and reset to the official defaults).
Additionally, one would expect the overrides for these settings to be preserved after a restart of GPT4All if they came from overrides on the base model.
Neither of these things was working properly, because of a mistake in the clone() call - instead of copying the defaults to the defaults and the overrides to the overrides, we copied the overrides to the defaults and didn't set the overrides. So the Reset/Clear buttons were not available. And defaults are intentionally not serialized, so after a restart the clone would act like you had clicked Reset on both settings.
Most settings don't typically come from defaults in models3.json, so none of this applies to them in practice (even though ideally they would also work this way).
This is a regression in #3147, although the way the defaults of these settings are handled was entirely new in that PR, so one could argue that until this PR this never worked quite right.