feat(plugin): remove schema retriction for plugin server url (#278)
This commit is contained in:
parent
30fd1b3e27
commit
c4e0e27702
|
|
@ -30,6 +30,7 @@ import (
|
|||
"github.com/coze-dev/coze-studio/backend/pkg/lang/slices"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/logs"
|
||||
"github.com/coze-dev/coze-studio/backend/types/errno"
|
||||
|
||||
"github.com/cloudwego/eino/schema"
|
||||
)
|
||||
|
||||
|
|
@ -65,10 +66,6 @@ func (ot Openapi3T) Validate(ctx context.Context) (err error) {
|
|||
return errorx.New(errno.ErrPluginInvalidOpenapi3Doc, errorx.KVf(errno.PluginMsgKey,
|
||||
"invalid server url '%s'", serverURL))
|
||||
}
|
||||
if urlSchema.Scheme != "https" {
|
||||
return errorx.New(errno.ErrPluginInvalidOpenapi3Doc, errorx.KV(errno.PluginMsgKey,
|
||||
"server url must start with 'https://'"))
|
||||
}
|
||||
if urlSchema.Host == "" {
|
||||
return errorx.New(errno.ErrPluginInvalidOpenapi3Doc, errorx.KVf(errno.PluginMsgKey,
|
||||
"invalid server url '%s'", serverURL))
|
||||
|
|
|
|||
|
|
@ -946,14 +946,10 @@ func fillManifestWithOpenapiDoc(mf *entity.PluginManifest, doc *model.Openapi3T)
|
|||
}
|
||||
|
||||
func addHTTPProtocolHeadIfNeed(url string) string {
|
||||
if strings.HasPrefix(url, "https://") {
|
||||
if strings.HasPrefix(url, "https://") || strings.HasPrefix(url, "http://") {
|
||||
return url
|
||||
}
|
||||
if strings.HasPrefix(url, "http://") {
|
||||
url = strings.Replace(url, "http://", "https://", 1)
|
||||
return url
|
||||
}
|
||||
return "https://" + url
|
||||
return "http://" + url
|
||||
}
|
||||
|
||||
func fillNecessaryInfoForOpenapi3Doc(doc *model.Openapi3T) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue