fix(kb): kb-level deletion should reflect in doc level kb tags sidebar registry (#944)

This commit is contained in:
Waleed Latif
2025-08-12 09:26:28 -07:00
committed by GitHub
parent 1c3e923f1b
commit a2dea384a4

View File

@@ -89,13 +89,12 @@ export function KnowledgeTags({ knowledgeBaseId, documentId }: KnowledgeTagsProp
const definition = definitions.find((def) => def.tagSlot === slot)
const currentTag = currentTags?.find((tag) => tag.slot === slot)
// Only include tag if the document actually has a value for it
if (value?.trim()) {
// Only include tag if the document has a value AND a corresponding KB tag definition exists
if (value?.trim() && definition) {
tags.push({
slot,
// Preserve existing displayName if definition is not found yet
displayName: definition?.displayName || currentTag?.displayName || '',
fieldType: definition?.fieldType || currentTag?.fieldType || 'text',
displayName: definition.displayName,
fieldType: definition.fieldType,
value: value.trim(),
})
}