openapi: 3.1.0
info:
  title: NextConsole
  description: >-
    NextConsole
    诞生于一个坚定的信念：大语言模型将成为未来数字化生态中操作系统级别的核心IT资源。我们预见，如同操作系统统一管理硬件资源一样，企业需要一种全新的、智能化的控制台（Console）来高效调度、组织和释放大模型的无限潜能。


    NextConsole
    正是这一愿景的实践——我们不止于构建工具，更在打造下一代智能控制中枢。它让企业能够像调用计算资源一样，自然、流畅地调用和组织大模型能力，将分散的AI力量转化为可管理、可扩展、可进化的企业智能基础设施。


    在这里，大模型不再是孤立的技术组件，而是成为企业数字化的核心承载层：通过智能代理（Agents）实现认知决策，通过知识库（Knowledge
    Base）沉淀集体智慧，通过工作流（Workflows）编排复杂业务逻辑——这一切都在统一的控制台中无缝协同。


    NextConsole，让每个组织都能站在智能时代的前沿，真正将大模型转化为驱动业务创新的核心操作系统。释放大语言模型赋能企业的无限潜力 
  version: 1.0.0
tags:
  - name: NextConsole
  - name: 用户API
  - name: AI工作台API
  - name: AI资源库API
x-tagGroups:
  - name: NextConsole
    tags:
      - 用户
      - ai工作台
      - ai资源库
      - 通讯录
      - ai应用工厂
