This commit is contained in:
2026-03-24 18:07:22 +08:00
parent e062368ef2
commit 9a16f738d8
121 changed files with 8904 additions and 3940 deletions
+10 -9
View File
@@ -1,22 +1,23 @@
from typing import Any, Dict, List, Optional
from typing import Any, List, Optional
from pydantic import BaseModel, ConfigDict, Field
class ChatMessageFileDTO(BaseModel):
"""文件输入模型(预留)"""
"""文件输入模型(保持与前端 DTO 兼容,允许附带任意文件元数据)。"""
model_config = ConfigDict(extra="allow")
class ChatMessageRequestDTO(BaseModel):
"""/api/workflows/stream 请求模型(对齐标准 chat message 请求)"""
"""/api/workflows/stream 请求模型(对齐前端 ChatMessageRequestDTO)。"""
model_config = ConfigDict(extra="forbid")
query: str
inputs: Dict[str, Any] = Field(default_factory=dict)
response_mode: str = "streaming"
user: Optional[str] = None
conversation_id: Optional[str] = None
files: List[ChatMessageFileDTO] = Field(default_factory=list)
query: Optional[str] = Field(default=None, description="用户输入/提问内容。")
inputs: Any = Field(default_factory=dict, description="App 定义的变量值,默认 {}。")
response_mode: Optional[str] = Field(default=None, description="streaming 或 blocking。")
user: Optional[str] = Field(default=None, description="用户唯一标识。")
conversation_id: Optional[str] = Field(default=None, description="可选会话 ID。")
files: List[ChatMessageFileDTO] = Field(default_factory=list, description="可选文件列表。")
auto_generate_name: Optional[bool] = Field(default=None, description="兼容旧前端字段,当前后端忽略。")