fix(web): knowledge config

This commit is contained in:
zhaoying
2026-04-21 13:35:21 +08:00
parent ba3743f9f1
commit 83b7c6870d
2 changed files with 4 additions and 3 deletions

View File

@@ -29,12 +29,13 @@ const Knowledge: FC<{value?: KnowledgeConfig; onChange?: (config: KnowledgeConfi
if (value && JSON.stringify(value) !== JSON.stringify(editConfig)) {
setEditConfig({ ...(value || {}) })
const knowledge_bases = [...(value.knowledge_bases || [])]
setKnowledgeList(knowledge_bases)
// 检查是否有knowledge_bases缺少name字段
const basesWithoutName = knowledge_bases.filter(base => !base.name)
if (basesWithoutName.length > 0) {
// 调用接口获取完整的知识库信息
getKnowledgeBaseList().then(res => {
getKnowledgeBaseList(undefined, { kb_ids: basesWithoutName.map(vo => vo.kb_id).join(',') }).then(res => {
const fullBases = knowledge_bases.map(base => {
if (!base.name) {
const fullBase = res.items.find((item: any) => item.id === base.kb_id)