feat: search engine adds proxy addresses and adds SSRF verification.
This commit is contained in:
@@ -10,6 +10,7 @@ export interface WebSearchProviderEntity {
|
||||
parameters: {
|
||||
api_key?: string
|
||||
engine_id?: string
|
||||
proxy_url?: string
|
||||
extra_config?: Record<string, string>
|
||||
}
|
||||
is_default?: boolean
|
||||
@@ -23,6 +24,7 @@ export interface WebSearchProviderTypeInfo {
|
||||
name: string
|
||||
requires_api_key: boolean
|
||||
requires_engine_id?: boolean
|
||||
supports_proxy?: boolean
|
||||
description?: string
|
||||
docs_url?: string
|
||||
}
|
||||
|
||||
@@ -776,6 +776,9 @@ export default {
|
||||
providerLabel: 'Search Provider',
|
||||
providerDescription: 'Choose the search engine service used for web search',
|
||||
providerPlaceholder: 'Select a search engine...',
|
||||
proxyUrlLabel: 'HTTP proxy',
|
||||
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',
|
||||
apiKeyDescription: 'Enter the API key for the selected search provider',
|
||||
apiKeyPlaceholder: 'Enter API key',
|
||||
|
||||
@@ -636,6 +636,9 @@ export default {
|
||||
providerLabel: "검색 엔진 프로바이더",
|
||||
providerDescription: "웹 검색에 사용할 검색 엔진 서비스 선택",
|
||||
providerPlaceholder: "검색 엔진 선택...",
|
||||
proxyUrlLabel: "HTTP 프록시",
|
||||
proxyUrlPlaceholder: "예: http://127.0.0.1:7890 (선택 사항)",
|
||||
proxyUrlHelp: "검색 API 접근에 프록시가 필요한 경우 입력합니다. 비우면 HTTP_PROXY/HTTPS_PROXY를 사용합니다.",
|
||||
apiKeyLabel: "API 키",
|
||||
apiKeyDescription: "선택한 검색 엔진의 API 키 입력",
|
||||
apiKeyPlaceholder: "API 키를 입력하세요",
|
||||
|
||||
@@ -754,6 +754,9 @@ export default {
|
||||
providerLabel: 'Провайдер поиска',
|
||||
providerDescription: 'Выберите поисковый сервис, используемый для веб-поиска',
|
||||
providerPlaceholder: 'Выберите поисковую систему...',
|
||||
proxyUrlLabel: 'HTTP-прокси',
|
||||
proxyUrlPlaceholder: 'Напр. http://127.0.0.1:7890 (необязательно)',
|
||||
proxyUrlHelp: 'Укажите, если доступ к API поиска нужен через прокси; иначе используются переменные HTTP_PROXY/HTTPS_PROXY.',
|
||||
apiKeyLabel: 'API-ключ',
|
||||
apiKeyDescription: 'Введите API-ключ выбранного провайдера поиска',
|
||||
apiKeyPlaceholder: 'Введите API-ключ',
|
||||
|
||||
@@ -636,6 +636,9 @@ export default {
|
||||
providerLabel: "搜索引擎提供商",
|
||||
providerDescription: "选择用于网络搜索的搜索引擎服务",
|
||||
providerPlaceholder: "选择搜索引擎...",
|
||||
proxyUrlLabel: "HTTP 代理",
|
||||
proxyUrlPlaceholder: "例如 http://proxy.example.com:3128(可选,仅支持 http/https)",
|
||||
proxyUrlHelp: "若环境访问搜索 API 需代理,在此填写;留空则使用系统环境变量 HTTP(S)_PROXY。",
|
||||
apiKeyLabel: "API 密钥",
|
||||
apiKeyDescription: "输入所选搜索引擎的 API 密钥",
|
||||
apiKeyPlaceholder: "请输入 API 密钥",
|
||||
|
||||
@@ -99,6 +99,16 @@
|
||||
</t-form-item>
|
||||
</template>
|
||||
|
||||
<t-form-item v-if="selectedProviderType?.supports_proxy" :label="t('webSearchSettings.proxyUrlLabel')" name="parameters.proxy_url">
|
||||
<t-input
|
||||
v-model="providerForm.parameters.proxy_url"
|
||||
:placeholder="t('webSearchSettings.proxyUrlPlaceholder')"
|
||||
/>
|
||||
<template #help>
|
||||
<span class="switch-help">{{ t('webSearchSettings.proxyUrlHelp') }}</span>
|
||||
</template>
|
||||
</t-form-item>
|
||||
|
||||
<div class="form-divider"></div>
|
||||
|
||||
<t-form-item :label="t('webSearchSettings.setAsDefault')" name="is_default">
|
||||
@@ -164,7 +174,7 @@ const providerForm = ref<{
|
||||
name: string
|
||||
provider: string
|
||||
description: string
|
||||
parameters: { api_key?: string; engine_id?: string }
|
||||
parameters: { api_key?: string; engine_id?: string; proxy_url?: string }
|
||||
is_default: boolean
|
||||
}>({
|
||||
name: '',
|
||||
@@ -228,6 +238,7 @@ const editProvider = (entity: WebSearchProviderEntity) => {
|
||||
parameters: {
|
||||
api_key: '',
|
||||
engine_id: entity.parameters?.engine_id || '',
|
||||
proxy_url: entity.parameters?.proxy_url || '',
|
||||
},
|
||||
is_default: entity.is_default || false,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user