Harden RC7 API response contracts
This commit is contained in:
@@ -6,7 +6,13 @@ from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.db.session import get_db
|
||||
from app.schemas.assistant import AssistantQueryRequest
|
||||
from app.schemas import Envelope
|
||||
from app.schemas.assistant import (
|
||||
AssistantModelList,
|
||||
AssistantQueryRequest,
|
||||
AssistantQueryResponse,
|
||||
AssistantStatus,
|
||||
)
|
||||
from app.services.geo_assistant_service import GeoAssistantService
|
||||
from app.utils.response import envelope
|
||||
|
||||
@@ -14,12 +20,12 @@ from app.utils.response import envelope
|
||||
router = APIRouter(tags=["assistant"])
|
||||
|
||||
|
||||
@router.get("/assistant/status", response_model=dict)
|
||||
@router.get("/assistant/status", response_model=Envelope[AssistantStatus])
|
||||
def assistant_status() -> dict:
|
||||
return envelope(GeoAssistantService().status().model_dump())
|
||||
|
||||
|
||||
@router.get("/assistant/models", response_model=dict)
|
||||
@router.get("/assistant/models", response_model=Envelope[AssistantModelList])
|
||||
def assistant_models() -> dict:
|
||||
service = GeoAssistantService()
|
||||
models = service.list_models()
|
||||
@@ -32,7 +38,10 @@ def assistant_models() -> dict:
|
||||
)
|
||||
|
||||
|
||||
@router.post("/projects/{project_id}/assistant/query", response_model=dict)
|
||||
@router.post(
|
||||
"/projects/{project_id}/assistant/query",
|
||||
response_model=Envelope[AssistantQueryResponse],
|
||||
)
|
||||
def assistant_query(
|
||||
project_id: UUID,
|
||||
payload: AssistantQueryRequest,
|
||||
|
||||
Reference in New Issue
Block a user