Skip to content

Commit 952ad41

Browse files
committed
fix: Loop node, MCP node cannot be dragged and added
1 parent d380a22 commit 952ad41

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
@@ -245,8 +245,8 @@
245245
</el-form>
246246
</div>
247247
</template>
248+
<McpServerInputDialog ref="mcpServerInputDialogRef" @refresh="handleMcpVariables" />
248249
</NodeContainer>
249-
<McpServerInputDialog ref="mcpServerInputDialogRef" @refresh="handleMcpVariables" />
250250
</template>
251251
<script setup lang="ts">
252252
import { cloneDeep, set } from 'lodash'
@@ -257,7 +257,7 @@ import { t } from '@/locales'
257257
import { MsgError, MsgSuccess } from '@/utils/message'
258258
import TooltipLabel from '@/components/dynamics-form/items/label/TooltipLabel.vue'
259259
import NodeCascader from '@/workflow/common/NodeCascader.vue'
260-
import McpServerInputDialog from "./component/McpServerInputDialog.vue";
260+
import McpServerInputDialog from './component/McpServerInputDialog.vue'
261261
import { useRoute } from 'vue-router'
262262
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
263263
import { resetUrl } from '@/utils/common'
@@ -355,7 +355,7 @@ function getTools() {
355355
}
356356
357357
function _getTools(mcp_servers: any) {
358-
loadSharedApi({ type: 'application', systemType: apiType.value })
358+
loadSharedApi({ type: 'application', systemType: apiType.value })
359359
.getMcpTools(id, mcp_servers, loading)
360360
.then((res: any) => {
361361
form_data.value.mcp_tools = res.data
@@ -370,32 +370,32 @@ function _getTools(mcp_servers: any) {
370370
const mcpServerInputDialogRef = ref()
371371
// 提取 JSON 中所有占位符({{...}})的变量路径
372372
function extractPlaceholders(input: unknown): string[] {
373-
const re = /\{\{\s*([a-zA-Z_][\w.]*)\s*\}\}/g; // 捕获 {{ path.like.this }}
374-
const found = new Set<string>();
373+
const re = /\{\{\s*([a-zA-Z_][\w.]*)\s*\}\}/g // 捕获 {{ path.like.this }}
374+
const found = new Set<string>()
375375
376376
const visit = (v: unknown) => {
377377
if (typeof v === 'string') {
378-
let m: RegExpExecArray | null;
379-
while ((m = re.exec(v)) !== null) found.add(m[1]);
378+
let m: RegExpExecArray | null
379+
while ((m = re.exec(v)) !== null) found.add(m[1])
380380
} else if (Array.isArray(v)) {
381-
v.forEach(visit);
381+
v.forEach(visit)
382382
} else if (v && typeof v === 'object') {
383-
Object.values(v as Record<string, unknown>).forEach(visit);
383+
Object.values(v as Record<string, unknown>).forEach(visit)
384384
}
385-
};
385+
}
386386
387387
// 如果传入的是 JSON 字符串,尝试解析,否则按字符串/对象处理
388388
if (typeof input === 'string') {
389389
try {
390-
visit(JSON.parse(input));
390+
visit(JSON.parse(input))
391391
} catch {
392-
visit(input);
392+
visit(input)
393393
}
394394
} else {
395-
visit(input);
395+
visit(input)
396396
}
397397
398-
return [...found];
398+
return [...found]
399399
}
400400
401401
function handleMcpVariables(vars: any) {
@@ -590,7 +590,10 @@ onMounted(() => {
590590
set(props.nodeModel.properties.node_data, 'is_result', true)
591591
}
592592
}
593-
if (props.nodeModel.properties.node_data.mcp_servers && !props.nodeModel.properties.node_data.mcp_source) {
593+
if (
594+
props.nodeModel.properties.node_data.mcp_servers &&
595+
!props.nodeModel.properties.node_data.mcp_source
596+
) {
594597
set(props.nodeModel.properties.node_data, 'mcp_source', 'custom')
595598
}
596599
getMcpToolSelectOptions()

0 commit comments

Comments
 (0)