feat: add source-grounded evolution and Ollama assistant
This commit is contained in:
@@ -1 +1 @@
|
||||
__all__ = ["analysis", "areas", "datasets", "health", "projects", "exports", "jobs", "external", "qa", "temporal"]
|
||||
__all__ = ["analysis", "areas", "assistant", "datasets", "health", "projects", "exports", "jobs", "external", "qa", "temporal"]
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from uuid import UUID
|
||||
|
||||
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.services.geo_assistant_service import GeoAssistantService
|
||||
from app.utils.response import envelope
|
||||
|
||||
|
||||
router = APIRouter(tags=["assistant"])
|
||||
|
||||
|
||||
@router.get("/assistant/status", response_model=dict)
|
||||
def assistant_status() -> dict:
|
||||
return envelope(GeoAssistantService().status().model_dump())
|
||||
|
||||
|
||||
@router.get("/assistant/models", response_model=dict)
|
||||
def assistant_models() -> dict:
|
||||
service = GeoAssistantService()
|
||||
models = service.list_models()
|
||||
return envelope(
|
||||
{
|
||||
"items": [model.model_dump() for model in models],
|
||||
"total": len(models),
|
||||
"default_model": service.settings.ollama_default_model,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@router.post("/projects/{project_id}/assistant/query", response_model=dict)
|
||||
def assistant_query(
|
||||
project_id: UUID,
|
||||
payload: AssistantQueryRequest,
|
||||
db: Session = Depends(get_db),
|
||||
) -> dict:
|
||||
return envelope(GeoAssistantService().query(db, project_id=project_id, payload=payload).model_dump())
|
||||
Reference in New Issue
Block a user