mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Search fixes (#14217)
* Ensure semantic search is enabled before checking model download state * Only clear similarity search when removing similarity pill
This commit is contained in:
		
							parent
							
								
									74efc94649
								
							
						
					
					
						commit
						d558ac83b6
					
				@ -397,6 +397,11 @@ export default function InputWithTags({
 | 
				
			|||||||
    setIsSimilaritySearch(false);
 | 
					    setIsSimilaritySearch(false);
 | 
				
			||||||
  }, [setFilters, resetSuggestions, setSearch, setInputFocused]);
 | 
					  }, [setFilters, resetSuggestions, setSearch, setInputFocused]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const handleClearSimilarity = useCallback(() => {
 | 
				
			||||||
 | 
					    removeFilter("event_id", filters.event_id!);
 | 
				
			||||||
 | 
					    removeFilter("search_type", "similarity");
 | 
				
			||||||
 | 
					  }, [removeFilter, filters]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const handleInputBlur = useCallback(
 | 
					  const handleInputBlur = useCallback(
 | 
				
			||||||
    (e: React.FocusEvent) => {
 | 
					    (e: React.FocusEvent) => {
 | 
				
			||||||
      if (
 | 
					      if (
 | 
				
			||||||
@ -638,7 +643,7 @@ export default function InputWithTags({
 | 
				
			|||||||
                  <span className="inline-flex items-center whitespace-nowrap rounded-full bg-blue-100 px-2 py-0.5 text-sm text-blue-800">
 | 
					                  <span className="inline-flex items-center whitespace-nowrap rounded-full bg-blue-100 px-2 py-0.5 text-sm text-blue-800">
 | 
				
			||||||
                    Similarity Search
 | 
					                    Similarity Search
 | 
				
			||||||
                    <button
 | 
					                    <button
 | 
				
			||||||
                      onClick={handleClearInput}
 | 
					                      onClick={handleClearSimilarity}
 | 
				
			||||||
                      className="ml-1 focus:outline-none"
 | 
					                      className="ml-1 focus:outline-none"
 | 
				
			||||||
                      aria-label="Clear similarity search"
 | 
					                      aria-label="Clear similarity search"
 | 
				
			||||||
                    >
 | 
					                    >
 | 
				
			||||||
 | 
				
			|||||||
@ -225,10 +225,11 @@ export default function Explore() {
 | 
				
			|||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (
 | 
					  if (
 | 
				
			||||||
    !minilmModelState ||
 | 
					    config?.semantic_search.enabled &&
 | 
				
			||||||
    !minilmTokenizerState ||
 | 
					    (!minilmModelState ||
 | 
				
			||||||
    !clipImageModelState ||
 | 
					      !minilmTokenizerState ||
 | 
				
			||||||
    !clipTextModelState
 | 
					      !clipImageModelState ||
 | 
				
			||||||
 | 
					      !clipTextModelState)
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" />
 | 
					      <ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" />
 | 
				
			||||||
@ -237,7 +238,7 @@ export default function Explore() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <>
 | 
					    <>
 | 
				
			||||||
      {!allModelsLoaded ? (
 | 
					      {config?.semantic_search.enabled && !allModelsLoaded ? (
 | 
				
			||||||
        <div className="absolute inset-0 left-1/2 top-1/2 flex h-96 w-96 -translate-x-1/2 -translate-y-1/2">
 | 
					        <div className="absolute inset-0 left-1/2 top-1/2 flex h-96 w-96 -translate-x-1/2 -translate-y-1/2">
 | 
				
			||||||
          <div className="flex flex-col items-center justify-center space-y-3 rounded-lg bg-background/50 p-5">
 | 
					          <div className="flex flex-col items-center justify-center space-y-3 rounded-lg bg-background/50 p-5">
 | 
				
			||||||
            <div className="my-5 flex flex-col items-center gap-2 text-xl">
 | 
					            <div className="my-5 flex flex-col items-center gap-2 text-xl">
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user