feat: add advanced settings localization and improve existing translations
- Added "advanced_settings" key to English, Japanese, Russian, Chinese, and Traditional Chinese localization files for better user experience. - Corrected translations for "chunk_size" and "chunk_overlap" in Chinese and Traditional Chinese localization files to enhance clarity.
This commit is contained in:
parent
ae47d170ca
commit
cbb1173a3d
@ -235,7 +235,8 @@
|
|||||||
"you": "You",
|
"you": "You",
|
||||||
"copied": "Copied",
|
"copied": "Copied",
|
||||||
"confirm": "Confirm",
|
"confirm": "Confirm",
|
||||||
"more": "More"
|
"more": "More",
|
||||||
|
"advanced_settings": "Advanced Settings"
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
"title": "Docs"
|
"title": "Docs"
|
||||||
|
|||||||
@ -235,7 +235,8 @@
|
|||||||
"you": "あなた",
|
"you": "あなた",
|
||||||
"copied": "コピーされました",
|
"copied": "コピーされました",
|
||||||
"confirm": "確認",
|
"confirm": "確認",
|
||||||
"more": "もっと"
|
"more": "もっと",
|
||||||
|
"advanced_settings": "詳細設定"
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
"title": "ドキュメント"
|
"title": "ドキュメント"
|
||||||
|
|||||||
@ -233,9 +233,10 @@
|
|||||||
"topics": "Топики",
|
"topics": "Топики",
|
||||||
"warning": "Предупреждение",
|
"warning": "Предупреждение",
|
||||||
"you": "Вы",
|
"you": "Вы",
|
||||||
"confirm": "确认的翻译是: Подтверждение",
|
"confirm": "Подтверждение",
|
||||||
"copied": "Скопировано",
|
"copied": "Скопировано",
|
||||||
"more": "Ещё"
|
"more": "Ещё",
|
||||||
|
"advanced_settings": "Дополнительные настройки"
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
"title": "Документация"
|
"title": "Документация"
|
||||||
|
|||||||
@ -235,7 +235,8 @@
|
|||||||
"topics": "话题",
|
"topics": "话题",
|
||||||
"warning": "警告",
|
"warning": "警告",
|
||||||
"you": "用户",
|
"you": "用户",
|
||||||
"more": "更多"
|
"more": "更多",
|
||||||
|
"advanced_settings": "高级设置"
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
"title": "帮助文档"
|
"title": "帮助文档"
|
||||||
@ -324,9 +325,9 @@
|
|||||||
"delete_confirm": "确定要删除此知识库吗?",
|
"delete_confirm": "确定要删除此知识库吗?",
|
||||||
"directories": "目录",
|
"directories": "目录",
|
||||||
"directory_placeholder": "请输入目录路径",
|
"directory_placeholder": "请输入目录路径",
|
||||||
"document_count": "请求文档分段数量",
|
"document_count": "请求文档片段数量",
|
||||||
"document_count_default": "默认",
|
"document_count_default": "默认",
|
||||||
"document_count_help": "请求文档分段数量越多,附带的信息越多,但需要消耗的 Token 也越多",
|
"document_count_help": "请求文档片段数量越多,附带的信息越多,但需要消耗的 Token 也越多",
|
||||||
"drag_file": "拖拽文件到这里",
|
"drag_file": "拖拽文件到这里",
|
||||||
"edit_remark": "修改备注",
|
"edit_remark": "修改备注",
|
||||||
"edit_remark_placeholder": "请输入备注内容",
|
"edit_remark_placeholder": "请输入备注内容",
|
||||||
|
|||||||
@ -235,7 +235,8 @@
|
|||||||
"you": "您",
|
"you": "您",
|
||||||
"copied": "已複製",
|
"copied": "已複製",
|
||||||
"confirm": "確認",
|
"confirm": "確認",
|
||||||
"more": "更多"
|
"more": "更多",
|
||||||
|
"advanced_settings": "進階設定"
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
"title": "說明文件"
|
"title": "說明文件"
|
||||||
@ -324,9 +325,9 @@
|
|||||||
"delete_confirm": "確定要刪除此知識庫嗎?",
|
"delete_confirm": "確定要刪除此知識庫嗎?",
|
||||||
"directories": "目錄",
|
"directories": "目錄",
|
||||||
"directory_placeholder": "請輸入目錄路徑",
|
"directory_placeholder": "請輸入目錄路徑",
|
||||||
"document_count": "請求文件分段數量",
|
"document_count": "請求文件片段數量",
|
||||||
"document_count_default": "預設",
|
"document_count_default": "預設",
|
||||||
"document_count_help": "請求文件分段數量越多,附帶的資訊越多,但需要消耗的 Token 也越多",
|
"document_count_help": "請求文件片段數量越多,附帶的資訊越多,但需要消耗的 Token 也越多",
|
||||||
"drag_file": "拖拽檔案到這裡",
|
"drag_file": "拖拽檔案到這裡",
|
||||||
"edit_remark": "修改備註",
|
"edit_remark": "修改備註",
|
||||||
"edit_remark_placeholder": "請輸入備註內容",
|
"edit_remark_placeholder": "請輸入備註內容",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { WarningOutlined } from '@ant-design/icons'
|
import { DownOutlined, WarningOutlined } from '@ant-design/icons'
|
||||||
import { TopView } from '@renderer/components/TopView'
|
import { TopView } from '@renderer/components/TopView'
|
||||||
import { DEFAULT_KNOWLEDGE_DOCUMENT_COUNT } from '@renderer/config/constant'
|
import { DEFAULT_KNOWLEDGE_DOCUMENT_COUNT } from '@renderer/config/constant'
|
||||||
import { getEmbeddingMaxContext } from '@renderer/config/embedings'
|
import { getEmbeddingMaxContext } from '@renderer/config/embedings'
|
||||||
@ -11,6 +11,7 @@ import { Alert, Form, Input, InputNumber, Modal, Select, Slider } from 'antd'
|
|||||||
import { sortBy } from 'lodash'
|
import { sortBy } from 'lodash'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import styled from 'styled-components'
|
||||||
|
|
||||||
interface ShowParams {
|
interface ShowParams {
|
||||||
base: KnowledgeBase
|
base: KnowledgeBase
|
||||||
@ -33,6 +34,7 @@ interface Props extends ShowParams {
|
|||||||
|
|
||||||
const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
|
const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
|
||||||
const [open, setOpen] = useState(true)
|
const [open, setOpen] = useState(true)
|
||||||
|
const [showAdvanced, setShowAdvanced] = useState(false)
|
||||||
const [form] = Form.useForm<FormData>()
|
const [form] = Form.useForm<FormData>()
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { providers } = useProviders()
|
const { providers } = useProviders()
|
||||||
@ -118,7 +120,7 @@ const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
|
|||||||
destroyOnClose
|
destroyOnClose
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
centered>
|
centered>
|
||||||
<Form form={form} layout="vertical">
|
<Form form={form} layout="vertical" className="compact-form">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="name"
|
name="name"
|
||||||
label={t('common.name')}
|
label={t('common.name')}
|
||||||
@ -163,9 +165,22 @@ const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
|
|||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
<AdvancedSettingsButton onClick={() => setShowAdvanced(!showAdvanced)}>
|
||||||
|
<DownOutlined
|
||||||
|
style={{
|
||||||
|
transform: showAdvanced ? 'rotate(180deg)' : 'rotate(0deg)',
|
||||||
|
transition: 'transform 0.3s',
|
||||||
|
marginRight: 8
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{t('common.advanced_settings')}
|
||||||
|
</AdvancedSettingsButton>
|
||||||
|
|
||||||
|
<div style={{ display: showAdvanced ? 'block' : 'none' }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="chunkSize"
|
name="chunkSize"
|
||||||
label={t('knowledge.chunk_size')}
|
label={t('knowledge.chunk_size')}
|
||||||
|
layout="horizontal"
|
||||||
tooltip={{ title: t('knowledge.chunk_size_tooltip') }}
|
tooltip={{ title: t('knowledge.chunk_size_tooltip') }}
|
||||||
initialValue={base.chunkSize}
|
initialValue={base.chunkSize}
|
||||||
rules={[
|
rules={[
|
||||||
@ -186,10 +201,10 @@ const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
|
|||||||
placeholder={t('knowledge.chunk_size_placeholder')}
|
placeholder={t('knowledge.chunk_size_placeholder')}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="chunkOverlap"
|
name="chunkOverlap"
|
||||||
label={t('knowledge.chunk_overlap')}
|
label={t('knowledge.chunk_overlap')}
|
||||||
|
layout="horizontal"
|
||||||
initialValue={base.chunkOverlap}
|
initialValue={base.chunkOverlap}
|
||||||
tooltip={{ title: t('knowledge.chunk_overlap_tooltip') }}
|
tooltip={{ title: t('knowledge.chunk_overlap_tooltip') }}
|
||||||
rules={[
|
rules={[
|
||||||
@ -210,9 +225,11 @@ const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
|
|||||||
placeholder={t('knowledge.chunk_overlap_placeholder')}
|
placeholder={t('knowledge.chunk_overlap_placeholder')}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="threshold"
|
name="threshold"
|
||||||
label={t('knowledge.threshold')}
|
label={t('knowledge.threshold')}
|
||||||
|
layout="horizontal"
|
||||||
tooltip={{ title: t('knowledge.threshold_tooltip') }}
|
tooltip={{ title: t('knowledge.threshold_tooltip') }}
|
||||||
initialValue={base.threshold}
|
initialValue={base.threshold}
|
||||||
rules={[
|
rules={[
|
||||||
@ -227,9 +244,11 @@ const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
|
|||||||
]}>
|
]}>
|
||||||
<InputNumber placeholder={t('knowledge.threshold_placeholder')} step={0.1} style={{ width: '100%' }} />
|
<InputNumber placeholder={t('knowledge.threshold_placeholder')} step={0.1} style={{ width: '100%' }} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="topN"
|
name="topN"
|
||||||
label={t('knowledge.topN')}
|
label={t('knowledge.topN')}
|
||||||
|
layout="horizontal"
|
||||||
initialValue={base.topN}
|
initialValue={base.topN}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
@ -243,14 +262,29 @@ const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
|
|||||||
]}>
|
]}>
|
||||||
<InputNumber placeholder={t('knowledge.topN_placeholder')} style={{ width: '100%' }} />
|
<InputNumber placeholder={t('knowledge.topN_placeholder')} style={{ width: '100%' }} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Alert
|
||||||
|
message={t('knowledge.chunk_size_change_warning')}
|
||||||
|
type="warning"
|
||||||
|
showIcon
|
||||||
|
icon={<WarningOutlined />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
<Alert message={t('knowledge.chunk_size_change_warning')} type="warning" showIcon icon={<WarningOutlined />} />
|
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const TopViewKey = 'KnowledgeSettingsPopup'
|
const TopViewKey = 'KnowledgeSettingsPopup'
|
||||||
|
|
||||||
|
const AdvancedSettingsButton = styled.div`
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
margin-top: -10px;
|
||||||
|
color: var(--color-primary);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
`
|
||||||
|
|
||||||
export default class KnowledgeSettingsPopup {
|
export default class KnowledgeSettingsPopup {
|
||||||
static hide() {
|
static hide() {
|
||||||
TopView.hide(TopViewKey)
|
TopView.hide(TopViewKey)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user