Skip to content

Commit 483538a

Browse files
authored
fix: Loop node, MCP node cannot be dragged and added (#4159)
1 parent 8e8948c commit 483538a

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

ui/src/workflow/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ const renderGraphData = (data?: any) => {
6767
},
6868
isSilentMode: false,
6969
container: container,
70-
saa: 'sssssss',
7170
})
7271
lf.value.setTheme({
7372
bezier: {
@@ -129,6 +128,7 @@ const onmousedown = (shapeItem: ShapeItem) => {
129128
properties: { ...shapeItem.properties },
130129
})
131130
}
131+
132132
if (shapeItem.callback) {
133133
shapeItem.callback(lf.value)
134134
}

ui/src/workflow/nodes/loop-node/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ onMounted(() => {
170170
}
171171
}
172172
set(props.nodeModel, 'validate', validate)
173-
mountLoopBodyNode()
173+
if (!props.nodeModel.virtual) {
174+
mountLoopBodyNode()
175+
}
174176
})
175177
</script>
176178
<style lang="scss" scoped></style>

ui/src/workflow/nodes/mcp-node/index.vue

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@
246246
</el-form>
247247
</div>
248248
</template>
249+
<McpServerInputDialog ref="mcpServerInputDialogRef" @refresh="handleMcpVariables" />
249250
</NodeContainer>
250-
<McpServerInputDialog ref="mcpServerInputDialogRef" @refresh="handleMcpVariables" />
251251
</template>
252252
<script setup lang="ts">
253253
import { cloneDeep, set } from 'lodash'
@@ -258,7 +258,7 @@ import { t } from '@/locales'
258258
import { MsgError, MsgSuccess } from '@/utils/message'
259259
import TooltipLabel from '@/components/dynamics-form/items/label/TooltipLabel.vue'
260260
import NodeCascader from '@/workflow/common/NodeCascader.vue'
261-
import McpServerInputDialog from "./component/McpServerInputDialog.vue";
261+
import McpServerInputDialog from './component/McpServerInputDialog.vue'
262262
import { useRoute } from 'vue-router'
263263
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
264264
import { resetUrl } from '@/utils/common'
@@ -356,7 +356,7 @@ function getTools() {
356356
}
357357
358358
function _getTools(mcp_servers: any) {
359-
loadSharedApi({ type: 'application', systemType: apiType.value })
359+
loadSharedApi({ type: 'application', systemType: apiType.value })
360360
.getMcpTools(id, mcp_servers, loading)
361361
.then((res: any) => {
362362
form_data.value.mcp_tools = res.data
@@ -371,32 +371,32 @@ function _getTools(mcp_servers: any) {
371371
const mcpServerInputDialogRef = ref()
372372
// 提取 JSON 中所有占位符({{...}})的变量路径
373373
function extractPlaceholders(input: unknown): string[] {
374-
const re = /\{\{\s*([a-zA-Z_][\w.]*)\s*\}\}/g; // 捕获 {{ path.like.this }}
375-
const found = new Set<string>();
374+
const re = /\{\{\s*([a-zA-Z_][\w.]*)\s*\}\}/g // 捕获 {{ path.like.this }}
375+
const found = new Set<string>()
376376
377377
const visit = (v: unknown) => {
378378
if (typeof v === 'string') {
379-
let m: RegExpExecArray | null;
380-
while ((m = re.exec(v)) !== null) found.add(m[1]);
379+
let m: RegExpExecArray | null
380+
while ((m = re.exec(v)) !== null) found.add(m[1])
381381
} else if (Array.isArray(v)) {
382-
v.forEach(visit);
382+
v.forEach(visit)
383383
} else if (v && typeof v === 'object') {
384-
Object.values(v as Record<string, unknown>).forEach(visit);
384+
Object.values(v as Record<string, unknown>).forEach(visit)
385385
}
386-
};
386+
}
387387
388388
// 如果传入的是 JSON 字符串,尝试解析,否则按字符串/对象处理
389389
if (typeof input === 'string') {
390390
try {
391-
visit(JSON.parse(input));
391+
visit(JSON.parse(input))
392392
} catch {
393-
visit(input);
393+
visit(input)
394394
}
395395
} else {
396-
visit(input);
396+
visit(input)
397397
}
398398
399-
return [...found];
399+
return [...found]
400400
}
401401
402402
function handleMcpVariables(vars: any) {
@@ -591,7 +591,10 @@ onMounted(() => {
591591
set(props.nodeModel.properties.node_data, 'is_result', true)
592592
}
593593
}
594-
if (props.nodeModel.properties.node_data.mcp_servers && !props.nodeModel.properties.node_data.mcp_source) {
594+
if (
595+
props.nodeModel.properties.node_data.mcp_servers &&
596+
!props.nodeModel.properties.node_data.mcp_source
597+
) {
595598
set(props.nodeModel.properties.node_data, 'mcp_source', 'custom')
596599
}
597600
getMcpToolSelectOptions()

0 commit comments

Comments
 (0)