Skip to content

Commit

Permalink
fix: nil pointer dereference of session backwards invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly committed Dec 16, 2024
1 parent d784e1a commit a7d1f80
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions internal/core/session_manager/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit a7d1f80

Please sign in to comment.