feat(api): nest chat endpoints under projects and refactor dependencies

- Change chat router prefix from `/chat` to `/projects/{project_id}/chat`
- Add `dep_project` dependency to inject Project instance into endpoints
- Remove manual project validation in `stream_chat` and use dependency instead
- Add placeholder `list_sessions` endpoint for future session listing
- Update `get_history` endpoint to use project dependency and adjust path
- Improve code organization and error handling for project retrieval
This commit is contained in:
YueGuobin committed 2026-03-04 12:43:36 +08:00
1 parent 479afc01b0
commit 2df05dff6e
3 files changed
+47 -65

No files matched your search

-1
View File
@@ -35,7 +35,6 @@ class ChatRequest(BaseModel):
message: str = Field(..., description="User message content")
session_id: Optional[str] = Field(None, description="Session ID (auto-generated if not provided)")
project_id: str = Field(..., description="GNS3 project ID")
stream: bool = Field(default=True, description="Enable streaming response")
temperature: Optional[float] = Field(None, description="LLM temperature parameter")
mode: Literal["text"] = Field(default="text", description="Interaction mode")