fix(dashboard): surface model-write failure when creating a profile

POST /api/profiles returns model_set: false when the model assignment
step fails (e.g. filesystem error) while the profile itself was created
successfully. handleCreate discarded the response, so the user received
a "Profile created" success toast with no indication that their chosen
model was not persisted.

Capture the response and show an error toast when a model was selected
but model_set is explicitly false, directing the user to set it from
the profile editor.
This commit is contained in:
AhmetArif0
2026-06-03 18:14:10 +03:00
committed by Teknium
parent 6feb40e702
commit c2d11cc95d

View File

@ -414,7 +414,7 @@ export default function ProfilesPage() {
(c) => `${c.provider}\u0000${c.model}` === modelChoice,
)
: undefined;
await api.createProfile({
const res = await api.createProfile({
name,
clone_from_default: cloneAll ? false : cloneFromDefault,
clone_all: cloneAll,
@ -424,6 +424,12 @@ export default function ProfilesPage() {
model: picked?.model,
});
showToast(`${t.profiles.created}: ${name}`, "success");
if (picked && res.model_set === false) {
showToast(
`Profile created, but the model could not be saved — set it from the profile editor.`,
"error",
);
}
setNewName("");
setNewDescription("");
setNoSkills(false);