mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-07 03:35:26 +03:00
address PR comment on thumb search param name
This commit is contained in:
parent
4ff0c3afa3
commit
8de27ab1e5
@ -175,7 +175,7 @@ Events from the database. Accepts the following query string parameters:
|
||||
| `min_length` | float | Minimum length of the event |
|
||||
| `max_length` | float | Maximum length of the event |
|
||||
| `search` | str | Search query for semantic search |
|
||||
| `like` | str | Event ID for thumbnail similarity search |
|
||||
| `thumb_like` | str | Event ID for thumbnail similarity search |
|
||||
|
||||
### `GET /api/timeline`
|
||||
|
||||
|
||||
@ -1056,7 +1056,7 @@ def events():
|
||||
max_length = request.args.get("max_length", type=float)
|
||||
search = request.args.get("search", type=str) or None
|
||||
search_type = request.args.get("search_type", "all")
|
||||
like = request.args.get("like", type=str) or None
|
||||
thumb_like = request.args.get("thumb_like", type=str) or None
|
||||
|
||||
clauses = []
|
||||
|
||||
@ -1219,10 +1219,10 @@ def events():
|
||||
elif len(embeddings_filters) == 1:
|
||||
where = embeddings_filters[0]
|
||||
|
||||
if like is not None:
|
||||
if thumb_like is not None:
|
||||
# Grab the ids of events that match the thumbnail image embeddings
|
||||
thumbnails: Collection = current_app.embeddings.thumbnail
|
||||
search_event = Event.get(Event.id == like)
|
||||
search_event = Event.get(Event.id == thumb_like)
|
||||
thumbnail = base64.b64decode(search_event.thumbnail)
|
||||
img = np.array(Image.open(io.BytesIO(thumbnail)).convert("RGB"))
|
||||
thumb_result: QueryResult = thumbnails.query(
|
||||
|
||||
@ -274,10 +274,10 @@ export default function Events({ path, ...props }) {
|
||||
if (e) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
if (searchParams?.like == event_id) {
|
||||
if (searchParams?.thumb_like == event_id) {
|
||||
return;
|
||||
}
|
||||
onFilter('like', event_id);
|
||||
onFilter('thumb_like', event_id);
|
||||
};
|
||||
|
||||
const showSubmitToPlus = (event_id, label, box, e) => {
|
||||
@ -310,7 +310,7 @@ export default function Events({ path, ...props }) {
|
||||
(name, value) => {
|
||||
setShowInProgress(false);
|
||||
const updatedParams = { ...searchParams, [name]: value };
|
||||
if (name !== 'like') delete updatedParams['like'];
|
||||
if (name !== 'thumb_like') delete updatedParams['thumb_like'];
|
||||
setSearchParams(updatedParams);
|
||||
const queryString = Object.keys(updatedParams)
|
||||
.map((key) => {
|
||||
@ -336,7 +336,7 @@ export default function Events({ path, ...props }) {
|
||||
const isDone =
|
||||
(eventPages?.[eventPages.length - 1]?.length ?? 0) < API_LIMIT ||
|
||||
(searchParams?.search?.length ?? 0) > 0 ||
|
||||
(searchParams?.like?.length ?? 0) > 0;
|
||||
(searchParams?.thumb_like?.length ?? 0) > 0;
|
||||
|
||||
// hooks for infinite scroll
|
||||
const observer = useRef();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user