From 615bedfa9c6b9dabff0bcadfe73545e05372a281 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:20:04 -0500 Subject: [PATCH] similarity search tweaks --- web/src/components/input/InputWithTags.tsx | 119 +++++++++++---------- 1 file changed, 62 insertions(+), 57 deletions(-) diff --git a/web/src/components/input/InputWithTags.tsx b/web/src/components/input/InputWithTags.tsx index 1e241a8bc..c14056a79 100644 --- a/web/src/components/input/InputWithTags.tsx +++ b/web/src/components/input/InputWithTags.tsx @@ -7,7 +7,7 @@ import React, { } from "react"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; -import { LuX, LuFilter } from "react-icons/lu"; +import { LuX, LuFilter, LuImage } from "react-icons/lu"; import { SearchFilter, SearchSource } from "@/types/search"; type FilterType = keyof SearchFilter; @@ -442,7 +442,7 @@ export default function InputWithTags({ aria-expanded={showSuggestions} />
- {Object.keys(filters).length > 0 && ( + {(Object.keys(filters).length > 0 || isSimilaritySearch) && ( )} {(inputValue || Object.keys(filters).length > 0) && ( @@ -472,66 +476,67 @@ export default function InputWithTags({ {((showFilters && (Object.keys(filters).length > 0 || isSimilaritySearch)) || showSuggestions) && ( -
- {showFilters && Object.keys(filters).length > 0 && ( -
- {isSimilaritySearch && ( - - Similarity Search - - - )} - {Object.entries(filters).map(([filterType, filterValues]) => - Array.isArray(filterValues) ? ( - filterValues.map((value, index) => ( - - {filterType}:{value} - - - )) - ) : ( - - {filterType}: - {filterType === "before" || filterType === "after" - ? new Date(filterValues as number).toLocaleDateString() - : filterValues} +
+ {showFilters && + (Object.keys(filters).length > 0 || isSimilaritySearch) && ( +
+ {isSimilaritySearch && ( + + Similarity Search - ), - )} -
- )} + )} + {Object.entries(filters).map(([filterType, filterValues]) => + Array.isArray(filterValues) ? ( + filterValues.map((value, index) => ( + + {filterType}:{value} + + + )) + ) : ( + + {filterType}: + {filterType === "before" || filterType === "after" + ? new Date(filterValues as number).toLocaleDateString() + : filterValues} + + + ), + )} +
+ )} {showSuggestions && (