fix: update websearch i18n, allow more search results (#7797)

This commit is contained in:
one 2025-07-04 23:50:42 +08:00 committed by GitHub
parent e5d94d9a53
commit 2a48babd50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 22 additions and 19 deletions

View File

@ -1896,7 +1896,7 @@
"search_max_result": "Number of search results",
"search_provider": "Search service provider",
"search_provider_placeholder": "Choose a search service provider.",
"search_result_default": "Default",
"search_max_result.tooltip": "When search result compression is disabled, the number of results may be too large, which may lead to insufficient tokens",
"search_with_time": "Search with dates included",
"tavily": {
"api_key": "Tavily API Key",
@ -1931,7 +1931,6 @@
"cutoff.unit.token": "Token",
"method.rag": "RAG",
"rag.document_count": "Document Count",
"rag.document_count.default": "Default",
"rag.document_count.tooltip": "Expected number of documents to extract from each search result, the actual total number of extracted documents is this value multiplied by the number of search results.",
"rag.embedding_dimensions.auto_get": "Auto Get Dimensions",
"rag.embedding_dimensions.placeholder": "Leave empty",

View File

@ -1851,7 +1851,7 @@
"search_max_result": "検索結果の数",
"search_provider": "検索サービスプロバイダー",
"search_provider_placeholder": "検索サービスプロバイダーを選択する",
"search_result_default": "デフォルト",
"search_max_result.tooltip": "検索結果の圧縮が無効な場合、結果の数が多すぎるとトークンが不足する可能性があります",
"search_with_time": "日付を含む検索",
"tavily": {
"api_key": "Tavily API キー",
@ -1886,7 +1886,6 @@
"cutoff.unit.token": "トークン",
"method.rag": "RAG",
"rag.document_count": "文書数",
"rag.document_count.default": "デフォルト",
"rag.document_count.tooltip": "単一の検索結果から抽出する文書数。実際に抽出される文書数は、この値に検索結果数を乗じたものです。",
"rag.embedding_dimensions.auto_get": "次元を自動取得",
"rag.embedding_dimensions.placeholder": "次元を設定しない",

View File

@ -1849,9 +1849,9 @@
"get_api_key": "Получить ключ API",
"no_provider_selected": "Пожалуйста, выберите поставщика поисковых услуг, затем проверьте.",
"search_max_result": "Количество результатов поиска",
"search_max_result.tooltip": "При отключенном сжатии результатов поиска, количество результатов может быть слишком большим, что приведет к исчерпанию токенов",
"search_provider": "поиск сервисного провайдера",
"search_provider_placeholder": "Выберите поставщика поисковых услуг",
"search_result_default": "По умолчанию",
"search_with_time": "Поиск, содержащий дату",
"tavily": {
"api_key": "Ключ API Tavily",
@ -1886,7 +1886,6 @@
"cutoff.unit.token": "Токены",
"method.rag": "RAG",
"rag.document_count": "Количество документов",
"rag.document_count.default": "По умолчанию",
"rag.document_count.tooltip": "Ожидаемое количество документов, которые будут извлечены из каждого результата поиска. Фактическое количество извлеченных документов равно этому значению, умноженному на количество результатов поиска.",
"rag.embedding_dimensions.auto_get": "Автоматически получить размерности",
"rag.embedding_dimensions.placeholder": "Не устанавливать размерности",

View File

@ -1941,6 +1941,7 @@
"get_api_key": "点击这里获取密钥",
"no_provider_selected": "请选择搜索服务商后再检测",
"search_max_result": "搜索结果个数",
"search_max_result.tooltip": "未开启搜索结果压缩的情况下,数量过大可能会消耗过多 tokens",
"search_provider": "搜索服务商",
"search_provider_placeholder": "选择一个搜索服务商",
"subscribe": "黑名单订阅",
@ -1951,7 +1952,6 @@
"subscribe_name.placeholder": "当下载的订阅源没有名称时所使用的替代名称",
"subscribe_add_success": "订阅源添加成功!",
"subscribe_delete": "删除订阅源",
"search_result_default": "默认",
"search_with_time": "搜索包含日期",
"tavily": {
"api_key": "Tavily API 密钥",
@ -1976,7 +1976,6 @@
"cutoff.unit.token": "Token",
"method.rag": "RAG",
"rag.document_count": "文档数量",
"rag.document_count.default": "默认",
"rag.document_count.tooltip": "预期从单个搜索结果中提取的文档数量,实际提取的总数量是这个值乘以搜索结果数量。",
"rag.embedding_dimensions.auto_get": "自动获取维度",
"rag.embedding_dimensions.placeholder": "不设置维度",

View File

@ -1852,9 +1852,9 @@
"get_api_key": "點選這裡取得金鑰",
"no_provider_selected": "請選擇搜尋服務商後再檢查",
"search_max_result": "搜尋結果個數",
"search_max_result.tooltip": "未開啟搜尋結果壓縮的情況下,數量過大可能會消耗過多 tokens",
"search_provider": "搜尋服務商",
"search_provider_placeholder": "選擇一個搜尋服務商",
"search_result_default": "預設",
"search_with_time": "搜尋包含日期",
"tavily": {
"api_key": "Tavily API 金鑰",
@ -1889,7 +1889,6 @@
"cutoff.unit.token": "Token",
"method.rag": "RAG",
"rag.document_count": "文檔數量",
"rag.document_count.default": "預設",
"rag.document_count.tooltip": "預期從單個搜尋結果中提取的文檔數量,實際提取的總數量是這個值乘以搜尋結果數量。",
"rag.embedding_dimensions.auto_get": "自動獲取維度",
"rag.embedding_dimensions.placeholder": "不設置維度",

View File

@ -252,7 +252,7 @@ const GithubCopilotSettings: FC<GithubCopilotSettingsProps> = ({ provider: initi
min={1}
max={60}
step={1}
marks={{ 1: '1', 10: t('settings.tool.websearch.search_result_default'), 60: '60' }}
marks={{ 1: '1', 10: t('common.default'), 60: '60' }}
onChangeComplete={(value) => updateProvider({ ...provider, rateLimit: value })}
/>
</SettingRow>

View File

@ -2,8 +2,9 @@ import { useTheme } from '@renderer/context/ThemeProvider'
import { useWebSearchSettings } from '@renderer/hooks/useWebSearchProviders'
import { useAppDispatch } from '@renderer/store'
import { setMaxResult, setSearchWithTime } from '@renderer/store/websearch'
import { Slider, Switch } from 'antd'
import { Slider, Switch, Tooltip } from 'antd'
import { t } from 'i18next'
import { Info } from 'lucide-react'
import { FC } from 'react'
import { SettingDivider, SettingGroup, SettingRow, SettingRowTitle, SettingTitle } from '../..'
@ -25,14 +26,21 @@ const BasicSettings: FC = () => {
</SettingRow>
<SettingDivider style={{ marginTop: 15, marginBottom: 10 }} />
<SettingRow style={{ height: 40 }}>
<SettingRowTitle style={{ minWidth: 120 }}>{t('settings.tool.websearch.search_max_result')}</SettingRowTitle>
<SettingRowTitle style={{ minWidth: 120 }}>
{t('settings.tool.websearch.search_max_result')}
{maxResults > 20 && (
<Tooltip title={t('settings.tool.websearch.search_max_result.tooltip')} placement="top">
<Info size={16} color="var(--color-icon)" style={{ marginLeft: 5, cursor: 'pointer' }} />
</Tooltip>
)}
</SettingRowTitle>
<Slider
defaultValue={maxResults}
style={{ width: '100%' }}
min={1}
max={50}
max={100}
step={1}
marks={{ 1: '1', 5: t('settings.tool.websearch.search_result_default'), 20: '20', 50: '50' }}
marks={{ 1: '1', 5: '5', 20: '20', 50: '50', 100: '100' }}
onChangeComplete={(value) => dispatch(setMaxResult(value))}
/>
</SettingRow>

View File

@ -138,7 +138,7 @@ const RagSettings = () => {
<SettingRow>
<SettingRowTitle>
{t('models.embedding_dimensions')}
<Tooltip title={t('settings.websearch.compression.rag.embedding_dimensions.tooltip')}>
<Tooltip title={t('settings.tool.websearch.compression.rag.embedding_dimensions.tooltip')}>
<Info size={16} color="var(--color-icon)" style={{ marginLeft: 5, cursor: 'pointer' }} />
</Tooltip>
</SettingRowTitle>
@ -179,7 +179,7 @@ const RagSettings = () => {
<SettingRow>
<SettingRowTitle>
{t('settings.tool.websearch.compression.rag.document_count')}
<Tooltip title={t('settings.tool.websearch.compression.rag.document_count.tooltip')} placement="right">
<Tooltip title={t('settings.tool.websearch.compression.rag.document_count.tooltip')} placement="top">
<Info size={16} color="var(--color-icon)" style={{ marginLeft: 5, cursor: 'pointer' }} />
</Tooltip>
</SettingRowTitle>
@ -191,7 +191,7 @@ const RagSettings = () => {
step={1}
onChange={handleDocumentCountChange}
marks={{
1: t('settings.tool.websearch.compression.rag.document_count.default'),
1: t('common.default'),
3: '3',
10: '10'
}}

View File

@ -510,7 +510,7 @@ class WebSearchService {
window.message.error({
key: 'websearch-rag-failed',
duration: 10,
content: `${i18n.t('settings.websearch.compression.error.rag_failed')}: ${formatErrorMessage(error)}`
content: `${i18n.t('settings.tool.websearch.compression.error.rag_failed')}: ${formatErrorMessage(error)}`
})
finalResults = []