plugin.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package models
  2. import (
  3. "github.com/langgenius/dify-plugin-daemon/pkg/entities/manifest_entities"
  4. "github.com/langgenius/dify-plugin-daemon/pkg/entities/plugin_entities"
  5. )
  6. type Plugin struct {
  7. Model
  8. // PluginUniqueIdentifier is a unique identifier for the plugin, it contains version and checksum
  9. PluginUniqueIdentifier string `json:"plugin_unique_identifier" gorm:"index;size:255"`
  10. // PluginID is the id of the plugin, only plugin name is considered
  11. PluginID string `json:"id" gorm:"index;size:255"`
  12. Refers int `json:"refers" gorm:"default:0"`
  13. InstallType plugin_entities.PluginRuntimeType `json:"install_type" gorm:"size:127;index"`
  14. ManifestType manifest_entities.DifyManifestType `json:"manifest_type" gorm:"size:127"`
  15. Declaration plugin_entities.PluginDeclaration `json:"declaration" gorm:"serializer:json;type:text;size:65535"`
  16. }
  17. type ServerlessRuntimeType string
  18. const (
  19. SERVERLESS_RUNTIME_TYPE_SERVERLESS ServerlessRuntimeType = "serverless"
  20. )
  21. type ServerlessRuntime struct {
  22. Model
  23. PluginUniqueIdentifier string `json:"plugin_unique_identifier" gorm:"size:255;unique"`
  24. FunctionURL string `json:"function_url" gorm:"size:255"`
  25. FunctionName string `json:"function_name" gorm:"size:127"`
  26. Type ServerlessRuntimeType `json:"type" gorm:"size:127"`
  27. Declaration plugin_entities.PluginDeclaration `json:"declaration" gorm:"serializer:json;type:text;size:65535"`
  28. Checksum string `json:"checksum" gorm:"size:127;index"`
  29. }
  30. type PluginDeclaration struct {
  31. Model
  32. PluginUniqueIdentifier string `json:"plugin_unique_identifier" gorm:"size:255;unique"`
  33. PluginID string `json:"plugin_id" gorm:"size:255;index"`
  34. Declaration plugin_entities.PluginDeclaration `json:"declaration" gorm:"serializer:json;type:text;size:65535"`
  35. }