feat(ai): 文档管理 handler — CRUD + Multipart 上传

- list_documents: 分页列表(按知识库过滤)
- get_document: 文档详情
- create_manual_document: 手动输入文档
- upload_document: Multipart 文件上传(20MB 限制 + 自动解析)
- delete_document: 软删除(级联减计数)
- 5 条路由注册到 /ai/knowledge-bases/{kb_id}/documents + /ai/documents/*

Phase 2 Task 10
This commit is contained in:
iven
2026-05-27 00:17:43 +08:00
parent 0a1f4cb9a9
commit e94f5bc00c
3 changed files with 276 additions and 0 deletions

View File

@@ -609,6 +609,27 @@ impl AiModule {
"/ai/knowledge-bases/{id}",
axum::routing::delete(crate::handler::knowledge_v2_handler::delete_knowledge_base),
)
// 文档管理路由
.route(
"/ai/knowledge-bases/{kb_id}/documents",
axum::routing::get(crate::handler::document_handler::list_documents),
)
.route(
"/ai/documents/manual",
axum::routing::post(crate::handler::document_handler::create_manual_document),
)
.route(
"/ai/documents/upload",
axum::routing::post(crate::handler::document_handler::upload_document),
)
.route(
"/ai/documents/{id}",
axum::routing::get(crate::handler::document_handler::get_document),
)
.route(
"/ai/knowledge-bases/{kb_id}/documents/{id}",
axum::routing::delete(crate::handler::document_handler::delete_document),
)
.route(
"/ai/dialysis/risk-assessment",
axum::routing::post(crate::handler::assess_dialysis_risk),