文档

新旧版本插件转换说明

更新时间:
一键部署

随着新版插件中心的架构升级,旧版插件已不再支持。本文将介绍新旧版本插件的转换方法,帮助您将旧版插件升级为新版插件。

重要

如果您之前创建过旧版插件,并在“插件调度增强”或者“检索&插件调度增强”应用中选择使用了这些插件,请您在2024年6月30日之前将旧版插件升级并创建新的智能体API应用。智能体API应用的创建方法请看 操作说明

导出旧版插件

首先,您需要将旧版插件导出,新版插件中心提供了旧版插件导出功能。点击“一键导出所有旧版自定义插件”按钮,系统将自动下载您所有的旧版自定义插件。

image

解析旧版插件

您的旧版插件将保存为json格式,为了便于查看,您可以使用json解析工具解析这些内容。以下为样例。

[
    {
        "httpConfig": {
            "protocol": "post",
            "url": "https://domitorgreement-plugin-example-icohrkdjxy.cn-beijing.fcapp.run"
        },
        "pluginInputs": [
            {
                "description": "寝室公约第几条,用整数数字",
                "field": "article_index",
                "required": "true",
                "type": "integer",
                "valueFrom": "model"
            }
        ],
        "pluginName": "寝室公约查询工具",
        "pluginOutputs": {
            "data": {
                "description": "返回结果",
                "properties": {
                    "article": {
                        "description": "寝室公约条款",
                        "required": true,
                        "type": "string"
                    }
                },
                "required": true,
                "type": "object"
            },
            "errorInfo": {
                "description": "如果查询失败,返回失败原因,否则为空",
                "required": true,
                "type": "string"
            },
            "status": {
                "description": "调用状态,返回OK代表查询成功,否则代表查询失败",
                "required": true,
                "type": "string"
            }
        }
    }
]

创建新版插件

以下是将旧版插件字段映射到新版插件字段的方法,您可以根据该方法注册您的新插件。步骤如下:

1、创建自定义插件

在插件中心-自定义插件中,点击“新建自定义插件”按钮,进入插件创建页面。

image

2、填写插件信息

在自定义插件中,编辑插件信息,包括:

  • 插件名称:自定义插件的名称。

  • 插件ID:建议您输入具有语义的英文名称,例如:search、weather等。在您点击“创建完成”后,系统将为您生成全局唯一的插件ID。

  • 插件描述:请使用自然语言描述插件的功能,尽量给出使用示例。例如:“此插件用于获取指定时间和指定地点的天气和温度。例如杭州明天是否下雨”。 API时,请使用系统最终生成的ID。

  • 是否鉴权:当百炼调用您的自定义插件时是否进行鉴权,系统支持无鉴权、服务级鉴权和用户级鉴权三种方式。

image

新旧版本插件协议的转换方法如下。

旧版插件协议示例。

[
    {
        "httpConfig": {
            "protocol": "post",  
            "url": "https://domitorgreement-plugin-example-icohrkdjxy.cn-beijing.fcapp.run/article"
        },
        "pluginInputs": [
            {
                "description": "寝室公约第几条,用整数数字",
                "field": "article_index",
                "required": "true",
                "type": "integer",
                "valueFrom": "model"
            }
        ],
        "pluginName": "寝室公约查询工具",
        "pluginOutputs": {
            "data": {
                "description": "返回结果",
                "properties": {
                    "article": {
                        "description": "寝室公约条款",
                        "required": true,
                        "type": "string"
                    }
                },
                "required": true,
                "type": "object"
            },
            "errorInfo": {
                "description": "如果查询失败,返回失败原因,否则为空",
                "required": true,
                "type": "string"
            },
            "status": {
                "description": "调用状态,返回OK代表查询成功,否则代表查询失败",
                "required": true,
                "type": "string"
            }
        }
    }
]

新版插件协议示例(将上方协议进行映射)。

openapi: 3.0.1
info:
    title: 寝室公约查询工具
    description: 寝室公约查询工具  // 用户自己重新定义,辅助描述
    version: "v1"
servers: // url仅为请求的domain部分,具体的路由部分在paths中声明
    - url: https://domitorgreement-plugin-example-icohrkdjxy.cn-beijing.fcapp.run
paths:
    /article:
        post:
            operationId: get_article // 用户自定义,不可缺失
            summary: 查询寝室公约第几条,用整数数字
            requestBody:
                required: true
                content:
                    application/json:
                        schema:
                            type: object
                            required: [article_index] // 对应参数名称
                            properties:
                                article_index: // 对应参数名称
                                    type: integer // 对应参数类型
                                    description: 寝室公约第几条,用整数数字 // 对应参数描述
            responses:
                "200":
                    description: 查询成功
                    content:
                        application/json:
                            schema:
                                type: object
                                required: [article]
                                properties:
                                    article:
                                        type: string
                                        description: 寝室公约条款

填写好插件信息和接口信息后,点击页面下方的“创建完成”按钮,即可完成旧版插件向新版插件的迁移。

说明

新版插件支持OpenAPI v3协议对插件接口进行描述。关于OpenAPI v3的详细字段,您可以参见:OpenAPI v3.0.3

  • 本页导读 (1)
文档反馈