# 更新聊天机器人设置

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/v1/update-chatbot-settings:
    post:
      summary: 更新聊天机器人设置
      deprecated: false
      description: |+
        更新聊天机器人设置 API 允许您编辑聊天机器人的设置，例如其名称、基本提示、初始消息、建议消息、可见性状态、域限制、IP 限制、AI 模型等。

      tags: []
      parameters:
        - name: content-type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                collectCustomerInformation:
                  type: object
                  properties:
                    name:
                      type: object
                      properties:
                        label:
                          type: string
                          description: 描述名称字段的标签，帮助客户了解所请求的信息。
                        active:
                          type: boolean
                          description: 指示名称字段是否激活。如果设置为 true，聊天机器人将提示客户提供姓名。
                      required:
                        - label
                        - active
                      x-apifox-orders:
                        - label
                        - active
                  required:
                    - name
                  x-apifox-orders:
                    - name
                  description: 包含要从客户收集的信息的对象。
                styles:
                  type: object
                  properties:
                    theme:
                      type: string
                      description: 为聊天机器人界面主题选择“深色”或“浅色”。
                    userMessageColor:
                      type: string
                      description: 以十六进制格式定义用户消息颜色
                    buttonColor:
                      type: string
                      description: 使用十六进制格式设置聊天气泡按钮颜色。
                    displayName:
                      type: string
                      description: 在聊天界面中显示品牌名称。
                    autoOpenChatWindowAfter:
                      type: integer
                      description: 在定义的时间（以秒为单位）后自动打开聊天窗口。
                    alignChatButton:
                      type: string
                      description: 在界面中对齐聊天机器人按钮，“左”或“右”。
                  required:
                    - theme
                    - userMessageColor
                    - buttonColor
                    - displayName
                    - autoOpenChatWindowAfter
                    - alignChatButton
                  x-apifox-orders:
                    - theme
                    - userMessageColor
                    - buttonColor
                    - displayName
                    - autoOpenChatWindowAfter
                    - alignChatButton
                  description: 包含样式参数的对象，允许您自定义聊天机器人用户界面的外观。
                chatbotId:
                  type: string
                  description: 指您要与之交互的聊天机器人的 ID（可在聊天机器人设置页面上找到）。
                name:
                  type: string
                  description: 聊天机器人的新名称。
                instructions:
                  type: string
                  description: 基本提示；有关聊天机器人应如何表现的说明。
                initialMessages:
                  type: array
                  items:
                    type: string
                  description: 包含聊天机器人要使用的初始消息的字符串数组。这些消息将是聊天机器人向用户打招呼的内容。
                suggestedMessages:
                  type: array
                  items:
                    type: string
                  description: 包含聊天机器人使用的建议消息的字符串数组。这些消息将显示在聊天机器人界面中的文本输入上方。
                visibility:
                  type: string
                  description: 聊天机器人的可见性状态，可以设置为“private”或“can_be_embedded”。
                onlyAllowOnAddedDomains:
                  type: boolean
                  description: 一个布尔值标志，用于启用或禁用仅在特定域上允许聊天机器人 iframe 和小部件。
                domains:
                  type: array
                  items:
                    type: string
                  description: 包含聊天机器人允许的域的字符串数组。
                ipLimit:
                  type: integer
                  description: 一台设备每秒发送的消息数量限制。
                ipLimitTimeframe:
                  type: integer
                  description: 应用消息限制的时间范围（以秒为单位）。
                ipLimitMessage:
                  type: string
                  description: 超出 IP 限制时显示的消息。
                model:
                  type: string
                  description: >-
                    聊天机器人使用的AI模型，此时可以设置为'gpt-4'或'gpt-3.5-turbo'。如果未设置，则使用聊天机器人设置中设置的模型。“gpt-4”选项仅适用于标准和无限计划。
                temp:
                  type: number
                  description: >-
                    AI模型的温度参数，范围为[0, 1]。较高的值（如 0.8）将使输出更加随机，而较低的值（如
                    0.2）将使其更加集中和确定性。
              required:
                - chatbotId
              x-apifox-orders:
                - collectCustomerInformation
                - styles
                - chatbotId
                - name
                - instructions
                - initialMessages
                - suggestedMessages
                - visibility
                - onlyAllowOnAddedDomains
                - domains
                - ipLimit
                - ipLimitTimeframe
                - ipLimitMessage
                - model
                - temp
            example:
              collectCustomerInformation:
                name:
                  label: Name
                  active: true
              styles:
                theme: dark
                userMessageColor: '#3B81F7'
                buttonColor: '#3B81F7'
                displayName: Product Hunt
                autoOpenChatWindowAfter: 4
                alignChatButton: left
              chatbotId: '[Your ChatbotID]'
              name: my Chatbot
              instructions: >-
                I want you to act as a document that I am having a conversation
                with. Your name is "AI Assistant". You will provide me with
                answers from the given info. If the answer is not included, say
                exactly "Hmm, I am not sure." and stop after that. Refuse to
                answer any question not about the info. Never break character.
              initialMessages:
                - Hi! What can I help you with?
              suggestedMessages:
                - Hi! What are you?
              visibility: private
              onlyAllowOnAddedDomains: true
              domains:
                - example.com
              ipLimit: 20
              ipLimitTimeframe: 240
              ipLimitMessage: Too many messages in a row
              model: gpt-4
              temp: 0.2
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
                x-apifox-orders: []
              example: 返回成功消息，表明聊天机器人设置已成功更新。
          headers: {}
          x-apifox-name: 成功
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
                x-apifox-orders: []
          headers: {}
          x-apifox-name: 请求有误
      security: []
      x-apifox-folder: ''
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/4195807/apis/api-157471888-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: http://dev-cn.your-api-server.com
    description: 开发环境
  - url: http://test-cn.your-api-server.com
    description: 测试环境
  - url: https://www.chatbase.co
    description: 正式环境
security: []

```
