From c74977e68c71d6d6f5ad2d04c3e9d98a24c83b9a Mon Sep 17 00:00:00 2001 From: lvxinyu-1117 Date: Tue, 2 Sep 2025 16:49:48 +0800 Subject: [PATCH] fix(workflow): Resolve variable shadowing issue in ClearConversationHistory (#1945) --- .../nodes/conversation/clearconversationhistory.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/domain/workflow/internal/nodes/conversation/clearconversationhistory.go b/backend/domain/workflow/internal/nodes/conversation/clearconversationhistory.go index 568deefe..e30d95fc 100644 --- a/backend/domain/workflow/internal/nodes/conversation/clearconversationhistory.go +++ b/backend/domain/workflow/internal/nodes/conversation/clearconversationhistory.go @@ -99,20 +99,22 @@ func (c *ClearConversationHistory) Invoke(ctx context.Context, in map[string]any } var conversationID int64 if existed { - ret, existed, err := wf.GetRepository().GetStaticConversationByTemplateID(ctx, env, userID, connectorID, t.TemplateID) + var sc *entity.StaticConversation + sc, existed, err = wf.GetRepository().GetStaticConversationByTemplateID(ctx, env, userID, connectorID, t.TemplateID) if err != nil { return nil, vo.WrapError(errno.ErrConversationNodeOperationFail, err, errorx.KV("cause", vo.UnwrapRootErr(err).Error())) } if existed { - conversationID = ret.ConversationID + conversationID = sc.ConversationID } } else { - ret, existed, err := wf.GetRepository().GetDynamicConversationByName(ctx, env, *appID, connectorID, userID, conversationName) + var dc *entity.DynamicConversation + dc, existed, err = wf.GetRepository().GetDynamicConversationByName(ctx, env, *appID, connectorID, userID, conversationName) if err != nil { return nil, vo.WrapError(errno.ErrConversationNodeOperationFail, err, errorx.KV("cause", vo.UnwrapRootErr(err).Error())) } if existed { - conversationID = ret.ConversationID + conversationID = dc.ConversationID } }