Cancel a generation

POST /generations/{id}/cancel

取消一个生成中或排队中的题目生成任务。

Path parameters

  • id string Required

    Format should match the following pattern: ^gen-.

Responses

  • 200 application/json

    generation cancelled

    Hide response attributes Show response attributes object
    • object string

      Value is generation.

    • data object

      Additional properties are allowed.

      Hide data attributes Show data attributes object
      • id string

        Format should match the following pattern: ^gen-.

      • object string

        Value is generation.

      • created_at string(date-time)
      • finished_at string(date-time) | null
      • status string

        Values are queued, generating, succeeded, failed, or cancelled.

  • 400 application/json

    generation is already finished

  • 404 application/json

    generation not found

POST /generations/{id}/cancel
curl \
 -X POST https://v5.jinshuju.net/exam/api/generations/{id}/cancel
Response examples (200)
{
  "id": "gen-6757a420e88e5d8d2a0bbd23",
  "object": "generation",
  "status": "cancelled",
  "created_at": "2024-12-10T10:14:56.622+08:00",
  "finished_at": null
}
Response examples (400)
{
  "error": {
    "type": "invalid_request_error",
    "message": "Generation is already finished"
  }
}
Response examples (404)
{
  "error": {
    "type": "invalid_request_error",
    "message": "No such Generation object: gen-123"
  }
}