plugin.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package main
  2. import (
  3. "github.com/langgenius/dify-plugin-daemon/cmd/commandline/cmd"
  4. "github.com/spf13/cobra"
  5. )
  6. var (
  7. pluginInitCommand = &cobra.Command{
  8. Use: "init",
  9. Short: "Init",
  10. Long: "Init",
  11. Run: func(c *cobra.Command, args []string) {
  12. cmd.InitPlugin()
  13. },
  14. }
  15. pluginPermissionCommand = &cobra.Command{
  16. Use: "permission",
  17. Short: "Permission",
  18. Long: `Permission, available values:
  19. tools - allow plugin to call tools
  20. models - allow plugin to call models
  21. models.llm - allow plugin to call llm
  22. models.text_embedding - allow plugin to call text_embedding model
  23. models.rerank - allow plugin to call rerank model
  24. models.tts - allow plugin to call tts
  25. models.speech2text - allow plugin to call speech2text
  26. models.moderation - allow plugin to call moderation
  27. apps - allow plugin to call apps
  28. storage - allow plugin to use storage
  29. endpoint - allow plugin to register endpoint`,
  30. }
  31. pluginPermissionAddCommand = &cobra.Command{
  32. Use: "add",
  33. Short: "Add permission to plugin",
  34. Long: "Add permission to plugin, you can find the available permission by running `dify plugin permission`",
  35. }
  36. pluginPermissionDropCommand = &cobra.Command{
  37. Use: "drop",
  38. Short: "Drop permission from plugin",
  39. Long: "Drop permission from plugin, you can find the available permission by running `dify plugin permission`",
  40. }
  41. )
  42. func init() {
  43. pluginCommand.AddCommand(pluginInitCommand)
  44. pluginCommand.AddCommand(pluginPermissionCommand)
  45. pluginPermissionCommand.AddCommand(pluginPermissionAddCommand)
  46. pluginPermissionCommand.AddCommand(pluginPermissionDropCommand)
  47. }