Repository navigation
fix: The way for AI node agents to generate, modify, and obtain workspaces #8215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,8 @@ export interface AgentBindings { | |
| resourceScope: string | ||
| /** 画布所属资源 id(应用 / 工具 / 知识库),MCP 等按资源查询的接口使用 */ | ||
| resourceId?: string | ||
| /** 读取画布资源所属工作空间,传给 useWorkflowStore;系统资源管理按它查询自有工具与 Skills */ | ||
| getResourceWorkspaceId?: () => string | null | undefined | ||
| /** 事件树层级路径(顶层=[]) */ | ||
| position?: string[] | ||
| /** 循环轮次上限 */ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The added member looks straightforward, but here are a few points to consider:
No critical bug seen — just ensure null/undefined handling and avoid serializing the bindings object. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ function currentResourceIds(context: NodeAgentContext) { | |
| * 工具、Skills 取自有与共享目录合并,MCP 沿用 MCP 设置弹窗的查询;工具类只取已启用的,智能体只取已发布的,均排除当前资源。 | ||
| */ | ||
| async function loadSkillResources(context: NodeAgentContext): Promise<SkillResources> { | ||
| const store = useWorkflowStore(context.bindings.resourceScope) | ||
| const store = useWorkflowStore(context.bindings.resourceScope, context.bindings.getResourceWorkspaceId) | ||
| const [ownTools, sharedTools, ownSkills, sharedSkills, mcps, applications] = await Promise.all([ | ||
| store.getToolList(), | ||
| store.getSharedToolList(), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is a review of the change: Potential Issues
Optimization Suggestions
Overall, the main thing to check before merging is whether |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are the key points to consider:
1. Missing
refimportYou added
import type { Ref } from 'vue'but also useref()in:However,
refis only imported as a type (Ref), not as a value. You’ll need either:Otherwise, this will throw a runtime error.
2. Default value in
inject– acceptable, but aware of behaviorUsing
ref()as a default is valid in Vue 3. If'resourceWorkspaceId'is not provided by an ancestor,resourceWorkspaceIdbecomes a standaloneRefwithundefinedas its value. That’s fine.However, note that because you’re passing a new ref object as a default, if the provider does provide one, you get the provided ref. If not, you get the fallback. The reactivity is preserved in both cases.
3.
getResourceWorkspaceIdcallbackThe arrow function:
captures the injected ref and returns its current value. This is good if the workspace ID can change dynamically — the callback will always read the latest value.
4. Possible optimization / consistency
If
resourceWorkspaceIdis used more than once in the component, it’s usually cleaner to expose a computed getter like:and reuse that function instead of writing the arrow inline every time. But since this appears only once, it’s not necessary.
5. Type safety consideration
Make sure that the upstream
providefor'resourceWorkspaceId'also matchesRef<string | null | undefined>. If the provided value is e.g.Ref<string>it still fits, but if it’s something else, TypeScript will complain at compile time.Summary: The main issue is the missing
refimport. Everything else is functionally sound.