feat(saas): add knowledge base module — categories, items, versions, search, analytics

- 5 knowledge tables (categories, items, chunks, versions, usage) with pgvector + HNSW + GIN indexes
- 23+ API routes covering full CRUD, tree-structured categories, version snapshots
- Keyword-based search with ILIKE + array match (placeholder for vector search)
- Analytics endpoints: overview, trends, top-items, quality, gaps
- Markdown-aware content chunking with overlap strategy
- Worker dispatch for async embedding generation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-02 00:21:28 +08:00
parent b66087de0e
commit ef60f9a183
8 changed files with 1194 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ use sqlx::PgPool;
use crate::config::DatabaseConfig;
use crate::error::SaasResult;
const SCHEMA_VERSION: i32 = 12;
const SCHEMA_VERSION: i32 = 13;
/// 初始化数据库
pub async fn init_db(config: &DatabaseConfig) -> SaasResult<PgPool> {