fix: agent publish error (#2373)

This commit is contained in:
junwen-lee
2025-10-22 16:29:32 +08:00
committed by GitHub
parent fa4f925217
commit 47e646f86e
12 changed files with 31 additions and 85 deletions

View File

@ -26,21 +26,19 @@ const TableNamePlugin = "plugin"
// Plugin Latest Plugin
type Plugin struct {
ID int64 `gorm:"column:id;primaryKey;comment:Plugin ID" json:"id"` // Plugin ID
SpaceID int64 `gorm:"column:space_id;not null;comment:Space ID" json:"space_id"` // Space ID
DeveloperID int64 `gorm:"column:developer_id;not null;comment:Developer ID" json:"developer_id"` // Developer ID
AppID int64 `gorm:"column:app_id;not null;comment:Application ID" json:"app_id"` // Application ID
IconURI string `gorm:"column:icon_uri;not null;comment:Icon URI" json:"icon_uri"` // Icon URI
ServerURL string `gorm:"column:server_url;not null;comment:Server URL" json:"server_url"` // Server URL
PluginType int32 `gorm:"column:plugin_type;not null;comment:Plugin Type, 1:http, 6:local" json:"plugin_type"` // Plugin Type, 1:http, 6:local
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
UpdatedAt int64 `gorm:"column:updated_at;not null;autoUpdateTime:milli;comment:Update Time in Milliseconds" json:"updated_at"` // Update Time in Milliseconds
Version string `gorm:"column:version;not null;comment:Plugin Version, e.g. v1.0.0" json:"version"` // Plugin Version, e.g. v1.0.0
VersionDesc string `gorm:"column:version_desc;comment:Plugin Version Description" json:"version_desc"` // Plugin Version Description
Manifest *model.PluginManifest `gorm:"column:manifest;comment:Plugin Manifest;serializer:json" json:"manifest"` // Plugin Manifest
OpenapiDoc *model.Openapi3T `gorm:"column:openapi_doc;comment:OpenAPI Document, only stores the root;serializer:json" json:"openapi_doc"` // OpenAPI Document, only stores the root
Source int32 `gorm:"column:source;not null;comment:plugin source 1 from saas 0 default" json:"source"` // plugin source 1 from saas 0 default
Ext map[string]interface{} `gorm:"column:ext;comment:extra ;serializer:json" json:"ext"` // extra
ID int64 `gorm:"column:id;primaryKey;comment:Plugin ID" json:"id"` // Plugin ID
SpaceID int64 `gorm:"column:space_id;not null;comment:Space ID" json:"space_id"` // Space ID
DeveloperID int64 `gorm:"column:developer_id;not null;comment:Developer ID" json:"developer_id"` // Developer ID
AppID int64 `gorm:"column:app_id;not null;comment:Application ID" json:"app_id"` // Application ID
IconURI string `gorm:"column:icon_uri;not null;comment:Icon URI" json:"icon_uri"` // Icon URI
ServerURL string `gorm:"column:server_url;not null;comment:Server URL" json:"server_url"` // Server URL
PluginType int32 `gorm:"column:plugin_type;not null;comment:Plugin Type, 1:http, 6:local" json:"plugin_type"` // Plugin Type, 1:http, 6:local
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
UpdatedAt int64 `gorm:"column:updated_at;not null;autoUpdateTime:milli;comment:Update Time in Milliseconds" json:"updated_at"` // Update Time in Milliseconds
Version string `gorm:"column:version;not null;comment:Plugin Version, e.g. v1.0.0" json:"version"` // Plugin Version, e.g. v1.0.0
VersionDesc string `gorm:"column:version_desc;comment:Plugin Version Description" json:"version_desc"` // Plugin Version Description
Manifest *model.PluginManifest `gorm:"column:manifest;comment:Plugin Manifest;serializer:json" json:"manifest"` // Plugin Manifest
OpenapiDoc *model.Openapi3T `gorm:"column:openapi_doc;comment:OpenAPI Document, only stores the root;serializer:json" json:"openapi_doc"` // OpenAPI Document, only stores the root
}
// TableName Plugin's table name

View File

@ -29,22 +29,20 @@ const TableNamePluginVersion = "plugin_version"
// PluginVersion Plugin Version
type PluginVersion struct {
ID int64 `gorm:"column:id;primaryKey;comment:Primary Key ID" json:"id"` // Primary Key ID
SpaceID int64 `gorm:"column:space_id;not null;comment:Space ID" json:"space_id"` // Space ID
DeveloperID int64 `gorm:"column:developer_id;not null;comment:Developer ID" json:"developer_id"` // Developer ID
PluginID int64 `gorm:"column:plugin_id;not null;comment:Plugin ID" json:"plugin_id"` // Plugin ID
AppID int64 `gorm:"column:app_id;not null;comment:Application ID" json:"app_id"` // Application ID
IconURI string `gorm:"column:icon_uri;not null;comment:Icon URI" json:"icon_uri"` // Icon URI
ServerURL string `gorm:"column:server_url;not null;comment:Server URL" json:"server_url"` // Server URL
PluginType int32 `gorm:"column:plugin_type;not null;comment:Plugin Type, 1:http, 6:local" json:"plugin_type"` // Plugin Type, 1:http, 6:local
Version string `gorm:"column:version;not null;comment:Plugin Version, e.g. v1.0.0" json:"version"` // Plugin Version, e.g. v1.0.0
VersionDesc string `gorm:"column:version_desc;comment:Plugin Version Description" json:"version_desc"` // Plugin Version Description
Manifest *model.PluginManifest `gorm:"column:manifest;comment:Plugin Manifest;serializer:json" json:"manifest"` // Plugin Manifest
OpenapiDoc *model.Openapi3T `gorm:"column:openapi_doc;comment:OpenAPI Document, only stores the root;serializer:json" json:"openapi_doc"` // OpenAPI Document, only stores the root
Source int32 `gorm:"column:source;not null;comment:plugin source 1 from saas 0 default" json:"source"` // plugin source 1 from saas 0 default
Ext map[string]interface{} `gorm:"column:ext;comment:extra ;serializer:json" json:"ext"` // extra
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:Delete Time" json:"deleted_at"` // Delete Time
ID int64 `gorm:"column:id;primaryKey;comment:Primary Key ID" json:"id"` // Primary Key ID
SpaceID int64 `gorm:"column:space_id;not null;comment:Space ID" json:"space_id"` // Space ID
DeveloperID int64 `gorm:"column:developer_id;not null;comment:Developer ID" json:"developer_id"` // Developer ID
PluginID int64 `gorm:"column:plugin_id;not null;comment:Plugin ID" json:"plugin_id"` // Plugin ID
AppID int64 `gorm:"column:app_id;not null;comment:Application ID" json:"app_id"` // Application ID
IconURI string `gorm:"column:icon_uri;not null;comment:Icon URI" json:"icon_uri"` // Icon URI
ServerURL string `gorm:"column:server_url;not null;comment:Server URL" json:"server_url"` // Server URL
PluginType int32 `gorm:"column:plugin_type;not null;comment:Plugin Type, 1:http, 6:local" json:"plugin_type"` // Plugin Type, 1:http, 6:local
Version string `gorm:"column:version;not null;comment:Plugin Version, e.g. v1.0.0" json:"version"` // Plugin Version, e.g. v1.0.0
VersionDesc string `gorm:"column:version_desc;comment:Plugin Version Description" json:"version_desc"` // Plugin Version Description
Manifest *model.PluginManifest `gorm:"column:manifest;comment:Plugin Manifest;serializer:json" json:"manifest"` // Plugin Manifest
OpenapiDoc *model.Openapi3T `gorm:"column:openapi_doc;comment:OpenAPI Document, only stores the root;serializer:json" json:"openapi_doc"` // OpenAPI Document, only stores the root
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:Delete Time" json:"deleted_at"` // Delete Time
}
// TableName PluginVersion's table name

View File

@ -35,8 +35,6 @@ type Tool struct {
Method string `gorm:"column:method;not null;comment:HTTP Request Method" json:"method"` // HTTP Request Method
Operation *model.Openapi3Operation `gorm:"column:operation;comment:Tool Openapi Operation Schema;serializer:json" json:"operation"` // Tool Openapi Operation Schema
ActivatedStatus int32 `gorm:"column:activated_status;not null;comment:0:activated; 1:deactivated" json:"activated_status"` // 0:activated; 1:deactivated
Source int32 `gorm:"column:source;not null;comment:tool source 1 coze saas 0 default" json:"source"` // tool source 1 coze saas 0 default
Ext map[string]interface{} `gorm:"column:ext;comment:extra;serializer:json" json:"ext"` // extra
}
// TableName Tool's table name

View File

@ -38,8 +38,6 @@ type ToolVersion struct {
Operation *model.Openapi3Operation `gorm:"column:operation;comment:Tool Openapi Operation Schema;serializer:json" json:"operation"` // Tool Openapi Operation Schema
CreatedAt int64 `gorm:"column:created_at;not null;autoCreateTime:milli;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:Delete Time" json:"deleted_at"` // Delete Time
Source int32 `gorm:"column:source;not null;comment:tool source 1 coze saas 0 default" json:"source"` // tool source 1 coze saas 0 default
Ext map[string]interface{} `gorm:"column:ext;comment:extra;serializer:json" json:"ext"` // extra
}
// TableName ToolVersion's table name

View File

@ -25,7 +25,6 @@ import (
"gorm.io/gen/field"
"gorm.io/gorm"
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
plugin_develop_common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
pluginModel "github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/model"
"github.com/coze-dev/coze-studio/backend/domain/plugin/dto"
@ -64,8 +63,6 @@ func (p pluginPO) ToDO() *entity.PluginInfo {
VersionDesc: &p.VersionDesc,
Manifest: p.Manifest,
OpenapiDoc: p.OpenapiDoc,
Source: bot_common.PluginFromPtr(bot_common.PluginFrom(p.Source)),
Extra: p.Ext,
})
}

