Skip to content
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

Embeddings UI updates #14378

Merged
merged 26 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e746956
Handle Frigate+ submitted case
NickM-27 Oct 15, 2024
4716ab2
Add search settings and rename general to ui settings
NickM-27 Oct 15, 2024
e11f4b8
Add platform aware sheet component
NickM-27 Oct 15, 2024
d76228a
use two columns on mobile view
hawkeye217 Oct 15, 2024
9d61fe3
Merge branch 'embeddings-ui' of https://github.com/blakeblackshear/fr…
hawkeye217 Oct 15, 2024
9bce6ef
Add cameras page to more filters
NickM-27 Oct 15, 2024
53ac693
clean up search settings view
hawkeye217 Oct 15, 2024
af4a291
Add time range to side filter
NickM-27 Oct 15, 2024
e48f3c5
Merge branch 'embeddings-ui' of github.com:blakeblackshear/frigate in…
NickM-27 Oct 15, 2024
28139f2
better match with ui settings
hawkeye217 Oct 15, 2024
f1ffcc0
Merge branch 'embeddings-ui' of https://github.com/blakeblackshear/fr…
hawkeye217 Oct 15, 2024
6664ec6
fix icon size
hawkeye217 Oct 15, 2024
fd7580c
use two columns on mobile view
hawkeye217 Oct 15, 2024
37bece3
clean up search settings view
hawkeye217 Oct 15, 2024
b7ffc1e
Add zones and saving logic
NickM-27 Oct 15, 2024
3fad61d
Add all filters to side panel
NickM-27 Oct 15, 2024
683e350
better match with ui settings
hawkeye217 Oct 15, 2024
00d16d8
fix icon size
hawkeye217 Oct 15, 2024
8ce569d
Fix mobile fitler page
NickM-27 Oct 15, 2024
0e180cd
Fix embeddings access
NickM-27 Oct 15, 2024
eff4e66
Cleanup
NickM-27 Oct 15, 2024
a1abaed
Fix scroll
NickM-27 Oct 15, 2024
a894cd6
Merge branch 'embeddings-ui' of https://github.com/blakeblackshear/fr…
hawkeye217 Oct 16, 2024
4fb807a
fix double scrollbars and add separators on mobile too
hawkeye217 Oct 16, 2024
39a5ca5
two columns on mobile
hawkeye217 Oct 16, 2024
68aa3aa
italics for emphasis
hawkeye217 Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frigate/embeddings/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def batch_upsert_description(self, event_descriptions: dict[str, str]) -> ndarra
embeddings = []

for desc in event_descriptions.values():
embeddings.append(self.text_embedding([desc]))
embeddings.append(self.text_embedding([desc])[0])

ids = list(event_descriptions.keys())

Expand Down
33 changes: 23 additions & 10 deletions web/src/components/card/SearchThumbnailFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
Expand All @@ -33,6 +31,7 @@ import { baseUrl } from "@/api/baseUrl";
import axios from "axios";
import { toast } from "sonner";
import { MdImageSearch } from "react-icons/md";
import { isMobileOnly } from "react-device-detect";

