(request: Request)
| 475 | |
| 476 | @app.post("/v1/abort_requests") |
| 477 | async def abort_requests(request: Request): |
| 478 | body = await request.json() |
| 479 | abort_all = body.get("abort_all", False) |
| 480 | req_ids = body.get("req_ids", None) |
| 481 | |
| 482 | # 参数校验 |
| 483 | if not abort_all and not req_ids: |
| 484 | return JSONResponse(status_code=400, content={"error": "must provide abort_all=true or req_ids"}) |
| 485 | |
| 486 | control_request = ControlRequest( |
| 487 | request_id=f"control-{uuid.uuid4()}", |
| 488 | method="abort_requests", |
| 489 | args={"abort_all": abort_all, "req_ids": req_ids or []}, |
| 490 | ) |
| 491 | control_response = await app.state.engine_client.run_control_method(control_request) |
| 492 | return control_response.to_api_json_response() |
| 493 | |
| 494 | |
| 495 | def wrap_streaming_generator(original_generator: AsyncGenerator): |
nothing calls this directly
no test coverage detected