plugin.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. RemoteDeclaration plugin_entities.PluginDeclaration `json:"remote_declaration" gorm:"serializer:json;type:text;size:65535"` // enabled when plugin is remote
  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. Checksum string `json:"checksum" gorm:"size:127;index"`
  28. }
  29. type PluginDeclaration struct {
  30. Model
  31. PluginUniqueIdentifier string `json:"plugin_unique_identifier" gorm:"size:255;unique"`
  32. PluginID string `json:"plugin_id" gorm:"size:255;index"`
  33. Declaration plugin_entities.PluginDeclaration `json:"declaration" gorm:"serializer:json;type:text;size:65535"`
  34. }