feat: Allow admin editing external search/loader settings

This commit is contained in:
tth37
2025-04-14 18:19:26 +08:00
parent 008fec80c1
commit 85f8e91288
2 changed files with 88 additions and 2 deletions

View File

@@ -30,9 +30,10 @@
'bing',
'exa',
'perplexity',
'sougou'
'sougou',
'external'
];
let webLoaderEngines = ['playwright', 'firecrawl', 'tavily'];
let webLoaderEngines = ['playwright', 'firecrawl', 'tavily', 'external'];
let webConfig = null;
@@ -431,6 +432,36 @@
/>
</div>
</div>
{:else if webConfig.WEB_SEARCH_ENGINE === 'external'}
<div>
<div class=" self-center text-xs font-medium mb-1">
{$i18n.t('External Web Search URL')}
</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 External Web Search URL')}
bind:value={webConfig.EXTERNAL_WEB_SEARCH_URL}
autocomplete="off"
/>
</div>
</div>
</div>
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs font-medium mb-1">
{$i18n.t('External Web Search API Key')}
</div>
<SensitiveInput
placeholder={$i18n.t('Enter External Web Search API Key')}
bind:value={webConfig.EXTERNAL_WEB_SEARCH_API_KEY}
/>
</div>
</div>
{/if}
{/if}
@@ -652,6 +683,37 @@
</div>
{/if}
</div>
{:else if webConfig.WEB_LOADER_ENGINE === 'external'}
<div class="mb-2.5 flex w-full flex-col">
<div>
<div class=" self-center text-xs font-medium mb-1">
{$i18n.t('External Web Loader URL')}
</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 External Web Loader URL')}
bind:value={webConfig.EXTERNAL_WEB_LOADER_URL}
autocomplete="off"
/>
</div>
</div>
</div>
<div class="mt-2">
<div class=" self-center text-xs font-medium mb-1">
{$i18n.t('External Web Loader API Key')}
</div>
<SensitiveInput
placeholder={$i18n.t('Enter External Web Loader API Key')}
bind:value={webConfig.EXTERNAL_WEB_LOADER_API_KEY}
/>
</div>
</div>
{/if}
<div class=" mb-2.5 flex w-full justify-between">