feat: support custon endpint for Firecrawl

This commit is contained in:
AnotiaWang
2025-02-18 14:36:59 +08:00
parent f593546864
commit daf65889b3
5 changed files with 58 additions and 11 deletions

View File

@ -11,6 +11,7 @@
const {
config,
aiApiBase,
webSearchApiBase,
showConfigManager: showModal,
} = storeToRefs(useConfigStore())
const { t } = useI18n()
@ -66,6 +67,7 @@
// Only kept for easy reference in i18n Ally
_help: t('settings.webSearch.providers.firecrawl.help'),
link: 'https://www.firecrawl.dev/app/api-keys',
supportsCustomApiBase: true,
},
])
const selectedAiProvider = computed(() =>
@ -121,6 +123,7 @@
config.value.ai.model = model
}
// Automatically fetch AI models list
watch(
() => [
config.value.ai.provider,
@ -134,6 +137,24 @@
},
{ immediate: true },
)
// Reset AI config when provider changed
watch(
() => config.value.ai.provider,
() => {
config.value.ai.apiKey = ''
config.value.ai.apiBase = ''
config.value.ai.model = ''
config.value.ai.contextSize = undefined
},
)
// Reset web search config when provider changed
watch(
() => config.value.webSearch.provider,
() => {
config.value.webSearch.apiKey = ''
config.value.webSearch.apiBase = ''
},
)
defineExpose({
show() {
@ -250,17 +271,30 @@
</template>
<USelect
v-model="config.webSearch.provider"
class="w-auto"
class="w-30"
:items="webSearchProviderOptions"
/>
</UFormField>
<UFormField :label="$t('settings.webSearch.apiKey')" required>
<UFormField
:label="$t('settings.webSearch.apiKey')"
:required="!config.webSearch.apiBase"
>
<PasswordInput
v-model="config.webSearch.apiKey"
class="w-full"
:placeholder="$t('settings.webSearch.apiKey')"
/>
</UFormField>
<UFormField
v-if="selectedWebSearchProvider?.supportsCustomApiBase"
:label="$t('settings.webSearch.apiBase')"
>
<UInput
v-model="config.webSearch.apiBase"
class="w-full"
:placeholder="webSearchApiBase"
/>
</UFormField>
<UFormField :label="$t('settings.webSearch.queryLanguage')">
<template #help>
<i18n-t