View File

@ -24,7 +24,6 @@ import (
"gorm.io/gen/field"
"gorm.io/gorm"
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
plugin_develop_common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
pluginModel "github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/model"
"github.com/coze-dev/coze-studio/backend/domain/plugin/dto"
@ -63,8 +62,6 @@ func (p pluginVersionPO) ToDO() *entity.PluginInfo {
VersionDesc: &p.VersionDesc,
Manifest: p.Manifest,
OpenapiDoc: p.OpenapiDoc,
Source: bot_common.PluginFromPtr(bot_common.PluginFrom(p.Source)),
Extra: p.Ext,
})
}

View File

@ -56,8 +56,6 @@ func newPlugin(db *gorm.DB, opts ...gen.DOOption) plugin {
_plugin.VersionDesc = field.NewString(tableName, "version_desc")
_plugin.Manifest = field.NewField(tableName, "manifest")
_plugin.OpenapiDoc = field.NewField(tableName, "openapi_doc")
_plugin.Source = field.NewInt32(tableName, "source")
_plugin.Ext = field.NewField(tableName, "ext")
_plugin.fillFieldMap()
@ -82,8 +80,6 @@ type plugin struct {
VersionDesc field.String // Plugin Version Description
Manifest field.Field // Plugin Manifest
OpenapiDoc field.Field // OpenAPI Document, only stores the root
Source field.Int32 // plugin source 1 from saas 0 default
Ext field.Field // extra
fieldMap map[string]field.Expr
}
@ -113,8 +109,6 @@ func (p *plugin) updateTableName(table string) *plugin {
p.VersionDesc = field.NewString(table, "version_desc")
p.Manifest = field.NewField(table, "manifest")
p.OpenapiDoc = field.NewField(table, "openapi_doc")
p.Source = field.NewInt32(table, "source")
p.Ext = field.NewField(table, "ext")
p.fillFieldMap()
@ -131,7 +125,7 @@ func (p *plugin) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
}
func (p *plugin) fillFieldMap() {
p.fieldMap = make(map[string]field.Expr, 15)
p.fieldMap = make(map[string]field.Expr, 13)
p.fieldMap["id"] = p.ID
p.fieldMap["space_id"] = p.SpaceID
p.fieldMap["developer_id"] = p.DeveloperID
@ -145,8 +139,6 @@ func (p *plugin) fillFieldMap() {
p.fieldMap["version_desc"] = p.VersionDesc
p.fieldMap["manifest"] = p.Manifest
p.fieldMap["openapi_doc"] = p.OpenapiDoc
p.fieldMap["source"] = p.Source
p.fieldMap["ext"] = p.Ext
}
func (p plugin) clone(db *gorm.DB) plugin {

View File

@ -55,8 +55,6 @@ func newPluginVersion(db *gorm.DB, opts ...gen.DOOption) pluginVersion {
_pluginVersion.VersionDesc = field.NewString(tableName, "version_desc")
_pluginVersion.Manifest = field.NewField(tableName, "manifest")
_pluginVersion.OpenapiDoc = field.NewField(tableName, "openapi_doc")
_pluginVersion.Source = field.NewInt32(tableName, "source")
_pluginVersion.Ext = field.NewField(tableName, "ext")
_pluginVersion.CreatedAt = field.NewInt64(tableName, "created_at")
_pluginVersion.DeletedAt = field.NewField(tableName, "deleted_at")
@ -82,8 +80,6 @@ type pluginVersion struct {
VersionDesc field.String // Plugin Version Description
Manifest field.Field // Plugin Manifest
OpenapiDoc field.Field // OpenAPI Document, only stores the root
Source field.Int32 // plugin source 1 from saas 0 default
Ext field.Field // extra
CreatedAt field.Int64 // Create Time in Milliseconds
DeletedAt field.Field // Delete Time
@ -114,8 +110,6 @@ func (p *pluginVersion) updateTableName(table string) *pluginVersion {
p.VersionDesc = field.NewString(table, "version_desc")
p.Manifest = field.NewField(table, "manifest")
p.OpenapiDoc = field.NewField(table, "openapi_doc")
p.Source = field.NewInt32(table, "source")
p.Ext = field.NewField(table, "ext")
p.CreatedAt = field.NewInt64(table, "created_at")
p.DeletedAt = field.NewField(table, "deleted_at")
@ -134,7 +128,7 @@ func (p *pluginVersion) GetFieldByName(fieldName string) (field.OrderExpr, bool)
}
func (p *pluginVersion) fillFieldMap() {
p.fieldMap = make(map[string]field.Expr, 16)
p.fieldMap = make(map[string]field.Expr, 14)
p.fieldMap["id"] = p.ID
p.fieldMap["space_id"] = p.SpaceID
p.fieldMap["developer_id"] = p.DeveloperID
@ -147,8 +141,6 @@ func (p *pluginVersion) fillFieldMap() {
p.fieldMap["version_desc"] = p.VersionDesc
p.fieldMap["manifest"] = p.Manifest
p.fieldMap["openapi_doc"] = p.OpenapiDoc
p.fieldMap["source"] = p.Source
p.fieldMap["ext"] = p.Ext
p.fieldMap["created_at"] = p.CreatedAt
p.fieldMap["deleted_at"] = p.DeletedAt
}

View File

@ -52,8 +52,6 @@ func newTool(db *gorm.DB, opts ...gen.DOOption) tool {
_tool.Method = field.NewString(tableName, "method")
_tool.Operation = field.NewField(tableName, "operation")
_tool.ActivatedStatus = field.NewInt32(tableName, "activated_status")
_tool.Source = field.NewInt32(tableName, "source")
_tool.Ext = field.NewField(tableName, "ext")
_tool.fillFieldMap()
@ -74,8 +72,6 @@ type tool struct {
Method field.String // HTTP Request Method
Operation field.Field // Tool Openapi Operation Schema
ActivatedStatus field.Int32 // 0:activated; 1:deactivated
Source field.Int32 // tool source 1 coze saas 0 default
Ext field.Field // extra
fieldMap map[string]field.Expr
}
@ -101,8 +97,6 @@ func (t *tool) updateTableName(table string) *tool {
t.Method = field.NewString(table, "method")
t.Operation = field.NewField(table, "operation")
t.ActivatedStatus = field.NewInt32(table, "activated_status")
t.Source = field.NewInt32(table, "source")
t.Ext = field.NewField(table, "ext")
t.fillFieldMap()
@ -119,7 +113,7 @@ func (t *tool) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
}
func (t *tool) fillFieldMap() {
t.fieldMap = make(map[string]field.Expr, 11)
t.fieldMap = make(map[string]field.Expr, 9)
t.fieldMap["id"] = t.ID
t.fieldMap["plugin_id"] = t.PluginID
t.fieldMap["created_at"] = t.CreatedAt
@ -129,8 +123,6 @@ func (t *tool) fillFieldMap() {
t.fieldMap["method"] = t.Method
t.fieldMap["operation"] = t.Operation
t.fieldMap["activated_status"] = t.ActivatedStatus
t.fieldMap["source"] = t.Source
t.fieldMap["ext"] = t.Ext
}
func (t tool) clone(db *gorm.DB) tool {

View File

@ -52,8 +52,6 @@ func newToolVersion(db *gorm.DB, opts ...gen.DOOption) toolVersion {
_toolVersion.Operation = field.NewField(tableName, "operation")
_toolVersion.CreatedAt = field.NewInt64(tableName, "created_at")
_toolVersion.DeletedAt = field.NewField(tableName, "deleted_at")
_toolVersion.Source = field.NewInt32(tableName, "source")
_toolVersion.Ext = field.NewField(tableName, "ext")
_toolVersion.fillFieldMap()
@ -74,8 +72,6 @@ type toolVersion struct {
Operation field.Field // Tool Openapi Operation Schema
CreatedAt field.Int64 // Create Time in Milliseconds
DeletedAt field.Field // Delete Time
Source field.Int32 // tool source 1 coze saas 0 default
Ext field.Field // extra
fieldMap map[string]field.Expr
}
@ -101,8 +97,6 @@ func (t *toolVersion) updateTableName(table string) *toolVersion {
t.Operation = field.NewField(table, "operation")
t.CreatedAt = field.NewInt64(table, "created_at")
t.DeletedAt = field.NewField(table, "deleted_at")
t.Source = field.NewInt32(table, "source")
t.Ext = field.NewField(table, "ext")
t.fillFieldMap()
@ -119,7 +113,7 @@ func (t *toolVersion) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
}
func (t *toolVersion) fillFieldMap() {
t.fieldMap = make(map[string]field.Expr, 11)
t.fieldMap = make(map[string]field.Expr, 9)
t.fieldMap["id"] = t.ID
t.fieldMap["tool_id"] = t.ToolID
t.fieldMap["plugin_id"] = t.PluginID
@ -129,8 +123,6 @@ func (t *toolVersion) fillFieldMap() {
t.fieldMap["operation"] = t.Operation
t.fieldMap["created_at"] = t.CreatedAt
t.fieldMap["deleted_at"] = t.DeletedAt
t.fieldMap["source"] = t.Source
t.fieldMap["ext"] = t.Ext
}
func (t toolVersion) clone(db *gorm.DB) toolVersion {

View File

@ -24,7 +24,6 @@ import (
"gorm.io/gen/field"
"gorm.io/gorm"
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/consts"
"github.com/coze-dev/coze-studio/backend/domain/plugin/entity"
"github.com/coze-dev/coze-studio/backend/domain/plugin/internal/dal/model"
@ -59,9 +58,6 @@ func (t toolPO) ToDO() *entity.ToolInfo {
Method: ptr.Of(t.Method),
Operation: t.Operation,
ActivatedStatus: ptr.Of(consts.ActivatedStatus(t.ActivatedStatus)),
Source: bot_common.PluginFromPtr(bot_common.PluginFrom(t.Source)),
Extra: t.Ext,
}
}

View File

@ -22,7 +22,6 @@ import (
"gorm.io/gorm"
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
pluginModel "github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/model"
"github.com/coze-dev/coze-studio/backend/domain/plugin/entity"
"github.com/coze-dev/coze-studio/backend/domain/plugin/internal/dal/model"
@ -55,9 +54,6 @@ func (t toolVersionPO) ToDO() *entity.ToolInfo {
SubURL: &t.SubURL,
Method: ptr.Of(t.Method),
Operation: t.Operation,
Source: bot_common.PluginFromPtr(bot_common.PluginFrom(t.Source)),
Extra: t.Ext,
}
}