plugin.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package main
  2. import (
  3. init_pkg "github.com/langgenius/dify-plugin-daemon/cmd/commandline/init"
  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. init_pkg.InitPlugin()
  13. },
  14. }
  15. pluginPackageCommand = &cobra.Command{
  16. Use: "package",
  17. Short: "Package",
  18. Long: "Package plugins",
  19. }
  20. pluginPermissionCommand = &cobra.Command{
  21. Use: "permission",
  22. Short: "Permission",
  23. Long: `Permission, available values:
  24. tools - allow plugin to call tools
  25. models - allow plugin to call models
  26. models.llm - allow plugin to call llm
  27. models.text_embedding - allow plugin to call text_embedding model
  28. models.rerank - allow plugin to call rerank model
  29. models.tts - allow plugin to call tts
  30. models.speech2text - allow plugin to call speech2text
  31. models.moderation - allow plugin to call moderation
  32. apps - allow plugin to call apps
  33. storage - allow plugin to use storage
  34. endpoint - allow plugin to register endpoint`,
  35. }
  36. pluginPermissionAddCommand = &cobra.Command{
  37. Use: "add permission",
  38. Short: "",
  39. Long: "Add permission to plugin, you can find the available permission by running `dify plugin permission`",
  40. }
  41. pluginPermissionDropCommand = &cobra.Command{
  42. Use: "drop permission",
  43. Short: "",
  44. Long: "Drop permission from plugin, you can find the available permission by running `dify plugin permission`",
  45. }
  46. )
  47. func init() {
  48. pluginCommand.AddCommand(pluginInitCommand)
  49. pluginCommand.AddCommand(pluginPackageCommand)
  50. pluginCommand.AddCommand(pluginPermissionCommand)
  51. pluginPermissionCommand.AddCommand(pluginPermissionAddCommand)
  52. pluginPermissionCommand.AddCommand(pluginPermissionDropCommand)
  53. }