mirror of
				https://github.com/ItzCrazyKns/Perplexica.git
				synced 2025-11-03 20:28:14 +00:00 
			
		
		
		
	feat(app): add auto video & image search
This commit is contained in:
		@@ -58,14 +58,17 @@ const useSocket = (
 | 
			
		||||
        let embeddingModelProvider = localStorage.getItem(
 | 
			
		||||
          'embeddingModelProvider',
 | 
			
		||||
        );
 | 
			
		||||
        let openAIBaseURL =
 | 
			
		||||
          chatModelProvider === 'custom_openai'
 | 
			
		||||
            ? localStorage.getItem('openAIBaseURL')
 | 
			
		||||
            : null;
 | 
			
		||||
        let openAIPIKey =
 | 
			
		||||
          chatModelProvider === 'custom_openai'
 | 
			
		||||
            ? localStorage.getItem('openAIApiKey')
 | 
			
		||||
            : null;
 | 
			
		||||
 | 
			
		||||
        const autoImageSearch = localStorage.getItem('autoImageSearch');
 | 
			
		||||
        const autoVideoSearch = localStorage.getItem('autoVideoSearch');
 | 
			
		||||
 | 
			
		||||
        if (!autoImageSearch) {
 | 
			
		||||
          localStorage.setItem('autoImageSearch', 'true');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!autoVideoSearch) {
 | 
			
		||||
          localStorage.setItem('autoVideoSearch', 'false');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const providers = await fetch(
 | 
			
		||||
          `${process.env.NEXT_PUBLIC_API_URL}/models`,
 | 
			
		||||
@@ -595,6 +598,17 @@ const ChatWindow = ({ id }: { id?: string }) => {
 | 
			
		||||
            }),
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const autoImageSearch = localStorage.getItem('autoImageSearch');
 | 
			
		||||
        const autoVideoSearch = localStorage.getItem('autoVideoSearch');
 | 
			
		||||
 | 
			
		||||
        if (autoImageSearch === 'true') {
 | 
			
		||||
          document.getElementById('search-images')?.click();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (autoVideoSearch === 'true') {
 | 
			
		||||
          document.getElementById('search-videos')?.click();
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@ const SearchImages = ({
 | 
			
		||||
    <>
 | 
			
		||||
      {!loading && images === null && (
 | 
			
		||||
        <button
 | 
			
		||||
          id="search-images"
 | 
			
		||||
          onClick={async () => {
 | 
			
		||||
            setLoading(true);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,7 @@ const Searchvideos = ({
 | 
			
		||||
    <>
 | 
			
		||||
      {!loading && videos === null && (
 | 
			
		||||
        <button
 | 
			
		||||
          id="search-videos"
 | 
			
		||||
          onClick={async () => {
 | 
			
		||||
            setLoading(true);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user