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
+10
View File
@@ -0,0 +1,10 @@
-- Add FAQ knowledge base type and chunk metadata storage
ALTER TABLE knowledge_bases
ADD COLUMN type VARCHAR(32) NOT NULL DEFAULT 'document' AFTER name,
ADD COLUMN faq_config JSON NULL AFTER extract_config;
UPDATE knowledge_bases SET type = 'document' WHERE type IS NULL OR type = '';
ALTER TABLE chunks
ADD COLUMN metadata JSON NULL AFTER indirect_relation_chunks;
@@ -0,0 +1,12 @@
-- Add FAQ knowledge base type and chunk metadata support
ALTER TABLE knowledge_bases
ADD COLUMN IF NOT EXISTS type VARCHAR(32) NOT NULL DEFAULT 'document',
ADD COLUMN IF NOT EXISTS faq_config JSONB;
UPDATE knowledge_bases
SET type = 'document'
WHERE type IS NULL OR type = '';
ALTER TABLE chunks
ADD COLUMN IF NOT EXISTS metadata JSONB;
@@ -0,0 +1,12 @@
-- 08-add-faq-support rollback
BEGIN;
ALTER TABLE chunks
DROP COLUMN IF EXISTS metadata;
ALTER TABLE knowledge_bases
DROP COLUMN IF EXISTS faq_config,
DROP COLUMN IF EXISTS type;
COMMIT;
@@ -0,0 +1,17 @@
-- 08-add-faq-support.sql
-- Introduce FAQ knowledge base type and chunk metadata storage
BEGIN;
ALTER TABLE knowledge_bases
ADD COLUMN IF NOT EXISTS type VARCHAR(32) NOT NULL DEFAULT 'document',
ADD COLUMN IF NOT EXISTS faq_config JSONB;
UPDATE knowledge_bases
SET type = 'document'
WHERE type IS NULL OR type = '';
ALTER TABLE chunks
ADD COLUMN IF NOT EXISTS metadata JSONB;
COMMIT;