feat: Implement manual knowledge editing and enhance knowledge base features

- Added functionality for manual knowledge entry, allowing users to create and edit Markdown content directly in the browser.
- Introduced new API endpoints for creating and updating manual knowledge entries.
- Enhanced UI components to support the new manual knowledge editor, including integration with existing knowledge base features.
- Updated knowledge retrieval logic to accommodate manual entries, ensuring seamless user experience across knowledge types.
- Improved agent configuration to support custom system prompts, enhancing flexibility in agent responses.
This commit is contained in:
wizardchen
2025-11-12 21:27:56 +08:00
parent a342a0aa14
commit 69f3f30d83
36 changed files with 3495 additions and 412 deletions
+48 -1
View File
@@ -8,7 +8,15 @@ export const useUIStore = defineStore('ui', {
currentKBId: null as string | null,
kbEditorInitialSection: null as string | null,
settingsInitialSection: null as string | null,
settingsInitialSubSection: null as string | null
settingsInitialSubSection: null as string | null,
manualEditorVisible: false,
manualEditorMode: 'create' as 'create' | 'edit',
manualEditorKBId: null as string | null,
manualEditorKnowledgeId: null as string | null,
manualEditorInitialTitle: '',
manualEditorInitialContent: '',
manualEditorInitialStatus: 'draft' as 'draft' | 'publish',
manualEditorOnSuccess: null as null | ((payload: { kbId: string; knowledgeId: string; status: 'draft' | 'publish' }) => void)
}),
actions: {
@@ -50,6 +58,45 @@ export const useUIStore = defineStore('ui', {
this.showKBEditorModal = false
this.currentKBId = null
this.kbEditorInitialSection = null
},
openManualEditor(options: {
mode?: 'create' | 'edit'
kbId?: string | null
knowledgeId?: string | null
title?: string
content?: string
status?: 'draft' | 'publish'
onSuccess?: (payload: { kbId: string; knowledgeId: string; status: 'draft' | 'publish' }) => void
} = {}) {
this.manualEditorMode = options.mode || 'create'
this.manualEditorKBId = options.kbId ?? null
this.manualEditorKnowledgeId = options.knowledgeId ?? null
this.manualEditorInitialTitle = options.title || ''
this.manualEditorInitialContent = options.content || ''
this.manualEditorInitialStatus = options.status || 'draft'
this.manualEditorOnSuccess = options.onSuccess || null
this.manualEditorVisible = true
},
closeManualEditor() {
this.manualEditorVisible = false
this.manualEditorKnowledgeId = null
this.manualEditorInitialContent = ''
this.manualEditorInitialTitle = ''
this.manualEditorInitialStatus = 'draft'
this.manualEditorOnSuccess = null
},
notifyManualEditorSuccess(payload: { kbId: string; knowledgeId: string; status: 'draft' | 'publish' }) {
if (typeof this.manualEditorOnSuccess === 'function') {
try {
this.manualEditorOnSuccess(payload)
} catch (err) {
console.error('Manual editor success callback error:', err)
}
}
this.manualEditorOnSuccess = null
}
}
})