paths:
  /next_console/login_by_password:
    post:
      summary: 密码登录
      deprecated: false
      description: |-
        ## 功能说明
        通过账号密码进行用户认证，成功登录后返回访问令牌和用户信息

        ## 安全要求
        1. 密码必须在前端进行SHA256哈希加密后传输
        2. 建议配合HTTPS协议使用
        3. 禁止明文传输密码

        ## 加密示例
        **JavaScript示例**:
        ```javascript
        // 使用CryptoJS进行SHA256加密
        const encryptedPassword = CryptoJS.SHA256(rawPassword.trim()).toString()
        ```

        **Python示例**:
        ```python
        # 使用hashlib进行SHA256加密
        import hashlib
        def encrypt_password(raw_password: str) -> str:
          return hashlib.sha256(raw_password.strip().encode('utf-8')).hexdigest()
        ```
      tags:
        - 用户
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user_account:
                  type: string
                  title: 用户账号
                  description: 手机号或者邮箱
                user_password:
                  type: string
                  title: 用户密码
                  description: SHA256哈希加密后的密码字符串
                session_30_flag:
                  type: boolean
                  title: 记住30天
                  description: 启用后过期时间延长至30天
              required:
                - user_account
                - user_password
            example:
              user_account: pariatur Excepteur mollit adipisicing
              user_password: u_OJ2XloK6D8xSu
              session_30_flag: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error_code:
                    type: integer
                    title: 错误码
                  error_message:
                    type: string
                    title: 错误消息
                  error_status:
                    type: boolean
                    title: 错误状态
                  result:
                    type: object
                    properties:
                      expire_time:
                        type: string
                        title: 超时时间
                      token:
                        type: string
                        title: 令牌
                      userinfo:
                        type: object
                        properties:
                          create_time:
                            type: string
                            title: 创建时间
                          last_login_time:
                            type: string
                            title: 上次登录时间
                          update_time:
                            type: string
                            title: 更新时间
                          user_account_type:
                            type: string
                            title: 账户类型
                          user_age:
                            type: integer
                            title: 年龄
                          user_area:
                            type: 'null'
                            title: 区域
                          user_avatar:
                            type: string
                            title: 头像
                          user_code:
                            type: string
                            title: 用户编号
                          user_company:
                            type: string
                            title: 公司
                          user_department:
                            type: string
                            title: 部门
                          user_email:
                            type: string
                            title: 邮箱
                          user_expire_time:
                            type: string
                            title: 过期时间
                          user_gender:
                            type: string
                            title: 性别
                          user_id:
                            type: integer
                            title: ID
                          user_invite_code:
                            type: string
                            title: 邀请码
                          user_name:
                            type: string
                            title: 名称
                          user_nick_name:
                            type: string
                            title: 昵称
                          user_nick_name_py:
                            type: string
                            title: 昵称拼音
                          user_phone:
                            type: string
                            title: 手机
                          user_position:
                            type: string
                            title: 职位
                          user_resource_limit:
                            type: integer
                            title: 资源上限
                          user_role:
                            type: array
                            items:
                              type: string
                            title: 用户角色
                          user_source:
                            type: string
                            title: 用户来源
                          user_status:
                            type: integer
                            title: 用户状态
                          user_wx_avatar:
                            type: string
                            title: 微信头像
                          user_wx_nickname:
                            type: string
                            title: 微信昵称
                          user_wx_openid:
                            type: string
                            title: 微信id
                          user_wx_union_id:
                            type: string
                            title: 微信联合id
                        required:
                          - create_time
                          - last_login_time
                          - update_time
                          - user_account_type
                          - user_age
                          - user_area
                          - user_avatar
                          - user_code
                          - user_company
                          - user_department
                          - user_email
                          - user_expire_time
                          - user_gender
                          - user_id
                          - user_invite_code
                          - user_name
                          - user_nick_name
                          - user_nick_name_py
                          - user_phone
                          - user_position
                          - user_resource_limit
                          - user_role
                          - user_source
                          - user_status
                          - user_wx_avatar
                          - user_wx_nickname
                          - user_wx_openid
                          - user_wx_union_id
                        title: 用户信息
                    required:
                      - expire_time
                      - token
                      - userinfo
                    title: 返回结果
                required:
                  - error_code
                  - error_message
                  - error_status
                  - result
              examples:
                '1':
                  summary: 异常示例
                  value:
                    error_code: 401
                    error_message: 账号或者密码错误！
                    error_status: true
                    result: null
                '2':
                  summary: 成功示例
                  value:
                    error_code: 0
                    error_message: ''
                    error_status: false
                    result:
                      expire_time: '2025-09-15 07:18:38'
                      token: >-
                        eyJhbGciOiJIUzImFtZSI6WyJ1c2VyIiwic3VwZXJfYWRtaW4iLCJuZXh0X2NvbnNvbGVfYWRtaW4iXSwidXNlcl9jb2RlIjoiYTE1YzQ2YTktYjMxOC00YTZiLTlkM2ItMTJjMWZkNjgwMDAzIn0.8OlaWIgGv9OWAnxKxhBdcibR885l67LMuX5BhGw5jVY
                      userinfo:
                        create_time: '2025-03-16 22:49:37'
                        last_login_time: '2025-09-08 15:18:25'
                        update_time: '2025-09-08 15:18:25'
                        user_account_type: 企业账号
                        user_age: 18
                        user_area: null
                        user_avatar: ''
                        user_code: a15c46a9-b318-4a6b-9d3b-
                        user_company: ''
                        user_department: ''
                        user_email: ''
                        user_expire_time: '2999-01-01 00:00:00'
                        user_gender: 男
                        user_id: 1678
                        user_invite_code: a15c46a9-b318-4a6b-9d3b-12c1fd680003
                        user_name: ''
                        user_nick_name: calvin
                        user_nick_name_py: CAL
                        user_phone: ''
                        user_position: ''
                        user_resource_limit: 20480
                        user_role:
                          - user
                          - super_admin
                          - next_console_admin
                        user_source: phone
                        user_status: 1
                        user_wx_avatar: ''
                        user_wx_nickname: ''
                        user_wx_openid: ''
                        user_wx_union_id: ''
          headers: {}
      security: []
  /next_console/user_center/users/get:
    post:
      summary: 获取用户详情
      deprecated: false
      description: ''
      tags:
        - 用户
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties: {}
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error_code:
                    type: integer
                  error_message:
                    type: string
                  error_status:
                    type: boolean
                  result:
                    type: object
                    properties:
                      create_time:
                        type: string
                      last_login_time:
                        type: string
                      update_time:
                        type: string
                      user_account_type:
                        type: string
                      user_age:
                        type: integer
                      user_area:
                        type: 'null'
                      user_avatar:
                        type: string
                      user_code:
                        type: string
                      user_company:
                        type: string
                      user_company_id:
                        type: integer
                      user_department:
                        type: string
                      user_department_id:
                        type: integer
                      user_email:
                        type: string
                      user_expire_time:
                        type: string
                      user_gender:
                        type: string
                      user_id:
                        type: integer
                      user_invite_code:
                        type: string
                      user_name:
                        type: string
                      user_nick_name:
                        type: string
                      user_nick_name_py:
                        type: string
                      user_phone:
                        type: string
                      user_point_account:
                        type: object
                        properties:
                          account_id:
                            type: string
                          account_status:
                            type: string
                          account_type:
                            type: string
                          balance:
                            type: integer
                          create_time:
                            type: string
                          frozen_balance:
                            type: integer
                          id:
                            type: integer
                          update_time:
                            type: string
                          user_id:
                            type: integer
                        required:
                          - account_id
                          - account_status
                          - account_type
                          - balance
                          - create_time
                          - frozen_balance
                          - id
                          - update_time
                          - user_id
                      user_position:
                        type: string
                      user_resource_limit:
                        type: integer
                      user_role:
                        type: array
                        items:
                          type: string
                      user_source:
                        type: string
                      user_status:
                        type: integer
                      user_wx_avatar:
                        type: string
                      user_wx_nickname:
                        type: string
                      user_wx_openid:
                        type: string
                      user_wx_union_id:
                        type: string
                    required:
                      - create_time
                      - last_login_time
                      - update_time
                      - user_account_type
                      - user_age
                      - user_area
                      - user_avatar
                      - user_code
                      - user_company
                      - user_company_id
                      - user_department
                      - user_department_id
                      - user_email
                      - user_expire_time
                      - user_gender
                      - user_id
                      - user_invite_code
                      - user_name
                      - user_nick_name
                      - user_nick_name_py
                      - user_phone
                      - user_point_account
                      - user_position
                      - user_resource_limit
                      - user_role
                      - user_source
                      - user_status
                      - user_wx_avatar
                      - user_wx_nickname
                      - user_wx_openid
                      - user_wx_union_id
                required:
                  - error_code
                  - error_message
                  - error_status
                  - result
          headers: {}
      security: []
  /next_console/user_center/users/update:
    post:
      summary: 更新用户信息
      deprecated: false
      description: 更新用户相关信息（部分字段锁定不可以更新）
      tags:
        - 用户
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user_nick_name:
                  type: string
              required:
                - user_nick_name
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
      security: []
  /next_console/user_center/users/close:
    post:
      summary: 注销用户
      deprecated: false
      description: 将用户信息从平台彻底删除
      tags:
        - 用户
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
      security: []
  /next_console/user_center/refresh_token:
    post:
      summary: 刷新Token
      deprecated: false
      description: 创建一个指定超时时间的令牌
      tags:
        - 用户
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                expire_time:
                  type: string
                  title: 指定超时时间
                  description: 支持格式 %Y-%m-%d %H:%M:%S
              required:
                - expire_time
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
      security: []
  /next_console/app_center/app_run/init_session:
    post:
      summary: 创建智能应用会话
      deprecated: false
      description: 调用发布完成的应用前，需要调用此接口，创建一个应用会话。
      tags:
        - ai工作台
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                app_code:
                  type: string
                  title: 应用编号
                  description: 发布的应用编号
                session_code:
                  type: string
                  title: 会话编号
                  description: 默认为空则新建会话，否则获取指定会话信息
              required:
                - app_code
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error_code:
                    type: integer
                  error_message:
                    type: string
                  error_status:
                    type: boolean
                  result:
                    type: object
                    properties:
                      create_time:
                        type: string
                      id:
                        type: integer
                      session_assistant_id:
                        type: integer
                      session_attachment_file_switch:
                        type: boolean
                      session_attachment_image_switch:
                        type: boolean
                      session_attachment_webpage_switch:
                        type: boolean
                      session_cancel_reason:
                        type: 'null'
                      session_code:
                        type: string
                      session_customer_evaluation:
                        type: 'null'
                      session_customer_score:
                        type: 'null'
                      session_dislike_cnt:
                        type: integer
                      session_evaluation_close:
                        type: boolean
                      session_favorite:
                        type: boolean
                      session_like_cnt:
                        type: integer
                      session_llm_code:
                        type: string
                      session_local_resource_switch:
                        type: boolean
                      session_local_resource_use_all:
                        type: boolean
                      session_remark:
                        type: integer
                      session_search_engine_language_type:
                        type: object
                        properties: {}
                      session_search_engine_resource_type:
                        type: string
                      session_search_engine_switch:
                        type: boolean
                      session_share_cnt:
                        type: integer
                      session_shop_assistant_id:
                        type: 'null'
                      session_source:
                        type: string
                      session_status:
                        type: string
                      session_task_id:
                        type: 'null'
                      session_task_params:
                        type: 'null'
                      session_task_params_schema:
                        type: 'null'
                      session_task_type:
                        type: 'null'
                      session_topic:
                        type: string
                      session_update_cnt:
                        type: integer
                      session_vis:
                        type: boolean
                      update_time:
                        type: string
                      user_id:
                        type: integer
                    required:
                      - create_time
                      - id
                      - session_assistant_id
                      - session_attachment_file_switch
                      - session_attachment_image_switch
                      - session_attachment_webpage_switch
                      - session_cancel_reason
                      - session_code
                      - session_customer_evaluation
                      - session_customer_score
                      - session_dislike_cnt
                      - session_evaluation_close
                      - session_favorite
                      - session_like_cnt
                      - session_llm_code
                      - session_local_resource_switch
                      - session_local_resource_use_all
                      - session_remark
                      - session_search_engine_language_type
                      - session_search_engine_resource_type
                      - session_search_engine_switch
                      - session_share_cnt
                      - session_shop_assistant_id
                      - session_source
                      - session_status
                      - session_task_id
                      - session_task_params
                      - session_task_params_schema
                      - session_task_type
                      - session_topic
                      - session_update_cnt
                      - session_vis
                      - update_time
                      - user_id
                required:
                  - error_code
                  - error_message
                  - error_status
                  - result
              example:
                error_code: 0
                error_message: ''
                error_status: false
                result:
                  create_time: '2025-07-18 18:03:01'
                  id: 151850
                  session_assistant_id: -12345
                  session_attachment_file_switch: false
                  session_attachment_image_switch: false
                  session_attachment_webpage_switch: false
                  session_cancel_reason: null
                  session_code: a2a928257f1e84f346
                  session_customer_evaluation: null
                  session_customer_score: null
                  session_dislike_cnt: 0
                  session_evaluation_close: false
                  session_favorite: false
                  session_like_cnt: 0
                  session_llm_code: ddea5407-39-43-83e
                  session_local_resource_switch: false
                  session_local_resource_use_all: false
                  session_remark: 0
                  session_search_engine_language_type: {}
                  session_search_engine_resource_type: search
                  session_search_engine_switch: false
                  session_share_cnt: 0
                  session_shop_assistant_id: null
                  session_source: 0cc8da68-7050-4d1b-9663-11099e28b2e5
                  session_status: 正常
                  session_task_id: null
                  session_task_params: null
                  session_task_params_schema: null
                  session_task_type: null
                  session_topic: AI巡检 会话
                  session_update_cnt: 0
                  session_vis: true
                  update_time: '2025-07-18 18:03:01'
                  user_id: 1678
          headers: {}
      security: []
  /next_console/app_center/app_run/v2/chat/completions:
    post:
      summary: 智能应用问答
      deprecated: false
      description: |-
        支持直接用openai客户端进行调用，如同调用一个大模型服务。

        python示例如下

        ```python

        url = "https://www.turingops.com.cn/next_console/app_center/app_run/v2"

        headers = {
            "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTc1MzQzNTk4OCwianRpIjoiNzQzNDViMjktZGZhYy00ZWF"
        }

        data = {
            "app_code": "222b0cc1-8e8c-4b55-bf1b-689afdb4bcc6",
            "session_code": case_session_code,
            "messages": [{"role": "user", "content": "审批"}],
            "stream": True, "attachments": []
        }

        client = OpenAI(base_url=url, api_key='None')
        response = client.chat.completions.create(
                model="",
                messages=data["messages"],
                stream=data["stream"],
                extra_headers=headers,
                extra_body=data,
            )
            for chunk in response:
                try:
                    # print(chunk.choices[0].delta.reason_content)
                    if chunk.choices[0].delta.reason_content:
                        result += chunk.choices[0].delta.reason_content
                except Exception as e:
                    pass
                try:
                    # print(chunk.choices[0].delta.content)
                    if chunk.choices[0].delta.content:
                        result += chunk.choices[0].delta.content
                except Exception as e:
                    pass
        print(f"Result : {result}")

        ```
      tags:
        - ai工作台
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                app_code:
                  type: string
                  title: 应用ID
                messages:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        title: 角色
                      content:
                        type: string
                        title: 内容
                    required:
                      - role
                      - content
                  title: 消息列表
                session_code:
                  type: string
                  title: 会话编号
                  description: 输入，则在指定会话中继续问答，否则新增会话问答
                workflow_params:
                  type: object
                  properties: {}
                  title: 工作流参数
                  description: 根据定义输入
              required:
                - app_code
                - messages
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
      security: []
  /next_console/resources/upload:
    post:
      summary: 上传资源
      deprecated: false
      description: 上传各类资源至AI资源库，默认配置下会自动构建向量
      tags:
        - ai资源库
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                data:
                  format: binary
                  type: string
                  description: 资源
                  example: ''
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    title: 资源id
                  name:
                    type: string
                    title: 资源名称
                  url:
                    type: string
                    title: 资源地址
                required:
                  - id
                  - name
                  - url
          headers: {}
      security: []
  /next_console/resources/object/delete:
    post:
      summary: 删除资源
      deprecated: false
      description: 删除指定资源
      tags:
        - ai资源库
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                resource_id:
                  type: number
                  title: 资源id
              required:
                - resource_id
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  delete_cnt:
                    type: number
                required:
                  - delete_cnt
          headers: {}
      security: []
  /next_console/resources/search_by_resource_keyword:
    post:
      summary: 搜索资源
      deprecated: false
      description: 搜索资源，默认启用rag技术进行搜索
      tags:
        - ai资源库
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                resource_keyword:
                  type: string
                  title: 搜索关键词
                rag_enhance:
                  type: boolean
                  default: true
                  title: rag搜索开关
                page_size:
                  type: integer
                  title: 分页数
                  default: 50
                page_num:
                  type: integer
                  title: 页码
                  default: 1
              required:
                - resource_keyword
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties: {}
                    title: 结果列表
                  author_info:
                    type: array
                    items:
                      type: object
                      properties: {}
                    title: 作者信息
                  total:
                    type: string
                    title: 结果数
                required:
                  - data
                  - author_info
                  - total
          headers: {}
      security: []
  /next_console/resources/object/download:
    post:
      summary: 下载资源
      deprecated: false
      description: 获取指定资源的下载地址
      tags:
        - ai资源库
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                resource_id:
                  type: string
                  title: 资源id
              required:
                - resource_id
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  download_url:
                    type: string
                    title: 下载地址
                required:
                  - download_url
          headers: {}
      security: []
  /next_console/resources/ref/rebuild:
    post:
      summary: 构建资源向量
      deprecated: false
      description: |-
        手动触发向量构建，重复调用，会清空之前的向量数据并启动一次新的重构任务。

        可传入资源列表
      tags:
        - ai资源库
      parameters:
        - name: Authorization
          in: header
          description: ''
          example: Bearer {{token}}
          schema:
            type: string
            default: Bearer {{token}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                resource_list:
                  type: array
                  items:
                    type: number
                    description: 资源id
                  title: 资源id清单
              required:
                - resource_list
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  build_cnt:
                    type: integer
                required:
                  - build_cnt
          headers: {}
      security: []
webhooks: {}
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://www.turingops.com.cn
    description: 正式环境
security: []