type SearchThumbnailProps = {
searchResult: SearchResult;
Expand Down Expand Up @@ -109,7 +108,9 @@ export default function SearchThumbnailFooter({
showFrigatePlus ? (searchResult as unknown as Event) : undefined
}
onClose={() => setShowFrigatePlus(false)}
onEventUploaded={() => {}}
onEventUploaded={() => {
searchResult.plus_id = "submitted";
}}
/>

<div className="flex flex-col items-start text-xs">
Expand All @@ -122,10 +123,12 @@ export default function SearchThumbnailFooter({
)}
{formattedDate}
</div>
<div className="flex flex-row items-center justify-end gap-8 md:gap-4">
{config?.plus?.enabled &&
<div className="flex flex-row items-center justify-end gap-6 md:gap-4">
{!isMobileOnly &&
config?.plus?.enabled &&
searchResult.has_snapshot &&
searchResult.end_time && (
searchResult.end_time &&
!searchResult.plus_id && (
<Tooltip>
<TooltipTrigger>
<FrigatePlusIcon
Expand Down Expand Up @@ -154,10 +157,6 @@ export default function SearchThumbnailFooter({
<LuMoreVertical className="size-5 cursor-pointer text-primary" />
</DropdownMenuTrigger>
<DropdownMenuContent align={"end"}>
<DropdownMenuLabel className="mt-0.5">
Tracked Object Actions
</DropdownMenuLabel>
<DropdownMenuSeparator className="mt-1" />
{searchResult.has_clip && (
<DropdownMenuItem>
<a
Expand Down Expand Up @@ -189,6 +188,20 @@ export default function SearchThumbnailFooter({
<FaArrowsRotate className="mr-2 size-4" />
<span>View object lifecycle</span>
</DropdownMenuItem>

{isMobileOnly &&
config?.plus?.enabled &&
searchResult.has_snapshot &&
searchResult.end_time &&
!searchResult.plus_id && (
<DropdownMenuItem
className="cursor-pointer"
onClick={() => setShowFrigatePlus(true)}
>
<FrigatePlusIcon className="mr-2 size-4 cursor-pointer text-primary" />
<span>Submit to Frigate+</span>
</DropdownMenuItem>
)}
<DropdownMenuItem
className="cursor-pointer"
onClick={() => setDeleteDialogOpen(true)}
Expand Down
100 changes: 64 additions & 36 deletions web/src/components/filter/CamerasFilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,70 @@ export function CamerasFilterButton({
</Button>
);
const content = (
<CamerasFilterContent
allCameras={allCameras}
groups={groups}
currentCameras={currentCameras}
setCurrentCameras={setCurrentCameras}
setOpen={setOpen}
updateCameraFilter={updateCameraFilter}
/>
);

if (isMobile) {
return (
<Drawer
open={open}
onOpenChange={(open) => {
if (!open) {
setCurrentCameras(selectedCameras);
}

setOpen(open);
}}
>
<DrawerTrigger asChild>{trigger}</DrawerTrigger>
<DrawerContent className="max-h-[75dvh] overflow-hidden">
{content}
</DrawerContent>
</Drawer>
);
}

return (
<DropdownMenu
modal={false}
open={open}
onOpenChange={(open) => {
if (!open) {
setCurrentCameras(selectedCameras);
}
setOpen(open);
}}
>
<DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>
<DropdownMenuContent>{content}</DropdownMenuContent>
</DropdownMenu>
);
}

type CamerasFilterContentProps = {
allCameras: string[];
currentCameras: string[] | undefined;
groups: [string, CameraGroupConfig][];
setCurrentCameras: (cameras: string[] | undefined) => void;
setOpen: (open: boolean) => void;
updateCameraFilter: (cameras: string[] | undefined) => void;
};
export function CamerasFilterContent({
allCameras,
currentCameras,
groups,
setCurrentCameras,
setOpen,
updateCameraFilter,
}: CamerasFilterContentProps) {
return (
<>
{isMobile && (
<>
Expand Down Expand Up @@ -158,40 +222,4 @@ export function CamerasFilterButton({
</div>
</>
);

if (isMobile) {
return (
<Drawer
open={open}
onOpenChange={(open) => {
if (!open) {
setCurrentCameras(selectedCameras);
}

setOpen(open);
}}
>
<DrawerTrigger asChild>{trigger}</DrawerTrigger>
<DrawerContent className="max-h-[75dvh] overflow-hidden">
{content}
</DrawerContent>
</Drawer>
);
}

return (
<DropdownMenu
modal={false}
open={open}
onOpenChange={(open) => {
if (!open) {
setCurrentCameras(selectedCameras);
}
setOpen(open);
}}
>
<DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>
<DropdownMenuContent>{content}</DropdownMenuContent>
</DropdownMenu>
);
}
Loading
Loading