feat(knowledge): Add tag_id support for knowledge creation and file uploads

- Introduced tag_id parameter in various knowledge-related API functions to allow categorization of knowledge entries.
- Updated frontend components to handle tag_id during knowledge creation and file uploads.
- Enhanced UI store to manage the selected tag ID for better user experience in categorizing knowledge.
This commit is contained in:
Xia Dong
2026-01-14 18:51:12 +08:00
committed by begoniezhao
parent 6c90480e82
commit cec722aa43
10 changed files with 178 additions and 124 deletions
@@ -579,7 +579,7 @@ const handleSave = async (targetStatus: ManualStatus) => {
saving.value = true
savingAction.value = targetStatus
try {
const payload = {
const payload: { title: string; content: string; status: string; tag_id?: string } = {
title: form.title.trim(),
content: form.content,
status: targetStatus,
@@ -591,6 +591,11 @@ const handleSave = async (targetStatus: ManualStatus) => {
if (mode.value === 'edit' && knowledgeId.value) {
response = await updateManualKnowledge(knowledgeId.value, payload)
} else {
// 创建新知识时,从 store 获取当前选中的分类ID
const tagIdToUpload = uiStore.selectedTagId !== '__untagged__' ? uiStore.selectedTagId : undefined
if (tagIdToUpload) {
payload.tag_id = tagIdToUpload
}
response = await createManualKnowledge(form.kbId, payload)
knowledgeID = response?.data?.id || knowledgeID
kbId = form.kbId