mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 07:08:09 -05:00
We'll soon be needing a more feature-complete external API. To make way for this, I'm moving some files around so: - We can more easily create new versions of our external API - The file structure of our internal API is more homogeneous These changes are quite opinionated, but IMO in any case they're better than the chaotic structure we have now. ### Changes 🏗️ - Move `backend/server` -> `backend/api` - Move `backend/server/routers` + `backend/server/v2` -> `backend/api/features` - Change absolute sibling imports to relative imports - Move `backend/server/v2/AutoMod` -> `backend/executor/automod` - Combine `backend/server/routers/analytics_*test.py` -> `backend/api/features/analytics_test.py` - Sort OpenAPI spec file ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - CI tests - [x] Clicking around in the app -> no obvious breakage
35 lines
651 B
Python
35 lines
651 B
Python
from typing import Any, Dict, Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class Document(BaseModel):
|
|
url: str
|
|
relevance_score: float
|
|
|
|
|
|
class ApiResponse(BaseModel):
|
|
answer: str
|
|
documents: list[Document]
|
|
success: bool
|
|
|
|
|
|
class GraphData(BaseModel):
|
|
nodes: list[Dict[str, Any]]
|
|
edges: list[Dict[str, Any]]
|
|
graph_name: Optional[str] = None
|
|
graph_description: Optional[str] = None
|
|
|
|
|
|
class Message(BaseModel):
|
|
query: str
|
|
response: str
|
|
|
|
|
|
class ChatRequest(BaseModel):
|
|
query: str
|
|
conversation_history: list[Message]
|
|
message_id: str
|
|
include_graph_data: bool = False
|
|
graph_id: Optional[str] = None
|