Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -1,2 +1 @@
|
||||
# src/api/__init__.py
|
||||
"""API接口模块"""
|
||||
"""API接口模块"""
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/api/models/__init__.py
|
||||
"""API数据模型"""
|
||||
|
||||
from .document import (
|
||||
@@ -19,4 +18,4 @@ __all__ = [
|
||||
"SearchResponse",
|
||||
"DocumentStatusResponse",
|
||||
"ErrorResponse"
|
||||
]
|
||||
]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/api/models/document.py
|
||||
"""文档相关Pydantic数据模型"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
@@ -60,4 +59,4 @@ class ErrorResponse(BaseModel):
|
||||
"""错误响应"""
|
||||
error: str = Field(..., description="错误类型")
|
||||
message: str = Field(..., description="错误消息")
|
||||
timestamp: datetime = Field(default_factory=datetime.now, description="时间戳")
|
||||
timestamp: datetime = Field(default_factory=datetime.now, description="时间戳")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/api/routes/__init__.py
|
||||
"""API路由模块"""
|
||||
|
||||
from fastapi import APIRouter
|
||||
@@ -14,4 +13,4 @@ api_router.include_router(documents_router)
|
||||
api_router.include_router(knowledge_router)
|
||||
api_router.include_router(agent_router)
|
||||
|
||||
__all__ = ["api_router", "documents_router", "knowledge_router", "agent_router"]
|
||||
__all__ = ["api_router", "documents_router", "knowledge_router", "agent_router"]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/api/routes/agent.py
|
||||
"""Agent API接口 - 问答对话接口"""
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Depends
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/api/routes/documents.py
|
||||
"""文档上传与处理接口"""
|
||||
|
||||
from fastapi import APIRouter, UploadFile, File, Form, HTTPException
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/api/routes/knowledge.py
|
||||
"""知识库检索接口"""
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
Reference in New Issue
Block a user