openapi: 3.0.3
info:
  title: AI Agent 接入
  description: |-
    ### Feature Introduction

    Regardless of whether you have programming experience, you can quickly build various Q&A Agents based on AI models in the CloudBase console. You can also publish the Agent to Mini Program Customer Service, Service Accounts, Official Accounts, or WeCom customer service so more users can chat with it.
      We have published the AI Agent as an API service, allowing you to interact with the Agent through HTTP requests.

    This series of open APIs provides a unified way to connect to AI Agents. Simply configure the token of the desired Agent in the CloudBase environment to integrate it quickly. The dialogue interfaces in this series support responses in the [SSE](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) format.

    ### Access Guide

    Calling the following APIs requires an AccessToken in the format `Authorization: Bearer <token>`. For details on how to obtain the token, see [Get token](https://docs.cloudbase.net/http-api/basic/access-token).

    ### HTTP Status Codes

    Depending on the response result, status codes `2xx`, `4xx`, or `5xx` may appear. The Agent may indicate errors in the response body even when the status code is 200, so handle the response based on the actual content.

    ### Error Codes

    The following table lists the error codes specific to this series of APIs.

    <table>
      <thead>
      <tr>
        <td>Error Code</td>
        <td>Description</td>
      </tr>
      </thead>
      <tr>
        <td>AGENT_INVALID_PARAM</td>
        <td>Invalid parameters were provided when calling the Agent</td>
      </tr>
      <tr>
        <td>AGENT_GET_INFO_ERROR</td>
        <td>Failed to query Agent information</td>
      </tr>
      <tr>
        <td>AGENT_REQUEST_LLM_ERROR</td>
        <td>The Agent encountered an exception while calling the large model</td>
      </tr>
      <tr>
        <td>AGENT_REQUEST_KNOWLEDGE_ERROR</td>
        <td>The Agent encountered an exception while querying the knowledge base</td>
      </tr>
      <tr>
        <td>AGENT_SERVER_ERR</td>
        <td>An internal Agent system error occurred</td>
      </tr>
    </table>
  version: 1.0.0
servers:
  - url: https://{envId}.api.tcloudbasegateway.com
    description: TCB openapi endpoint
    variables:
      envId:
        default: "env-xxxx"
        description: Environment ID
paths:
  /v1/aibot/bots:
    get:
      summary: "Query Agent list"
      operationId: getBotList
      security:
        - JWTAuth: []
      parameters:
        - name: name
          required: false
          in: query
          description: Fuzzy search by Agent name
          example: Name
          schema:
            type: string
        - name: introduction
          required: false
          in: query
          description: Fuzzy search by Agent introduction
          example: Introduction
          schema:
            type: string
        - name: information
          required: false
          in: query
          description: Fuzzy search by Agent information (name and introduction)
          example: Information
          schema:
            type: string
        - name: enable
          required: false
          in: query
          description: Whether the Agent is enabled
          example: true
          schema:
            type: boolean
        - name: pageSize
          required: false
          in: query
          description: Pagination size, defaults to 10
          example: 10
          schema:
            type: number
        - name: pageNumber
          required: false
          in: query
          description: Pagination page number, defaults to 1
          example: 1
          schema:
            type: number
      responses:
        "200":
          description: Returned when the AI Agent list is queried successfully
          headers:
            X-Request-Id:
              schema:
                type: string
              description: Request ID
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetBotListRsp"
        "default":
          description: Returned when querying AI Agents fails
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrRsp"
      tags:
        - AI Agent
    # post:
    #   summary: "Create Agent"
    #   operationId: createBot
    #   security:
    #     - JWTAuth: []
    #   parameters: []
    #   requestBody:
    #     required: true
    #     content:
    #       application/json:
    #         schema:
    #           $ref: "#/components/schemas/BotInfo"
    #   responses:
    #     "201":
    #       description: Returned when the AI Agent is created successfully
    #       headers:
    #         X-Request-Id:
    #           schema:
    #             type: string
    #           description: Request ID
    #       content:
    #         application/json:
    #           schema:
    #             $ref: "#/components/schemas/CreateBotRsp"
    #     "default":
    #       description: Returned when creating an AI Agent fails
    #       content:
    #         application/json:
    #           schema:
    #             $ref: "#/components/schemas/ErrRsp"
    #   tags:
    #     - AI Agent
  /v1/aibot/bots/{botId}:
    get:
      summary: "Query Agent information"
      operationId: getBotInfo
      security:
        - JWTAuth: []
      parameters:
        - name: botId
          required: true
          in: path
          schema:
            type: string
      responses:
        "200":
          description: Returned when the AI Agent information is queried successfully
          headers:
            X-Request-Id:
              schema:
                type: string
              description: Request ID
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BotInfo"
        "default":
          description: Returned when querying AI Agent information fails
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrRsp"
      tags:
        - AI Agent
    # patch:
    #   summary: "Update Agent information"
    #   operationId: updateBot
    #   security:
    #     - JWTAuth: []
    #   parameters:
    #     - name: botId
    #       required: true
    #       in: path
    #       schema:
    #         type: string
    #   requestBody:
    #     required: true
    #     content:
    #       application/json:
    #         schema:
    #           $ref: "#/components/schemas/BotInfo"
    #   responses:
    #     "200":
    #       description: Returned when the AI Agent is updated successfully
    #       headers:
    #         X-Request-Id:
    #           schema:
    #             type: string
    #           description: Request ID
    #       content:
    #         application/json:
    #           schema:
    #             $ref: "#/components/schemas/UpdateBotRsp"
    #     "default":
    #       description: Returned when updating the AI Agent fails
    #       content:
    #         application/json:
    #           schema:
    #             $ref: "#/components/schemas/ErrRsp"
    #   tags:
    #     - AI Agent
    # delete:
    #   summary: "Delete Agent"
    #   operationId: removeBot
    #   security:
    #     - JWTAuth: []
    #   parameters:
    #     - name: botId
    #       required: true
    #       in: path
    #       schema:
    #         type: string
    #   responses:
    #     "200":
    #       description: Returned when the AI Agent is deleted successfully
    #       headers:
    #         X-Request-Id:
    #           schema:
    #             type: string
    #           description: Request ID
    #       content:
    #         application/json:
    #           schema:
    #             $ref: "#/components/schemas/DeleteBotRsp"
    #     "default":
    #       description: Returned when deleting the AI Agent fails
    #       content:
    #         application/json:
    #           schema:
    #             $ref: "#/components/schemas/ErrRsp"
    #   tags:
    #     - AI Agent
  /v1/aibot/bots/{botId}/records:
    get:
      summary: "Query Agent conversation history"
      operationId: getChatHistory
      security:
        - JWTAuth: []
      parameters:
        - name: botId
          required: true
          in: path
          description: Agent ID
          example: bot-xxx
          schema:
            type: string
        - name: sort
          required: true
          in: query
          description: Sort order by creation time, asc for ascending, desc for descending
          example: desc
          schema:
            type: string
        - name: pageSize
          in: query
          description: Pagination size, defaults to 10
          example: 10
          schema:
            type: number
        - name: pageNumber
          in: query
          description: Pagination page number, defaults to 1
          example: 1
          schema:
            type: number
      responses:
        "200":
          description: Returned when conversation history is queried successfully
          headers:
            X-Request-Id:
              schema:
                type: string
              description: Request ID
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetChatHistoryRsp"
        "default":
          description: Returned when querying conversation history fails
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrRsp"
      tags:
        - AI Agent
  # /v1/aibot/bots/{botId}/feedback:
  # post:
  #   summary: "Submit user feedback"
  #   operationId: userFeedback
  #   security:
  #     - JWTAuth: []
  #   parameters:
  #     - name: botId
  #       required: true
  #       in: path
  #       description: Agent ID
  #       example: bot-xxx
  #       schema:
  #         type: string
  #   requestBody:
  #     required: true
  #     content:
  #       application/json:
  #         schema:
  #           $ref: "#/components/schemas/UserFeedbackDto"
  #   responses:
  #     "201":
  #       description: Returned when feedback is submitted successfully
  #       headers:
  #         X-Request-Id:
  #           schema:
  #             type: string
  #           description: Request ID
  #       content:
  #         application/json:
  #           schema:
  #             $ref: "#/components/schemas/UserFeedbackRsp"
  #     "default":
  #       description: Returned when submitting feedback fails
  #       content:
  #         application/json:
  #           schema:
  #             $ref: "#/components/schemas/ErrRsp"
  #   tags:
  #     - AI Agent
  # get:
  #   summary: "Query user feedback"
  #   operationId: getFeedback
  #   security:
  #     - JWTAuth: []
  #   parameters:
  #     - name: botId
  #       required: true
  #       in: path
  #       description: Agent ID
  #       example: bot-xxx
  #       schema:
  #         type: string
  #     - name: type
  #       in: query
  #       description: User feedback type, upvote for like, downvote for dislike
  #       example: upvote
  #       schema:
  #         type: string
  #     - name: sender
  #       in: query
  #       description: User who created the feedback
  #       example: user-xx
  #       schema:
  #         type: string
  #     - name: senderFilter
  #       in: query
  #       description: Sender filter relationship, include / exclude / equal / unequal / prefix
  #       example: contains
  #       schema:
  #         type: string
  #     - name: minRating
  #       in: query
  #       description: Minimum rating
  #       example: "5"
  #       schema:
  #         type: number
  #     - name: maxRating
  #       in: query
  #       description: Maximum rating
  #       example: "1"
  #       schema:
  #         type: number
  #     - name: from
  #       in: query
  #       description: Start timestamp
  #       example: "1721475455"
  #       schema:
  #         type: number
  #     - name: to
  #       in: query
  #       description: End timestamp
  #       example: "1721475456"
  #       schema:
  #         type: number
  #     - name: pageSize
  #       in: query
  #       description: Pagination size, defaults to 10
  #       example: 10
  #       schema:
  #         type: number
  #     - name: pageNumber
  #       in: query
  #       description: Pagination page number, defaults to 1
  #       example: 1
  #       schema:
  #         type: number
  #   responses:
  #     "200":
  #       description: Returned when feedback is queried successfully
  #       headers:
  #         X-Request-Id:
  #           schema:
  #             type: string
  #           description: Request ID
  #       content:
  #         application/json:
  #           schema:
  #             $ref: "#/components/schemas/GetUserFeedbackRsp"
  #     "default":
  #       description: Returned when querying feedback fails
  #       content:
  #         application/json:
  #           schema:
  #             $ref: "#/components/schemas/ErrRsp"
  #   tags:
  #     - AI Agent
  /v1/aibot/bots/{botId}/speech-to-text:
    post:
      operationId: speechToText
      summary: Speech to text
      parameters:
        - name: botId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SpeechToTextDto"
      responses:
        "201":
          description: ""
          content:
            application/json:
              schema:
                type: object
      tags:
        - AI Agent
  /v1/aibot/bots/{botId}/text-to-speech:
    post:
      operationId: textToSpeech
      summary: Text to speech
      parameters:
        - name: botId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TextToSpeechDto"
      responses:
        "201":
          description: ""
          content:
            application/json:
              schema:
                type: object
      tags:
        - AI Agent
    get:
      operationId: getTextToSpeechResult
      summary: Poll text-to-speech result
      parameters:
        - name: botId
          required: true
          in: path
          schema:
            type: string
        - name: taskId
          required: true
          in: query
          description: Task ID
          example: gz-5faa7bc8-6e78-46b9-90ea-5ebba32aa04c
          schema:
            type: string
        # - name: isPreview
        #   required: false
        #   in: query
        #   description: Whether this is preview mode
        #   schema:
        #     default: false
        #     type: boolean
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
      tags:
        - AI Agent
  /v1/aibot/bots/{botId}/conversation:
    post:
      operationId: createConversation
      summary: Create conversation
      parameters:
        - name: botId
          required: true
          in: path
          schema:
            type: string
      responses:
        "201":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConversationEntity"
      tags:
        - AI Agent
    get:
      operationId: getConversation
      summary: Query conversation list
      parameters:
        - name: botId
          required: true
          in: path
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Number of records per page
          example: 10
          schema:
            minimum: 0
            maximum: 100
            default: 10
            type: number
        - name: offset
          required: false
          in: query
          description: Offset
          example: 0
          schema:
            minimum: 0
            default: 0
            type: number
        - name: isDefault
          required: false
          in: query
          description: Whether to query the default conversation
          schema:
            default: false
            type: boolean
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetConversationRsp"
      tags:
        - AI Agent
  /v1/aibot/bots/{botId}/recommend-questions:
    post:
      summary: "Get recommended questions"
      operationId: getRecommendQuestions
      security:
        - JWTAuth: []
      parameters:
        - name: botId
          required: true
          in: path
          description: Agent ID
          example: bot-xxx
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GetRecommendQuestionsDto"
      responses:
        "200":
          description: Returned when recommended questions are retrieved successfully (SSE format)
          headers:
            X-Request-Id:
              schema:
                type: string
              description: Request ID
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SSERsp"
        "default":
          description: Returned when fetching recommended questions fails
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrRsp"
      tags:
        - AI Agent
  # /v1/aibot/generate-bot:
  #   post:
  #     summary: "Generate Agent script"
  #     operationId: generateBot
  #     security:
  #       - JWTAuth: []
  #     parameters: []
  #     requestBody:
  #       required: true
  #       content:
  #         application/json:
  #           schema:
  #             $ref: "#/components/schemas/GenerateBotDto"
  #     responses:
  #       "200":
  #         description: Returned when Agent content is generated successfully (SSE format)
  #         headers:
  #           X-Request-Id:
  #             schema:
  #               type: string
  #             description: Request ID
  #         content:
  #           application/json:
  #             schema:
  #               $ref: "#/components/schemas/SSERsp"
  #       "default":
  #         description: Returned when generating Agent content fails
  #         content:
  #           application/json:
  #             schema:
  #               $ref: "#/components/schemas/ErrRsp"
  #     tags:
  #       - AI Agent
  # /v1/aibot/preview:
  #   post:
  #     summary: "Preview Agent conversation"
  #     operationId: preview
  #     security:
  #       - JWTAuth: []
  #     parameters: []
  #     requestBody:
  #       required: true
  #       content:
  #         application/json:
  #           schema:
  #             $ref: "#/components/schemas/PreviewBotDto"
  #     responses:
  #       "200":
  #         description: Returned when the Agent preview succeeds (SSE format)
  #         headers:
  #           X-Request-Id:
  #             schema:
  #               type: string
  #             description: Request ID
  #         content:
  #           application/json:
  #             schema:
  #               $ref: "#/components/schemas/SSERsp"
  #       "default":
  #         description: Returned when the Agent preview fails
  #         content:
  #           application/json:
  #             schema:
  #               $ref: "#/components/schemas/ErrRsp"
  #     tags:
  #       - AI Agent
  # /v1/aibot/generate-image:
  #   post:
  #     summary: "Generate image"
  #     operationId: generateImage
  #     security:
  #       - JWTAuth: []
  #     parameters: []
  #     requestBody:
  #       required: true
  #       content:
  #         application/json:
  #           schema:
  #             $ref: "#/components/schemas/GenerateImageDto"
  #     responses:
  #       "200":
  #         description: Returned when the image is generated successfully (SSE format)
  #         headers:
  #           X-Request-Id:
  #             schema:
  #               type: string
  #             description: Request ID
  #         content:
  #           application/json:
  #             schema:
  #               $ref: "#/components/schemas/GenerateImageRsp"
  #       "default":
  #         description: Returned when generating the image fails
  #         content:
  #           application/json:
  #             schema:
  #               $ref: "#/components/schemas/ErrRsp"
  #     tags:
  #       - AI Agent
  /v1/aibot/bots/{botId}/send-message:
    post:
      summary: "Start Agent conversation"
      operationId: sendMessage
      security:
        - JWTAuth: []
      parameters:
        - name: botId
          required: true
          in: path
          description: Agent ID
          example: bot-xxx
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TcbSendMessageDto"
      responses:
        "200":
          description: Returned when the Agent conversation succeeds (SSE format)
          headers:
            X-Request-Id:
              schema:
                type: string
              description: Request ID
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SSERsp"
        "default":
          description: Returned when the Agent conversation fails
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrRsp"
      tags:
        - AI Agent
  /v1/aibot/openai/chat/completions:
    post:
      summary: "Start Agent conversation (OpenAI protocol)"
      operationId: openai-api
      security:
        - JWTAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OpenAIChatDto"
      responses:
        "x-stream:false":
          description: Returned when the Agent conversation succeeds with non-streaming response
          headers:
            X-Request-Id:
              schema:
                type: string
              description: Request ID
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OpenAINotStreamRsp"
        "x-stream:true":
          description: Returned when the Agent conversation succeeds with streaming response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OpenAIStreamRsp"
        "default":
          description: Returned when the Agent conversation fails
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrRsp"
      tags:
        - AI Agent
components:
  securitySchemes:
    JWTAuth:
      type: http
      scheme: Bearer
      description: The token corresponding to the environment ID is obtained using login authentication (v2)
  schemas:
    BotInfo:
      type: object
      properties:
        botId:
          type: string
          description: Agent ID generated by the system
          example: bot-xxx
        name:
          type: string
          description: Agent name
          example: Intelligent Agent
        introduction:
          type: string
          description: Agent introduction
          example: Introduction
        # agentSetting:
        #   type: string
        #   description: Agent setting
        #   example: This is an intelligent agent
        welcomeMessage:
          type: string
          description: Agent welcome message
          example: Welcome!
        avatar:
          type: string
          description: Agent avatar URL
          example: http://xxx.avatar.image
        background:
          type: string
          description: Agent chat background image URL
          example: http://xxx.background.image
        isNeedRecommend:
          type: boolean
          description: Whether to recommend follow-up questions after the Agent replies
          example: false
        # knowledgeBase:
        #   description: Knowledge base
        #   example:
        #     - ""
        #   type: array
        #   items:
        #     type: string
        # tags:
        #   description: Tags
        #   example:
        #     - ""
        #   type: array
        #   items:
        #     type: string
        type:
          type: string
          description: Agent type, text or image
          example: text
        searchEnable:
          type: boolean
          description: Whether web search is enabled
          example: false
        # initQuestions:
        #   description: Agent preset recommended questions
        #   example:
        #     - How can I help you?
        #   type: array
        #   items:
        #     type: string
        # enable:
        #   type: boolean
        #   description: Whether the Agent is enabled
        #   example: true
        # model:
        #   type: string
        #   description: Agent provider
        #   example: "hunyuan-beta"
        # modelValue:
        #   type: string
        #   description: Agent model
        #   example: "hunyuan-beta"
      required:
        - name
        - introduction
        - agentSetting
    UserFeedbackDto:
      type: object
      properties:
        recordId:
          type: string
          description: Conversation record ID
          example: record-xxx
        type:
          type: string
          description: User feedback type, upvote for like, downvote for dislike
          example: upvote
        botId:
          type: string
          description: Agent ID
          example: bot-xxx
        comment:
          type: string
          description: User comment
          example: Great reply
        rating:
          type: number
          description: User rating
          example: 5
        tags:
          description: Tag list provided in the feedback
          example:
            - Relevant response
          type: array
          items:
            type: string
        input:
          type: string
          description: User question
          example: Who are you?
        aiAnswer:
          type: string
          description: Agent answer
          example: I am an intelligent agent.
      required:
        - recordId
        - type
        - botId
    HistoryMsg:
      type: object
      properties:
        role:
          type: string
          description: Role in the conversation history
          example: user
        content:
          type: string
          description: Content of the conversation history
          example: This is a conversation message.
      required:
        - role
        - content
    GetRecommendQuestionsDto:
      type: object
      properties:
        name:
          type: string
          description: Agent name
          example: Intelligent Agent
        introduction:
          type: string
          description: Agent introduction
          example: Agent introduction
        agentSetting:
          type: string
          description: Agent persona
          example: Agent persona
        msg:
          type: string
          description: User message content
          example: Hello
        history:
          description: Conversation history
          type: array
          items:
            $ref: "#/components/schemas/HistoryMsg"
    GenerateBotDto:
      type: object
      properties:
        simple:
          type: boolean
          description: Whether to generate only the capability description, defaults to true
          example: true
        prompt:
          type: string
          description: Agent description
          example: Description
      required:
        - prompt
    # PreviewBotDto:
    #   type: object
    #   properties:
    #     name:
    #       type: string
    #       description: Agent name
    #       example: Intelligent Agent
    #     introduction:
    #       type: string
    #       description: Agent introduction
    #       example: Agent introduction
    #     agentSetting:
    #       type: string
    #       description: Agent persona
    #       example: Agent persona
    #     msg:
    #       type: string
    #       description: User message
    #       example: Hello
    #     history:
    #       description: Conversation history
    #       type: array
    #       items:
    #         $ref: "#/components/schemas/HistoryMsg"
    #     searchEnable:
    #       type: boolean
    #       description: Whether to enable web search. Only enabled when both the Agent configuration and this field are true.
    #       example: true
    #     knowledgeBase:
    #       description: Knowledge base
    #       type: array
    #       items:
    #         type: string
    #     files:
    #       type: array
    #       description: Fields required for file-related conversations. You can pass a Cloud Storage path such as cloud://xxx.xxx or a publicly accessible link such as https://xxxx.xxxx.
    #       items:
    #         type: string
    #       example: ["cloud://xxx.xxxx"]
    #   required:
    #     - name
    #     - introduction
    #     - agentSetting
    GenerateImageDto:
      type: object
      properties:
        prompt:
          type: string
          description: Description for generating the image
          example: Description
      required:
        - prompt
    TcbSendMessageDto:
      type: object
      properties:
        msg:
          type: string
          description: User message
          example: Hello
        history:
          description: Conversation history
          type: array
          items:
            $ref: "#/components/schemas/HistoryMsg"
        searchEnable:
          type: boolean
          description: Whether to enable web search. Only enabled when both the Agent configuration and this field are true.
          example: true
        files:
          type: array
          description: "Fields required for file-related conversations. You can upload files to [Cloud Storage](https://docs.cloudbase.net/http-api/storage/get-objects-upload-info) and use the cloud storage link (cloud://xxx.xxx) or a publicly accessible link (https://xxxx.xxxx)."
          items:
            type: string
          example: ["cloud://xxx.xxxx"]
        conversationId:
          type: string
          description: Conversation ID. Takes effect after multi-conversation is enabled and marks the conversation to which this interaction belongs. You can obtain the ID from conversation-related APIs.
          example: conversation-xxx
      required:
        - msg
    OpenAIChatDto:
      type: object
      properties:
        model:
          type: string
          description: Agent ID
          example: bot-xxxxx
        messages:
          description: Messages
          type: array
          items:
            $ref: "#/components/schemas/HistoryMsg"
        stream:
          type: boolean
          description: Whether to return streaming responses
          example: false
      required:
        - model
        - messages
        - stream
    GetBotListRsp:
      type: object
      properties:
        botList:
          type: array
          description: Agent list
          items:
            $ref: "#/components/schemas/BotInfo"
        total:
          type: number
          description: Total number of Agents
          example: 10
      required:
        - botList
        - total
    CreateBotRsp:
      type: object
      properties:
        botId:
          type: string
          description: Generated Agent ID
          example: bot-3ee2a8b8
      required:
        - botId
    UpdateBotRsp:
      type: object
      properties:
        status:
          type: string
          description: Operation result
          example: success
      required:
        - status
    DeleteBotRsp:
      type: object
      properties:
        status:
          type: string
          description: Operation result
          example: success
      required:
        - status
    ChatHistory:
      type: object
      properties:
        botId:
          type: string
          description: Agent ID
          example: bot-xxx
        recordId:
          type: string
          description: Conversation record ID generated by the system
          example: record-xxx
        role:
          type: string
          description: Role in the conversation
          example: user
        content:
          type: string
          description: Conversation content
          example: I am a conversation entry.
        conversation:
          type: string
          description: User identifier
          example: user
        type:
          type: string
          description: Conversation data type
          example: text
        image:
          type: string
          description: Image URL generated in the conversation
          example: http://xxx.image
        triggerSrc:
          type: string
          description: Source of the conversation trigger
          example: TCB
        replyTo:
          type: string
          description: ID of the record being replied to
          example: record-xxx
        createTime:
          type: string
          description: Conversation time
          example: "2024-07-25T12:03:59.000Z"
    GetChatHistoryRsp:
      type: object
      properties:
        recordList:
          type: array
          description: Conversation history list
          items:
            $ref: "#/components/schemas/ChatHistory"
        total:
          type: number
          description: Total number of conversations
          example: 10
      required:
        - recordList
        - total
    UserFeedbackRsp:
      type: object
      properties:
        status:
          type: string
          description: Operation result
          example: success
      required:
        - status
    # GetUserFeedbackRsp:
    #   type: object
    #   properties:
    #     feedbackList:
    #       type: array
    #       description: Feedback query results
    #       items:
    #         $ref: "#/components/schemas/UserFeedbackDto"
    #     total:
    #       type: number
    #       description: Total number of feedback entries
    #       example: 10
    #   required:
    #     - feedbackList
    #     - total
    SpeechToTextDto:
      type: object
      properties:
        engSerViceType:
          type: string
          description: "Input language type. 16k_zh: Chinese, 16k_zh-PY: Chinese-English-Cantonese, 16k_zh_medical: Chinese medical, 16k_en: English, 16k_yue: Cantonese"
          example: 16k_zh
        voiceFormat:
          type: string
          description: Audio format of the file, such as wav or mp3
          example: mp3
        url:
          type: string
          description: URL of the audio file
        # isPreview:
        #   type: boolean
        #   description: Whether this is preview mode
        #   default: false
      required:
        - voiceFormat
        - url
    TextToSpeechDto:
      type: object
      properties:
        text:
          type: string
          description: Source text for speech synthesis
        voiceType:
          type: number
          description: "Voice ID. 101004: generic male, 101005: generic female, 601004: support male, 501001: support female, 101010: generic male (large model), 101035: generic female (large model)"
          example: 101008
        # isPreview:
        #   type: boolean
        #   description: Whether this is preview mode
        #   default: false
      required:
        - text
    ConversationEntity:
      type: object
      properties:
        conversationId:
          type: string
        title:
          type: string
        createTime:
          type: string
        updateTime:
          type: string
      required:
        - conversationId
        - title
        - createTime
        - updateTime
    GetConversationRsp:
      type: object
      properties:
        data:
          type: array
          description: Conversation query results
          items:
            $ref: "#/components/schemas/ConversationEntity"
        total:
          type: number
          description: Total number of conversations
          example: 1
      required:
        - data
        - total
    GenerateImageRsp:
      type: object
      properties:
        url:
          type: string
          description: Generated image URL
          example: "https://hunyuan-base-prod-1258344703.cos.ap-guangzhou.myqcloud.com/text2image/result/20240821/20240821145652298/f2c15c49cc45f338daf46d3b9413c18c.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKID0qSq0xJRL7h3A4nIYJFrFOJ1VlnbIm26%26q-sign-time%3D1724223412%3B1724309812%26q-key-time%3D1724223412%3B1724309812%26q-header-list%3Dhost%26q-url-param-list%3D%26q-signature%3D99b6c0f8d8434abf22a06887e2d854223045eaf8"
        content:
          type: string
          description: Description of the generated image
          example: "A scene in a surrealist style showing a metal robot staring defiantly at an astonished person. The robot has an angular design and holds a large 'correct' button. The setting is a modern office with a world map on the wall."
    SSERsp:
      type: object
      properties:
        created:
          type: number
          description: Conversation timestamp
          example: "1726030224"
        record_id:
          type: string
          description: Conversation record ID
          example: "record-427d3652"
        model:
          type: string
          description: Large model type
          example: "hunyuan"
        version:
          type: string
          description: Large model version
          example: "202407241700"
        type:
          type: string
          description: "Response type: text for the main answer, thinking for reasoning process, search for search results, knowledge for knowledge base"
          example: "assistant"
        role:
          type: string
          description: Conversation role, fixed as assistant in responses
          example: "assistant"
        content:
          type: string
          description: Conversation content
          example: "Hello"
        finish_reason:
          type: string
          description: Conversation termination flag; continue means not finished, stop means finished
          example: "continue"
        reasoning_content:
          type: string
          description: Deep reasoning content (only non-empty for hy3)
          example: ""
        usage:
          type: object
          description: Token usage
          properties:
            promptTokens:
              type: number
              description: Number of prompt tokens; remains constant across multiple responses
              example: 10
            completionTokens:
              type: number
              description: Total completion tokens. In streaming responses, this accumulates across chunks.
              example: 20
            totalTokens:
              type: number
              description: Sum of promptTokens and completionTokens
              example: 30
        knowledge_base:
          description: Knowledge bases used in the conversation
          example:
            - ""
          type: array
          items:
            type: string
        search_info:
          type: object
          description: Search results (requires web search to be enabled)
          properties:
            search_results:
              type: array
              description: Search citation information
              items:
                properties:
                  index:
                    type: string
                    description: Citation index
                    example: "[1]"
                  title:
                    type: string
                    description: Citation title
                    example: "Title"
                  url:
                    type: string
                    description: Citation URL
                    example: "Link"
    OpenAIStreamRsp:
      type: object
      properties:
        id:
          type: string
          description: Conversation record ID
          example: "record-427d3652"
        object:
          type: string
          description: API type
          example: "chat.completion"
        created:
          type: number
          description: Conversation timestamp
          example: "1726030224"
        model:
          type: string
          description: Agent ID
          example: "bot-xxxx"
        choices:
          type: array
          description: choices
          items:
            properties:
              index:
                type: number
                description: index
                example: 0
              delta:
                type: object
                properties:
                  role:
                    type: string
                    description: Message role
                    example: "assistant"
                  content:
                    type: string
                    description: Message content
                    example: "Hello"
              finish_reason:
                type: string
                description: Conversation termination flag; continue means not finished, stop means finished
                example: "continue"
        usage:
          type: object
          description: Token usage
          properties:
            prompt_tokens:
              type: number
              description: Number of prompt tokens; remains constant across multiple responses
              example: 10
            completion_tokens:
              type: number
              description: Total completion tokens. In streaming responses, this accumulates across chunks.
              example: 20
            total_tokens:
              type: number
              description: Sum of prompt_tokens and completion_tokens
    OpenAINotStreamRsp:
      type: object
      properties:
        id:
          type: string
          description: Conversation record ID
          example: "record-427d3652"
        object:
          type: string
          description: API type
          example: "chat.completion"
        created:
          type: number
          description: Conversation timestamp
          example: "1726030224"
        model:
          type: string
          description: Agent ID
          example: "bot-xxxx"
        choices:
          type: array
          description: choices
          items:
            properties:
              index:
                type: number
                description: index
                example: 0
              message:
                type: object
                properties:
                  role:
                    type: string
                    description: Message role
                    example: "assistant"
                  content:
                    type: string
                    description: Message content
                    example: "Hello"
              finish_reason:
                type: string
                description: Conversation termination flag; continue means not finished, stop means finished
                example: "continue"
        usage:
          type: object
          description: Token usage
          properties:
            prompt_tokens:
              type: number
              description: Number of prompt tokens; remains constant across multiple responses
              example: 10
            completion_tokens:
              type: number
              description: Total completion tokens. In streaming responses, this accumulates across chunks.
              example: 20
            total_tokens:
              type: number
              description: Sum of prompt_tokens and completion_tokens
    ErrRsp:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: "INVALID_CREDENTIALS"
        message:
          type: string
          description: Error message
          example: "Credentials are invalid"
        requestId:
          type: string
          description: Request ID
          example: "6360ba4b-f672-434b-9dee-35686a5589a4"
