mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-22 19:59:02 +03:00
Miscellaneous fixes (0.17 beta) (#21737)
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
* use default stable api version for gemini genai client * update gemini docs * remove outdated genai.md and update correct file * Classification fixes * Mutate when a date is selected and marked as reviewed --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
co-authored by
Nicolas Mowen
parent
90b14f1a32
commit
a75f6945ae
@@ -141,16 +141,36 @@ export default function ClassificationModelEditDialog({
|
||||
});
|
||||
|
||||
// Fetch dataset to get current classes for state models
|
||||
const { data: dataset } = useSWR<ClassificationDatasetResponse>(
|
||||
isStateModel ? `classification/${model.name}/dataset` : null,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
},
|
||||
);
|
||||
const { data: dataset, mutate: mutateDataset } =
|
||||
useSWR<ClassificationDatasetResponse>(
|
||||
isStateModel && open ? `classification/${model.name}/dataset` : null,
|
||||
{ revalidateOnFocus: false },
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
if (isObjectModel) {
|
||||
form.reset({
|
||||
objectLabel: model.object_config?.objects?.[0] || "",
|
||||
objectType:
|
||||
(model.object_config
|
||||
?.classification_type as ObjectClassificationType) || "sub_label",
|
||||
} as ObjectFormData);
|
||||
} else {
|
||||
form.reset({
|
||||
classes: [""],
|
||||
} as StateFormData);
|
||||
}
|
||||
|
||||
if (isStateModel) {
|
||||
mutateDataset();
|
||||
}
|
||||
}
|
||||
}, [open, isObjectModel, isStateModel, model, form, mutateDataset]);
|
||||
|
||||
// Update form with classes from dataset when loaded
|
||||
useEffect(() => {
|
||||
if (isStateModel && dataset?.categories) {
|
||||
if (isStateModel && open && dataset?.categories) {
|
||||
const classes = Object.keys(dataset.categories).filter(
|
||||
(key) => key !== "none",
|
||||
);
|
||||
@@ -161,7 +181,7 @@ export default function ClassificationModelEditDialog({
|
||||
);
|
||||
}
|
||||
}
|
||||
}, [dataset, isStateModel, form]);
|
||||
}, [dataset, isStateModel, open, form]);
|
||||
|
||||
const watchedClasses = isStateModel
|
||||
? (form as ReturnType<typeof useForm<StateFormData>>).watch("classes")
|
||||
|
||||
Reference in New Issue
Block a user