2024-06-09 09:28:52 +00:00
|
|
|
<script lang="ts">
|
2024-09-27 23:36:35 +00:00
|
|
|
import { getRAGConfig, updateRAGConfig } from '$lib/apis/retrieval';
|
2024-06-09 09:28:52 +00:00
|
|
|
import Switch from '$lib/components/common/Switch.svelte';
|
|
|
|
|
|
2024-10-02 04:32:59 +00:00
|
|
|
import { models } from '$lib/stores';
|
2024-06-09 09:28:52 +00:00
|
|
|
import { onMount, getContext } from 'svelte';
|
|
|
|
|
import { toast } from 'svelte-sonner';
|
2024-06-25 12:15:29 +00:00
|
|
|
import SensitiveInput from '$lib/components/common/SensitiveInput.svelte';
|
2025-02-18 02:14:26 +00:00
|
|
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
2024-06-09 09:28:52 +00:00
|
|
|
|
|
|
|
|
const i18n = getContext('i18n');
|
|
|
|
|
|
|
|
|
|
export let saveHandler: Function;
|
|
|
|
|
|
|
|
|
|
let webConfig = null;
|
2024-06-11 22:44:36 +00:00
|
|
|
let webSearchEngines = [
|
|
|
|
|
'searxng',
|
|
|
|
|
'google_pse',
|
|
|
|
|
'brave',
|
2024-12-08 05:21:10 +00:00
|
|
|
'kagi',
|
2024-10-29 14:45:38 +00:00
|
|
|
'mojeek',
|
2025-02-10 08:44:47 +00:00
|
|
|
'bocha',
|
2024-06-11 22:44:36 +00:00
|
|
|
'serpstack',
|
|
|
|
|
'serper',
|
|
|
|
|
'serply',
|
2024-08-27 07:45:17 +00:00
|
|
|
'searchapi',
|
2025-02-14 04:24:58 +00:00
|
|
|
'serpapi',
|
2024-06-14 15:14:11 +00:00
|
|
|
'duckduckgo',
|
2024-06-22 14:36:15 +00:00
|
|
|
'tavily',
|
2024-10-28 09:33:52 +00:00
|
|
|
'jina',
|
2025-02-04 18:13:05 +00:00
|
|
|
'bing',
|
2025-02-27 08:12:41 +00:00
|
|
|
'exa',
|
|
|
|
|
'perplexity'
|
2024-06-11 22:44:36 +00:00
|
|
|
];
|
2024-06-09 09:28:52 +00:00
|
|
|
|
|
|
|
|
let youtubeLanguage = 'en';
|
|
|
|
|
let youtubeTranslation = null;
|
2024-11-27 14:09:33 +00:00
|
|
|
let youtubeProxyUrl = '';
|
2024-06-09 09:28:52 +00:00
|
|
|
|
|
|
|
|
const submitHandler = async () => {
|
2025-02-05 16:14:40 +00:00
|
|
|
// Convert domain filter string to array before sending
|
2025-02-09 21:18:26 +00:00
|
|
|
if (webConfig.search.domain_filter_list) {
|
|
|
|
|
webConfig.search.domain_filter_list = webConfig.search.domain_filter_list
|
|
|
|
|
.split(',')
|
|
|
|
|
.map((domain) => domain.trim())
|
|
|
|
|
.filter((domain) => domain.length > 0);
|
|
|
|
|
} else {
|
|
|
|
|
webConfig.search.domain_filter_list = [];
|
|
|
|
|
}
|
2025-02-05 16:14:40 +00:00
|
|
|
|
2024-06-09 09:28:52 +00:00
|
|
|
const res = await updateRAGConfig(localStorage.token, {
|
|
|
|
|
web: webConfig,
|
|
|
|
|
youtube: {
|
|
|
|
|
language: youtubeLanguage.split(',').map((lang) => lang.trim()),
|
2024-11-27 14:09:33 +00:00
|
|
|
translation: youtubeTranslation,
|
|
|
|
|
proxy_url: youtubeProxyUrl
|
2024-06-09 09:28:52 +00:00
|
|
|
}
|
|
|
|
|
});
|
2025-02-10 21:44:25 +00:00
|
|
|
|
|
|
|
|
webConfig.search.domain_filter_list = webConfig.search.domain_filter_list.join(', ');
|
2024-06-09 09:28:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMount(async () => {
|
|
|
|
|
const res = await getRAGConfig(localStorage.token);
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
webConfig = res.web;
|
2025-02-05 16:14:40 +00:00
|
|
|
// Convert array back to comma-separated string for display
|
|
|
|
|
if (webConfig?.search?.domain_filter_list) {
|
|
|
|
|
webConfig.search.domain_filter_list = webConfig.search.domain_filter_list.join(', ');
|
|
|
|
|
}
|
2024-06-09 09:28:52 +00:00
|
|
|
|
|
|
|
|
youtubeLanguage = res.youtube.language.join(',');
|
|
|
|
|
youtubeTranslation = res.youtube.translation;
|
2024-11-27 14:09:33 +00:00
|
|
|
youtubeProxyUrl = res.youtube.proxy_url;
|
2024-06-09 09:28:52 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<form
|
|
|
|
|
class="flex flex-col h-full justify-between space-y-3 text-sm"
|
|
|
|
|
on:submit|preventDefault={async () => {
|
|
|
|
|
await submitHandler();
|
|
|
|
|
saveHandler();
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-09 09:41:52 +00:00
|
|
|
<div class=" space-y-3 overflow-y-scroll scrollbar-hidden h-full">
|
2024-06-09 09:28:52 +00:00
|
|
|
{#if webConfig}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="">
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<div class=" mb-2.5 text-base font-medium">{$i18n.t('General')}</div>
|
|
|
|
|
|
|
|
|
|
<hr class=" border-gray-100 dark:border-gray-850 my-2" />
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class=" mb-2.5 flex w-full justify-between">
|
2024-06-09 09:28:52 +00:00
|
|
|
<div class=" self-center text-xs font-medium">
|
2025-02-26 23:56:45 +00:00
|
|
|
{$i18n.t('Web Search')}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center relative">
|
|
|
|
|
<Switch bind:state={webConfig.search.enabled} />
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
2025-02-18 02:14:26 +00:00
|
|
|
</div>
|
|
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class=" mb-2.5 flex w-full justify-between">
|
|
|
|
|
<div class=" self-center text-xs font-medium">
|
|
|
|
|
{$i18n.t('Web Search Engine')}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center relative">
|
|
|
|
|
<select
|
|
|
|
|
class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 p-1 text-xs bg-transparent outline-hidden text-right"
|
|
|
|
|
bind:value={webConfig.search.engine}
|
|
|
|
|
placeholder={$i18n.t('Select a engine')}
|
|
|
|
|
required
|
|
|
|
|
>
|
|
|
|
|
<option disabled selected value="">{$i18n.t('Select a engine')}</option>
|
|
|
|
|
{#each webSearchEngines as engine}
|
|
|
|
|
<option value={engine}>{engine}</option>
|
|
|
|
|
{/each}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
2025-02-21 21:40:11 +00:00
|
|
|
</div>
|
|
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
{#if webConfig.search.engine !== ''}
|
2024-06-09 09:28:52 +00:00
|
|
|
{#if webConfig.search.engine === 'searxng'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Searxng Query URL')}
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="flex w-full">
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<input
|
|
|
|
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder={$i18n.t('Enter Searxng Query URL')}
|
|
|
|
|
bind:value={webConfig.search.searxng_query_url}
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{:else if webConfig.search.engine === 'google_pse'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Google PSE API Key')}
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Google PSE API Key')}
|
|
|
|
|
bind:value={webConfig.search.google_pse_api_key}
|
|
|
|
|
/>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mt-1.5">
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Google PSE Engine Id')}
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="flex w-full">
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<input
|
|
|
|
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder={$i18n.t('Enter Google PSE Engine Id')}
|
|
|
|
|
bind:value={webConfig.search.google_pse_engine_id}
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{:else if webConfig.search.engine === 'brave'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Brave Search API Key')}
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Brave Search API Key')}
|
|
|
|
|
bind:value={webConfig.search.brave_search_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
2024-12-08 05:21:10 +00:00
|
|
|
{:else if webConfig.search.engine === 'kagi'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Kagi Search API Key')}
|
|
|
|
|
</div>
|
2024-12-08 05:21:10 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Kagi Search API Key')}
|
|
|
|
|
bind:value={webConfig.search.kagi_search_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
.
|
2024-12-08 05:21:10 +00:00
|
|
|
</div>
|
2024-10-29 14:45:38 +00:00
|
|
|
{:else if webConfig.search.engine === 'mojeek'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Mojeek Search API Key')}
|
|
|
|
|
</div>
|
2024-10-29 14:45:38 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Mojeek Search API Key')}
|
|
|
|
|
bind:value={webConfig.search.mojeek_search_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-10-29 14:45:38 +00:00
|
|
|
</div>
|
2025-02-10 08:44:47 +00:00
|
|
|
{:else if webConfig.search.engine === 'bocha'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Bocha Search API Key')}
|
|
|
|
|
</div>
|
2025-02-10 08:44:47 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Bocha Search API Key')}
|
|
|
|
|
bind:value={webConfig.search.bocha_search_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-02-10 08:44:47 +00:00
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
{:else if webConfig.search.engine === 'serpstack'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Serpstack API Key')}
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Serpstack API Key')}
|
|
|
|
|
bind:value={webConfig.search.serpstack_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
|
|
|
|
{:else if webConfig.search.engine === 'serper'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Serper API Key')}
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Serper API Key')}
|
|
|
|
|
bind:value={webConfig.search.serper_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
2024-06-10 01:52:08 +00:00
|
|
|
{:else if webConfig.search.engine === 'serply'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Serply API Key')}
|
|
|
|
|
</div>
|
2024-06-10 01:52:08 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Serply API Key')}
|
|
|
|
|
bind:value={webConfig.search.serply_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-10 01:52:08 +00:00
|
|
|
</div>
|
2024-08-27 07:45:17 +00:00
|
|
|
{:else if webConfig.search.engine === 'searchapi'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('SearchApi API Key')}
|
|
|
|
|
</div>
|
2024-08-27 07:45:17 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter SearchApi API Key')}
|
|
|
|
|
bind:value={webConfig.search.searchapi_api_key}
|
|
|
|
|
/>
|
2024-08-27 07:45:17 +00:00
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mt-1.5">
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('SearchApi Engine')}
|
|
|
|
|
</div>
|
2024-08-27 07:45:17 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="flex w-full">
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<input
|
|
|
|
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder={$i18n.t('Enter SearchApi Engine')}
|
|
|
|
|
bind:value={webConfig.search.searchapi_engine}
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-08-27 07:45:17 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-02-14 04:24:58 +00:00
|
|
|
{:else if webConfig.search.engine === 'serpapi'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('SerpApi API Key')}
|
|
|
|
|
</div>
|
2025-02-14 04:24:58 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter SerpApi API Key')}
|
|
|
|
|
bind:value={webConfig.search.serpapi_api_key}
|
|
|
|
|
/>
|
2025-02-14 04:24:58 +00:00
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mt-1.5">
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('SerpApi Engine')}
|
|
|
|
|
</div>
|
2025-02-14 04:24:58 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="flex w-full">
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<input
|
|
|
|
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder={$i18n.t('Enter SerpApi Engine')}
|
|
|
|
|
bind:value={webConfig.search.serpapi_engine}
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-02-14 04:24:58 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-14 15:14:11 +00:00
|
|
|
{:else if webConfig.search.engine === 'tavily'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Tavily API Key')}
|
|
|
|
|
</div>
|
2024-06-14 15:14:11 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Tavily API Key')}
|
|
|
|
|
bind:value={webConfig.search.tavily_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-14 15:14:11 +00:00
|
|
|
</div>
|
2024-11-04 01:07:24 +00:00
|
|
|
{:else if webConfig.search.engine === 'jina'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Jina API Key')}
|
|
|
|
|
</div>
|
2024-11-04 01:07:24 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Jina API Key')}
|
|
|
|
|
bind:value={webConfig.search.jina_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-11-04 01:07:24 +00:00
|
|
|
</div>
|
2025-02-04 18:13:05 +00:00
|
|
|
{:else if webConfig.search.engine === 'exa'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Exa API Key')}
|
|
|
|
|
</div>
|
2025-02-04 18:13:05 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Exa API Key')}
|
|
|
|
|
bind:value={webConfig.search.exa_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-02-04 18:13:05 +00:00
|
|
|
</div>
|
2025-02-27 08:12:41 +00:00
|
|
|
{:else if webConfig.search.engine === 'perplexity'}
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Perplexity API Key')}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Perplexity API Key')}
|
|
|
|
|
bind:value={webConfig.search.perplexity_api_key}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-11-04 01:07:24 +00:00
|
|
|
{:else if webConfig.search.engine === 'bing'}
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div>
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Bing Search V7 Endpoint')}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="flex w-full">
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<input
|
|
|
|
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder={$i18n.t('Enter Bing Search V7 Endpoint')}
|
|
|
|
|
bind:value={webConfig.search.bing_search_v7_endpoint}
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-11-04 01:07:24 +00:00
|
|
|
</div>
|
|
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mt-2">
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Bing Search V7 Subscription Key')}
|
2024-11-04 01:07:24 +00:00
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
|
|
|
|
|
<SensitiveInput
|
|
|
|
|
placeholder={$i18n.t('Enter Bing Search V7 Subscription Key')}
|
|
|
|
|
bind:value={webConfig.search.bing_search_v7_subscription_key}
|
|
|
|
|
/>
|
2024-11-04 01:07:24 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
{/if}
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if webConfig.search.enabled}
|
|
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
<div class="w-full">
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Search Result Count')}
|
|
|
|
|
</div>
|
2024-11-04 01:07:24 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<input
|
|
|
|
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
|
|
|
|
placeholder={$i18n.t('Search Result Count')}
|
|
|
|
|
bind:value={webConfig.search.result_count}
|
|
|
|
|
required
|
|
|
|
|
/>
|
2024-11-04 01:07:24 +00:00
|
|
|
</div>
|
|
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="w-full">
|
|
|
|
|
<div class=" self-center text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Concurrent Requests')}
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<input
|
|
|
|
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
|
|
|
|
placeholder={$i18n.t('Concurrent Requests')}
|
|
|
|
|
bind:value={webConfig.search.concurrent_requests}
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-2.5 flex w-full flex-col">
|
|
|
|
|
<div class=" text-xs font-medium mb-1">
|
|
|
|
|
{$i18n.t('Domain Filter List')}
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<input
|
2025-02-16 03:27:25 +00:00
|
|
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
2025-02-26 23:56:45 +00:00
|
|
|
placeholder={$i18n.t(
|
|
|
|
|
'Enter domains separated by commas (e.g., example.com,site.org)'
|
|
|
|
|
)}
|
|
|
|
|
bind:value={webConfig.search.domain_filter_list}
|
2024-06-09 09:28:52 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
{/if}
|
2025-02-05 16:14:40 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class=" mb-2.5 flex w-full justify-between">
|
|
|
|
|
<div class=" self-center text-xs font-medium">
|
|
|
|
|
<Tooltip content={$i18n.t('Full Context Mode')} placement="top-start">
|
|
|
|
|
{$i18n.t('Bypass Embedding and Retrieval')}
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center relative">
|
|
|
|
|
<Tooltip
|
|
|
|
|
content={webConfig.BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL
|
2025-03-06 12:16:34 +00:00
|
|
|
? $i18n.t('Inject the entire content as context for comprehensive processing, this is recommended for complex queries.')
|
|
|
|
|
: $i18n.t('Default to segmented retrieval for focused and relevant content extraction, this is recommended for most cases.')}
|
2025-02-26 23:56:45 +00:00
|
|
|
>
|
|
|
|
|
<Switch bind:state={webConfig.BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL} />
|
|
|
|
|
</Tooltip>
|
2025-02-05 16:14:40 +00:00
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
</div>
|
2025-02-05 16:14:40 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class=" mb-2.5 flex w-full justify-between">
|
|
|
|
|
<div class=" self-center text-xs font-medium">
|
|
|
|
|
{$i18n.t('Trust Proxy Environment')}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center relative">
|
|
|
|
|
<Tooltip
|
|
|
|
|
content={webConfig.search.trust_env
|
|
|
|
|
? 'Use proxy designated by http_proxy and https_proxy environment variables to fetch page contents'
|
|
|
|
|
: 'Use no proxy to fetch page contents.'}
|
|
|
|
|
>
|
|
|
|
|
<Switch bind:state={webConfig.search.trust_env} />
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</div>
|
2025-02-05 16:14:40 +00:00
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="mb-3">
|
|
|
|
|
<div class=" mb-2.5 text-base font-medium">{$i18n.t('Loader')}</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<hr class=" border-gray-100 dark:border-gray-850 my-2" />
|
2024-06-09 09:28:52 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class=" mb-2.5 flex w-full justify-between">
|
2024-06-09 09:28:52 +00:00
|
|
|
<div class=" self-center text-xs font-medium">
|
|
|
|
|
{$i18n.t('Bypass SSL verification for Websites')}
|
|
|
|
|
</div>
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class="flex items-center relative">
|
|
|
|
|
<Switch bind:state={webConfig.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION} />
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
|
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class=" mb-2.5 flex w-full justify-between">
|
|
|
|
|
<div class=" self-center text-xs font-medium">
|
|
|
|
|
{$i18n.t('Youtube Language')}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center relative">
|
2024-06-09 09:28:52 +00:00
|
|
|
<input
|
2025-02-26 23:56:45 +00:00
|
|
|
class="flex-1 w-full rounded-lg text-sm bg-transparent outline-hidden"
|
2024-06-09 09:28:52 +00:00
|
|
|
type="text"
|
|
|
|
|
placeholder={$i18n.t('Enter language codes')}
|
|
|
|
|
bind:value={youtubeLanguage}
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-11-27 14:09:33 +00:00
|
|
|
|
2025-02-26 23:56:45 +00:00
|
|
|
<div class=" mb-2.5 flex flex-col w-full justify-between">
|
|
|
|
|
<div class=" mb-1 text-xs font-medium">
|
|
|
|
|
{$i18n.t('Youtube Proxy URL')}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex items-center relative">
|
2024-11-27 14:09:33 +00:00
|
|
|
<input
|
2025-02-26 23:56:45 +00:00
|
|
|
class="flex-1 w-full rounded-lg text-sm bg-transparent outline-hidden"
|
2024-11-27 14:09:33 +00:00
|
|
|
type="text"
|
|
|
|
|
placeholder={$i18n.t('Enter proxy URL (e.g. https://user:password@host:port)')}
|
|
|
|
|
bind:value={youtubeProxyUrl}
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-09 09:28:52 +00:00
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex justify-end pt-3 text-sm font-medium">
|
|
|
|
|
<button
|
2024-10-21 07:05:27 +00:00
|
|
|
class="px-3.5 py-1.5 text-sm font-medium bg-black hover:bg-gray-900 text-white dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-full"
|
2024-06-09 09:28:52 +00:00
|
|
|
type="submit"
|
|
|
|
|
>
|
|
|
|
|
{$i18n.t('Save')}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|