{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aifu-asia/json-schema/aifu-asia-chat-request-schema.json",
  "title": "ChatRequest",
  "description": "Request to the chat endpoint.",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bazaar-openapi.json#/components/schemas/ChatRequest",
  "properties": {
    "message": {
      "type": "string",
      "maxLength": 10000,
      "minLength": 1,
      "title": "Message"
    },
    "conversation_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Conversation Id"
    },
    "agent": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent"
    },
    "history": {
      "items": {
        "$ref": "#/$defs/ChatMessage"
      },
      "type": "array",
      "title": "History",
      "default": []
    }
  },
  "type": "object",
  "required": [
    "message"
  ],
  "$defs": {
    "ChatMessage": {
      "properties": {
        "role": {
          "type": "string",
          "pattern": "^(user|assistant|system)$",
          "title": "Role"
        },
        "content": {
          "type": "string",
          "title": "Content"
        }
      },
      "type": "object",
      "required": [
        "role",
        "content"
      ],
      "title": "ChatMessage",
      "description": "A single message in the conversation."
    }
  }
}