Enhance knowledge base functionality and integrate S3 storage support

- Add new models for `KnowledgeDocument` and `KnowledgeChunk` to manage document ingestion and chunking.
- Implement S3-compatible storage integration for knowledge documents, allowing for file uploads and retrieval.
- Introduce API endpoints for managing knowledge bases and documents, including creation, deletion, and searching.
- Update frontend components to support knowledge base configuration and document management, improving user interaction.
- Enhance backend services for knowledge processing and retrieval, ensuring robust handling of document statuses and errors.
This commit is contained in:
Xin Wang
2026-07-12 13:58:47 +08:00
parent 01c563a3e7
commit de58f30014
21 changed files with 995 additions and 34 deletions

View File

@@ -192,6 +192,35 @@ class KnowledgeBaseOut(KnowledgeBaseUpsert):
updated_at: str | None = None
class KnowledgeTextIn(CamelModel):
name: str = Field(min_length=1, max_length=255)
content: str = Field(min_length=1)
class KnowledgeDocumentOut(CamelModel):
id: str
knowledge_base_id: str
name: str
source_type: str
mime_type: str
size_bytes: int
status: str
error_message: str = ""
chunk_count: int
created_at: str | None = None
class KnowledgeSearchIn(CamelModel):
query: str = Field(min_length=1)
top_k: int = Field(default=5, ge=1, le=20)
class KnowledgeChunkOut(CamelModel):
id: str
chunk_index: int
content: str
# ---------- 接口定义驱动的统一模型资源 ----------
class InterfaceDefinitionOut(CamelModel):
interface_type: str