fix(web-search): polish Keenable provider integration after #1946
Expose optional API key in settings UI, map longer API snippets into Content for RAG, align maxResults fallback with other providers, sync Swagger enum, and add follow-up unit tests.
This commit is contained in:
@@ -29,6 +29,8 @@ export interface WebSearchProviderTypeInfo {
|
||||
id: string
|
||||
name: string
|
||||
requires_api_key: boolean
|
||||
// Keyless-by-default providers that still accept an optional key (e.g. Keenable).
|
||||
supports_optional_api_key?: boolean
|
||||
requires_engine_id?: boolean
|
||||
requires_base_url?: boolean
|
||||
supports_proxy?: boolean
|
||||
|
||||
@@ -1476,6 +1476,7 @@ export default {
|
||||
proxyUrlPlaceholder: 'e.g. http://proxy.example.com:3128 (optional; http/https only)',
|
||||
proxyUrlHelp: 'Use when outbound access to the search API requires a proxy; leave empty to rely on HTTP_PROXY/HTTPS_PROXY environment variables.',
|
||||
apiKeyLabel: 'API Key',
|
||||
apiKeyOptionalLabel: 'API Key (optional)',
|
||||
baseUrlLabel: 'Instance URL',
|
||||
baseUrlPlaceholder: 'https://searxng.example.com',
|
||||
apiKeyDescription: 'Enter the API key for the selected search provider',
|
||||
|
||||
@@ -1324,6 +1324,7 @@ export default {
|
||||
proxyUrlPlaceholder: "예: http://127.0.0.1:7890 (선택 사항)",
|
||||
proxyUrlHelp: "검색 API 접근에 프록시가 필요한 경우 입력합니다. 비우면 HTTP_PROXY/HTTPS_PROXY를 사용합니다.",
|
||||
apiKeyLabel: "API 키",
|
||||
apiKeyOptionalLabel: "API 키 (선택 사항)",
|
||||
baseUrlLabel: "인스턴스 URL",
|
||||
baseUrlPlaceholder: "https://searxng.example.com",
|
||||
apiKeyDescription: "선택한 검색 엔진의 API 키 입력",
|
||||
|
||||
@@ -1383,6 +1383,7 @@ export default {
|
||||
proxyUrlPlaceholder: 'Напр. http://127.0.0.1:7890 (необязательно)',
|
||||
proxyUrlHelp: 'Укажите, если доступ к API поиска нужен через прокси; иначе используются переменные HTTP_PROXY/HTTPS_PROXY.',
|
||||
apiKeyLabel: 'API-ключ',
|
||||
apiKeyOptionalLabel: 'API-ключ (необязательно)',
|
||||
baseUrlLabel: 'URL экземпляра',
|
||||
baseUrlPlaceholder: 'https://searxng.example.com',
|
||||
apiKeyDescription: 'Введите API-ключ выбранного провайдера поиска',
|
||||
|
||||
@@ -1334,6 +1334,7 @@ export default {
|
||||
proxyUrlPlaceholder: "例如 http://proxy.example.com:3128(可选,仅支持 http/https)",
|
||||
proxyUrlHelp: "若环境访问搜索 API 需代理,在此填写;留空则使用系统环境变量 HTTP(S)_PROXY。",
|
||||
apiKeyLabel: "API 密钥",
|
||||
apiKeyOptionalLabel: "API 密钥(可选)",
|
||||
baseUrlLabel: "实例地址",
|
||||
baseUrlPlaceholder: "https://searxng.example.com",
|
||||
apiKeyDescription: "输入所选搜索引擎的 API 密钥",
|
||||
|
||||
@@ -206,7 +206,7 @@
|
||||
|
||||
<!-- Section 2 — 连接配置(base url / api key / engine id),仅当任意字段需要时渲染 -->
|
||||
<section
|
||||
v-if="selectedProviderType?.requires_api_key || selectedProviderType?.requires_engine_id || selectedProviderType?.requires_base_url"
|
||||
v-if="selectedProviderType?.requires_api_key || selectedProviderType?.supports_optional_api_key || selectedProviderType?.requires_engine_id || selectedProviderType?.requires_base_url"
|
||||
class="setting-drawer__section"
|
||||
>
|
||||
<h4 class="setting-drawer__section-title">{{ t('webSearchSettings.credentialsSection', '连接配置') }}</h4>
|
||||
@@ -224,8 +224,12 @@
|
||||
子资源调用),不与本表单 submit 耦合;Create 模式下用 plain
|
||||
password input + lock prefix-icon,与 ModelEditorDialog 一致。
|
||||
-->
|
||||
<div v-if="selectedProviderType?.requires_api_key" class="form-item">
|
||||
<label class="form-label required">{{ t('webSearchSettings.apiKeyLabel') }}</label>
|
||||
<div v-if="selectedProviderType?.requires_api_key || selectedProviderType?.supports_optional_api_key" class="form-item">
|
||||
<label class="form-label" :class="{ required: selectedProviderType?.requires_api_key }">
|
||||
{{ selectedProviderType?.supports_optional_api_key && !selectedProviderType?.requires_api_key
|
||||
? t('webSearchSettings.apiKeyOptionalLabel', 'API Key(可选)')
|
||||
: t('webSearchSettings.apiKeyLabel') }}
|
||||
</label>
|
||||
<CredentialResource
|
||||
v-if="editingProvider?.id"
|
||||
:api="credentialApi"
|
||||
@@ -847,6 +851,10 @@ onMounted(async () => {
|
||||
background: rgba(70, 70, 70, 0.12);
|
||||
color: #464646;
|
||||
}
|
||||
.provider-card--keenable .provider-card__badge {
|
||||
background: rgba(20, 158, 130, 0.12);
|
||||
color: #149E82;
|
||||
}
|
||||
|
||||
.provider-card__body {
|
||||
flex: 1;
|
||||
@@ -1121,4 +1129,8 @@ onMounted(async () => {
|
||||
background: rgba(70, 70, 70, 0.12);
|
||||
color: #464646;
|
||||
}
|
||||
.websearch-drawer--keenable .setting-drawer__header-icon {
|
||||
background: rgba(20, 158, 130, 0.12);
|
||||
color: #149E82;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user