|
@@ -2,7 +2,6 @@ package models
|
|
|
|
|
|
import (
|
|
|
"github.com/langgenius/dify-plugin-daemon/internal/types/entities/plugin_entities"
|
|
|
- "github.com/langgenius/dify-plugin-daemon/internal/utils/parser"
|
|
|
)
|
|
|
|
|
|
type Plugin struct {
|
|
@@ -14,16 +13,7 @@ type Plugin struct {
|
|
|
Refers int `json:"refers" gorm:"default:0"`
|
|
|
InstallType plugin_entities.PluginRuntimeType `json:"install_type" gorm:"size:127;index"`
|
|
|
ManifestType plugin_entities.DifyManifestType `json:"manifest_type" gorm:"size:127"`
|
|
|
- Declaration string `json:"declaration" gorm:"type:text;size:65535"`
|
|
|
-}
|
|
|
-
|
|
|
-func (p *Plugin) GetDeclaration() (*plugin_entities.PluginDeclaration, error) {
|
|
|
- declaration, err := parser.UnmarshalJson[plugin_entities.PluginDeclaration](p.Declaration)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
- return &declaration, nil
|
|
|
+ Declaration plugin_entities.PluginDeclaration `json:"declaration" gorm:"serializer:json;type:text;size:65535"`
|
|
|
}
|
|
|
|
|
|
type ServerlessRuntimeType string
|
|
@@ -34,23 +24,10 @@ const (
|
|
|
|
|
|
type ServerlessRuntime struct {
|
|
|
Model
|
|
|
- PluginUniqueIdentifier string `json:"plugin_unique_identifier" gorm:"size:127;unique"`
|
|
|
- FunctionURL string `json:"function_url" gorm:"size:255"`
|
|
|
- FunctionName string `json:"function_name" gorm:"size:127"`
|
|
|
- Type ServerlessRuntimeType `json:"type" gorm:"size:127"`
|
|
|
- Declaration string `json:"declaration" gorm:"type:text;size:65535"`
|
|
|
- Checksum string `json:"checksum" gorm:"size:127;index"`
|
|
|
-}
|
|
|
-
|
|
|
-func (p *ServerlessRuntime) GetDeclaration() (*plugin_entities.PluginDeclaration, error) {
|
|
|
- declaration, err := parser.UnmarshalJson[plugin_entities.PluginDeclaration](p.Declaration)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
- return &declaration, nil
|
|
|
-}
|
|
|
-
|
|
|
-func (p *ServerlessRuntime) SetDeclaration(declaration *plugin_entities.PluginDeclaration) {
|
|
|
- p.Declaration = parser.MarshalJson(declaration)
|
|
|
+ PluginUniqueIdentifier string `json:"plugin_unique_identifier" gorm:"size:127;unique"`
|
|
|
+ FunctionURL string `json:"function_url" gorm:"size:255"`
|
|
|
+ FunctionName string `json:"function_name" gorm:"size:127"`
|
|
|
+ Type ServerlessRuntimeType `json:"type" gorm:"size:127"`
|
|
|
+ Declaration plugin_entities.PluginDeclaration `json:"declaration" gorm:"serializer:json;type:text;size:65535"`
|
|
|
+ Checksum string `json:"checksum" gorm:"size:127;index"`
|
|
|
}
|