Explore snapshot and clip filter (#14439)

* backend

* add ToggleButton component

* boolean type

* frontend

* allow setting filter in input

* better padding on dual slider

* use shadcn toggle group instead of custom component
This commit is contained in:
Josh Hawkins
2024-10-18 16:16:43 -05:00
committed by GitHub
parent b56f4c4558
commit 3c591ad8a9
7 changed files with 194 additions and 3 deletions

View File

@@ -44,6 +44,8 @@ class EventsSearchQueryParams(BaseModel):
after: Optional[float] = None
before: Optional[float] = None
time_range: Optional[str] = DEFAULT_TIME_RANGE
has_clip: Optional[bool] = None
has_snapshot: Optional[bool] = None
timezone: Optional[str] = "utc"
min_score: Optional[float] = None
max_score: Optional[float] = None

View File

@@ -359,6 +359,8 @@ def events_search(request: Request, params: EventsSearchQueryParams = Depends())
min_score = params.min_score
max_score = params.max_score
time_range = params.time_range
has_clip = params.has_clip
has_snapshot = params.has_snapshot
# for similarity search
event_id = params.event_id
@@ -433,6 +435,12 @@ def events_search(request: Request, params: EventsSearchQueryParams = Depends())
if before:
event_filters.append((Event.start_time < before))
if has_clip is not None:
event_filters.append((Event.has_clip == has_clip))
if has_snapshot is not None:
event_filters.append((Event.has_snapshot == has_snapshot))
if min_score is not None and max_score is not None:
event_filters.append((Event.data["score"].between(min_score, max_score)))
else: