feat: add AI provider commands with on-chain payment

- Create ai.py with serve and request commands
- request includes balance verification and payment via blockchain send
- serve runs FastAPI server and optionally registers jobs with coordinator
Update marketplace.py:
- Add gpu unregister command (DELETE endpoint)
This commit is contained in:
2026-03-13 21:13:04 +00:00
parent 3bdada174c
commit e7af9ac365
5 changed files with 213 additions and 2 deletions

View File

@@ -426,6 +426,26 @@ async def send_payment(
}
@router.delete("/marketplace/gpu/{gpu_id}")
async def delete_gpu(
gpu_id: str,
session: Annotated[Session, Depends(get_session)],
force: bool = Query(default=False, description="Force delete even if GPU is booked")
) -> Dict[str, Any]:
"""Delete (unregister) a GPU from the marketplace."""
gpu = _get_gpu_or_404(session, gpu_id)
if gpu.status == "booked" and not force:
raise HTTPException(
status_code=http_status.HTTP_409_CONFLICT,
detail=f"GPU {gpu_id} is currently booked. Use force=true to delete anyway."
)
session.delete(gpu)
session.commit()
return {"status": "deleted", "gpu_id": gpu_id}
@router.get("/marketplace/gpu/{gpu_id}/reviews")
async def get_gpu_reviews(
gpu_id: str,