瀏覽代碼

fix: nil pointer dereference of session backwards invocation

Yeuoly 7 月之前
父節點
當前提交
a7d1f80ed7

+ 5 - 0
internal/core/plugin_daemon/backwards_invocation/transaction/aws_event_handler.go

@@ -8,6 +8,7 @@ import (
 
 	"github.com/gin-gonic/gin"
 	"github.com/langgenius/dify-plugin-daemon/internal/core/plugin_daemon/backwards_invocation"
+	"github.com/langgenius/dify-plugin-daemon/internal/core/plugin_manager"
 	"github.com/langgenius/dify-plugin-daemon/internal/core/session_manager"
 	"github.com/langgenius/dify-plugin-daemon/internal/types/entities/plugin_entities"
 	"github.com/langgenius/dify-plugin-daemon/internal/utils/log"
@@ -92,6 +93,10 @@ func (h *AWSTransactionHandler) Handle(
 				return
 			}
 
+			// bind the backwards invocation
+			plugin_manager := plugin_manager.Manager()
+			session.BindBackwardsInvocation(plugin_manager.BackwardsInvocation())
+
 			awsResponseWriter := NewAWSTransactionWriter(session, writer)
 
 			if err := backwards_invocation.InvokeDify(

+ 4 - 0
internal/core/session_manager/session.go

@@ -150,6 +150,10 @@ func (s *Session) Runtime() plugin_entities.PluginLifetime {
 	return s.runtime
 }
 
+func (s *Session) BindBackwardsInvocation(backwardsInvocation dify_invocation.BackwardsInvocation) {
+	s.backwardsInvocation = backwardsInvocation
+}
+
 func (s *Session) BackwardsInvocation() dify_invocation.BackwardsInvocation {
 	return s.backwardsInvocation
 }