feat: Implement FAQ functionality in Knowledge Base

- Added support for creating and managing FAQ knowledge bases, including new API endpoints for listing, upserting, updating, and deleting FAQ entries.
- Enhanced the frontend to allow users to create FAQ knowledge bases and manage FAQ entries with a dedicated interface.
- Introduced new types and configurations for FAQ handling in the backend, ensuring proper indexing and retrieval of FAQ entries.
- Updated localization files to include new strings related to FAQ management in multiple languages.
- Refactored existing components to accommodate the new FAQ features, improving user experience and functionality.
This commit is contained in:
wizardchen
2025-11-15 01:30:17 +08:00
parent 0ea5e6a2a2
commit 25fdaed8ca
37 changed files with 4778 additions and 198 deletions
+80 -2
View File
@@ -482,6 +482,7 @@ export default {
refresh: 'Refresh',
loading: 'Loading...',
noData: 'No data',
noMoreData: 'All content loaded',
error: 'Error',
success: 'Success',
warning: 'Warning',
@@ -658,6 +659,7 @@ export default {
},
knowledgeList: {
create: 'Create Knowledge Base',
createFAQ: 'Create FAQ Knowledge Base',
uninitializedBanner: 'Some knowledge bases are not initialized. Configure model information in settings before adding documents.',
empty: {
title: 'No knowledge bases yet',
@@ -680,11 +682,16 @@ export default {
basic: 'Basic Information',
models: 'Model Configuration',
chunking: 'Chunking Settings',
advanced: 'Advanced Settings'
advanced: 'Advanced Settings',
faq: 'FAQ Settings'
},
basic: {
title: 'Basic Information',
description: 'Configure the knowledge base name and description',
typeLabel: 'Knowledge Base Type',
typeDocument: 'Document-based',
typeFAQ: 'FAQ Q&A',
typeDescription: 'FAQ suits structured Q&A datasets; document type supports file parsing and chunking.',
nameLabel: 'Knowledge Base Name',
namePlaceholder: 'Enter knowledge base name',
descriptionLabel: 'Knowledge Base Description',
@@ -706,7 +713,78 @@ export default {
createFailed: 'Failed to create knowledge base',
missingId: 'Knowledge base ID is missing',
buildDataFailed: 'Failed to construct submission data',
updateSuccess: 'Configuration saved successfully'
updateSuccess: 'Configuration saved successfully',
indexModeRequired: 'Please select an indexing mode for FAQ knowledge bases'
},
faq: {
title: 'FAQ Configuration',
description: 'Configure indexing strategy and guidance for FAQ-style knowledge bases',
indexModeLabel: 'Indexing Mode',
indexModeDescription: 'Question-only indexing improves precision, question+answer improves recall.',
questionIndexModeLabel: 'Question Indexing Mode',
questionIndexModeDescription: 'Combined: Standard and similar questions are indexed together. Separate: Each question is indexed independently for more precise retrieval but requires more storage.',
entryGuide: 'Each FAQ entry contains a primary question, similar questions, negative examples, and multiple answers. Manage them in the FAQ knowledge base detail view.',
modes: {
questionOnly: 'Questions only',
questionAnswer: 'Question + answer',
combined: 'Combined',
separate: 'Separate'
},
standardQuestion: 'Primary Question',
answers: 'Answers',
similarQuestions: 'Similar Questions',
negativeQuestions: 'Negative Examples',
editorCreate: 'Create FAQ Entry',
editorEdit: 'Edit FAQ Entry',
addAnswer: 'Add Answer',
answerPlaceholder: 'Enter answer content, supports multi-line text, press Ctrl+Enter or click button to add',
similarPlaceholder: 'Enter similar question and click plus icon to add',
negativePlaceholder: 'Enter negative example and click plus icon to add',
answerRequired: 'Please provide at least one answer',
noAnswer: 'No answers',
noSimilar: 'No similar questions',
noNegative: 'No negative examples',
emptyTitle: 'No FAQ entries',
emptyDesc: 'Click "Create FAQ Entry" above to get started',
searchTest: 'Search Test',
searchTestTitle: 'FAQ Search Test',
queryLabel: 'Query',
queryPlaceholder: 'Enter a question to search',
vectorThresholdLabel: 'Vector Similarity Threshold',
vectorThresholdDesc: 'Range 0-1, default 0.7',
keywordThresholdLabel: 'Keyword Match Threshold',
keywordThresholdDesc: 'Range 0-1, default 0.5',
matchCountLabel: 'Result Count',
matchCountDesc: 'Range 1-50, default 10',
searchButton: 'Search',
searching: 'Searching...',
searchResults: 'Search Results',
noResults: 'No matching FAQ entries found',
score: 'Similarity',
matchType: 'Match Type',
matchTypeEmbedding: 'Vector Match',
matchTypeKeywords: 'Keyword Match',
similarityThresholdLabel: 'Similarity Threshold',
},
faqImport: {
title: 'Batch Import FAQ',
modeLabel: 'Import Mode',
appendMode: 'Append',
replaceMode: 'Replace existing entries',
fileLabel: 'Select File',
fileTip: 'Supports JSON / CSV / Excel with fields standard_question, answers, similar_questions, negative_questions',
clickToUpload: 'Click to upload file',
dragDropTip: 'or drag and drop file here',
importButton: 'Import FAQ',
deleteSelected: 'Delete Selected',
deleteSuccess: 'Selected entries deleted',
previewCount: '{count} entries parsed',
previewMore: '{count} more entries not shown',
importSuccess: 'Import completed',
parseFailed: 'Failed to parse file',
invalidJSON: 'Invalid JSON format',
unsupportedFormat: 'Unsupported file format',
selectFile: 'Please select a file to import first',
},
models: {
title: 'Model Configuration',