Yeuoly 10 månader sedan
förälder
incheckning
9a3fb75a5b
2 ändrade filer med 11 tillägg och 4 borttagningar
  1. 10 3
      cmd/commandline/plugin.go
  2. 1 1
      internal/types/entities/plugin_entities/config.go

+ 10 - 3
cmd/commandline/plugin.go

@@ -3,6 +3,7 @@ package main
 import (
 	"fmt"
 	"os"
+	"path/filepath"
 
 	init_pkg "github.com/langgenius/dify-plugin-daemon/cmd/commandline/init"
 	"github.com/langgenius/dify-plugin-daemon/internal/core/plugin_packager/checksum"
@@ -31,13 +32,19 @@ var (
 				fmt.Println("Error: plugin_path is required")
 				return
 			}
-			output_path := "./plugin.difypkg"
+			input_path := args[0]
+			// using filename of input_path as output_path if not specified
+			output_path := ""
+
 			if cmd.Flag("output_path") != nil {
 				output_path = cmd.Flag("output_path").Value.String()
+			} else {
+				output_path = filepath.Base(input_path) + ".difypkg"
 			}
-			decoder, err := decoder.NewFSPluginDecoder(args[0])
+
+			decoder, err := decoder.NewFSPluginDecoder(input_path)
 			if err != nil {
-				log.Error("failed to create plugin decoder , plugin path: %s, error: %v", args[0], err)
+				log.Error("failed to create plugin decoder , plugin path: %s, error: %v", input_path, err)
 				return
 			}
 

+ 1 - 1
internal/types/entities/plugin_entities/config.go

@@ -183,7 +183,7 @@ func init() {
 }
 
 type ProviderConfig struct {
-	Name        string         `json:"name" validate:"required,gt=0,lt=1024"`
+	Name        string         `json:"name" validate:"omitempty,gt=0,lt=1024"`
 	Type        ConfigType     `json:"type" validate:"required,credential_type"`
 	Scope       *string        `json:"scope" validate:"omitempty,is_scope"`
 	Required    bool           `json:"required"`