fix: 数据库文档个数变为默认6个#1366 #1370

This commit is contained in:
Chen Tao 2025-02-11 10:05:34 +08:00 committed by GitHub
parent 0eead315d8
commit 5c2129c0c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,7 +9,7 @@ import { getModelUniqId } from '@renderer/services/ModelService'
import { KnowledgeBase } from '@renderer/types'
import { Alert, Form, Input, InputNumber, Modal, Select, Slider } from 'antd'
import { sortBy } from 'lodash'
import { useState } from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
interface ShowParams {
@ -35,6 +35,10 @@ const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
const { providers } = useProviders()
const { base, updateKnowledgeBase } = useKnowledge(_base.id)
useEffect(() => {
form.setFieldsValue({ documentCount: base?.documentCount || 6 })
}, [base, form])
if (!base) {
resolve(null)
return null
@ -118,7 +122,6 @@ const PopupContainer: React.FC<Props> = ({ base: _base, resolve }) => {
style={{ width: '100%' }}
min={1}
max={15}
defaultValue={base.documentCount || 6}
step={1}
marks={{ 1: '1', 6: t('knowledge.document_count_default'), 15: '15' }}
/>