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