Skip to content

Conversation

@Degfy
Copy link
Contributor

@Degfy Degfy commented Oct 30, 2025

fix(plugin): 解决 #2418 ,在工作流中没有正确传递UserId 和 没有传递 ConversationID、AgentID 给 插件的问题。

  • 将WithPluginHTTPHeader重命名为WithConversationID以准确反映其用途
  • 在工作流节点中增加对ConversationID和AgentID的传递支持
  • 解决工作流中模型调用插件,没有正确传递 UserID 的问题。

…fails to pass the ConversationID and AgentID to the plugin service.

- 将WithPluginHTTPHeader重命名为WithConversationID以准确反映其用途
- 在工作流节点中增加对ConversationID和AgentID的传递支持
@Degfy
Copy link
Contributor Author

Degfy commented Nov 3, 2025

这个 PR 用于完善 https://github.com/coze-dev/coze-studio/pull/2191,@fanlv review 一下?

}, nil
}

func (p *pluginInvokeTool) PluginInvoke(ctx context.Context, argumentsInJSON string, cfg workflowModel.ExecuteConfig) (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrh997 帮忙确认下。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个我看下


req := &model.ExecuteToolRequest{
UserID: conv.Int64ToStr(cfg.Operator),
UserID: uID,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cfg.ConnectorUID 与cfg.Operator 最新版本有区分;ConnectorUID 表示的是渠道UserID,Operator代表的是opencoze 的userID(创建Workflow 或者Plugin者);ConnectorUID 可能与Operator相同,或是第三方调用者的userID 。 ExecuteToolRequest 中的 UserID 必须是 Operator,后续鉴权场景需要。

Image如果按照这个说法,ConnectorUID不等于Operator 则这个值需要置为空 ;

}

func WithPluginHTTPHeader(conversationID int64) ExecuteToolOpt {
func WithConversationID(conversationID int64) ExecuteToolOpt {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个场景,我看了上个提交,咱们使用了原有的的结构做了传递,正常来说我们的场景是在tool运行的时候透传header信息,是不是单独定义一个关于header的结构做option,所有的字段包含在内,这个option只对tool 透传header生效,不与原因逻辑混在一起比较好;

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/domain/workflow/plugin/plugin.go 0.00% 12 Missing ⚠️
...kend/domain/workflow/internal/nodes/plugin/exec.go 0.00% 6 Missing ⚠️
backend/crossdomain/plugin/model/option.go 0.00% 1 Missing ⚠️
...singleagent/internal/agentflow/node_tool_plugin.go 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
backend/crossdomain/plugin/model/option.go 0.00% <0.00%> (ø)
...singleagent/internal/agentflow/node_tool_plugin.go 0.00% <0.00%> (ø)
...kend/domain/workflow/internal/nodes/plugin/exec.go 0.00% <0.00%> (ø)
backend/domain/workflow/plugin/plugin.go 30.03% <0.00%> (-1.14%) ⬇️

... and 1140 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants