plugin.go 1.0 KB

1234567891011121314151617181920212223
  1. package models
  2. import (
  3. "github.com/langgenius/dify-plugin-daemon/internal/types/entities/plugin_entities"
  4. "github.com/langgenius/dify-plugin-daemon/internal/utils/parser"
  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" orm:"index;size:127"`
  10. // PluginID is the id of the plugin, only plugin name is considered
  11. PluginID string `json:"id" orm:"index;size:127"`
  12. Refers int `json:"refers" orm:"default:0"`
  13. InstallType plugin_entities.PluginRuntimeType `json:"install_type" orm:"size:127;index"`
  14. ManifestType plugin_entities.DifyManifestType `json:"manifest_type" orm:"size:127"`
  15. Declaration string `json:"declaration" orm:"type:text;size:65535"`
  16. }
  17. func (p *Plugin) GetDeclaration() (plugin_entities.PluginDeclaration, error) {
  18. return parser.UnmarshalJson[plugin_entities.PluginDeclaration](p.Declaration)
  19. }