mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
add regenerate button if genai is enabled
This commit is contained in:
parent
6c3070929f
commit
efd9ef2234
@ -291,6 +291,28 @@ function ObjectDetailsTab({
|
||||
});
|
||||
}, [desc, search]);
|
||||
|
||||
const regenerateDescription = useCallback(() => {
|
||||
if (!search) {
|
||||
return;
|
||||
}
|
||||
|
||||
axios
|
||||
.put(`events/${search.id}/description/regenerate`)
|
||||
.then((resp) => {
|
||||
if (resp.status == 200) {
|
||||
toast.success("Description regeneration requested.", {
|
||||
position: "top-center",
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
toast.error("Failed to call generative AI for a new description", {
|
||||
position: "top-center",
|
||||
});
|
||||
setDesc(search.data.description);
|
||||
});
|
||||
}, [search]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-5">
|
||||
<div className="flex w-full flex-row">
|
||||
@ -355,7 +377,10 @@ function ObjectDetailsTab({
|
||||
value={desc}
|
||||
onChange={(e) => setDesc(e.target.value)}
|
||||
/>
|
||||
<div className="flex w-full flex-row justify-end">
|
||||
<div className="flex w-full flex-row justify-end gap-2">
|
||||
{config?.genai.enabled && (
|
||||
<Button onClick={regenerateDescription}>Regenerate</Button>
|
||||
)}
|
||||
<Button variant="select" onClick={updateDescription}>
|
||||
Save
|
||||
</Button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user