Spaces:
Runtime error
Runtime error
Add generation job attempt history API
Browse files- app/api/generation.py +14 -0
app/api/generation.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import Annotated
|
|
| 5 |
from fastapi import APIRouter, Header, HTTPException, Query, Request, status
|
| 6 |
|
| 7 |
from app.generation.schemas.requests import (
|
|
|
|
| 8 |
GenerationJobView,
|
| 9 |
GenerationProviderView,
|
| 10 |
GenerationRequestCreate,
|
|
@@ -109,6 +110,19 @@ async def get_job(request: Request, generation_job_id: str) -> GenerationJobView
|
|
| 109 |
)
|
| 110 |
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
@router.post(
|
| 113 |
"/jobs/{generation_job_id}/cancel", response_model=GenerationJobView
|
| 114 |
)
|
|
|
|
| 5 |
from fastapi import APIRouter, Header, HTTPException, Query, Request, status
|
| 6 |
|
| 7 |
from app.generation.schemas.requests import (
|
| 8 |
+
GenerationJobAttemptView,
|
| 9 |
GenerationJobView,
|
| 10 |
GenerationProviderView,
|
| 11 |
GenerationRequestCreate,
|
|
|
|
| 110 |
)
|
| 111 |
|
| 112 |
|
| 113 |
+
@router.get(
|
| 114 |
+
"/jobs/{generation_job_id}/attempts",
|
| 115 |
+
response_model=list[GenerationJobAttemptView],
|
| 116 |
+
)
|
| 117 |
+
async def list_job_attempts(
|
| 118 |
+
request: Request, generation_job_id: str
|
| 119 |
+
) -> list[GenerationJobAttemptView]:
|
| 120 |
+
workspace_id, user_id = _identity(request)
|
| 121 |
+
return await _generation(request).list_job_attempts(
|
| 122 |
+
workspace_id, user_id, generation_job_id
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
@router.post(
|
| 127 |
"/jobs/{generation_job_id}/cancel", response_model=GenerationJobView
|
| 128 |
)
|