fix: Loop node, MCP node cannot be dragged and added (#4159)

v3.2
shaohuzhang1 2025-10-09 17:15:12 +08:00 committed by GitHub
parent 8e8948cf87
commit 483538a431
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 17 deletions

View File

@ -67,7 +67,6 @@ const renderGraphData = (data?: any) => {
}, },
isSilentMode: false, isSilentMode: false,
container: container, container: container,
saa: 'sssssss',
}) })
lf.value.setTheme({ lf.value.setTheme({
bezier: { bezier: {
@ -129,6 +128,7 @@ const onmousedown = (shapeItem: ShapeItem) => {
properties: { ...shapeItem.properties }, properties: { ...shapeItem.properties },
}) })
} }
if (shapeItem.callback) { if (shapeItem.callback) {
shapeItem.callback(lf.value) shapeItem.callback(lf.value)
} }

View File

@ -170,7 +170,9 @@ onMounted(() => {
} }
} }
set(props.nodeModel, 'validate', validate) set(props.nodeModel, 'validate', validate)
if (!props.nodeModel.virtual) {
mountLoopBodyNode() mountLoopBodyNode()
}
}) })
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@ -246,8 +246,8 @@
</el-form> </el-form>
</div> </div>
</template> </template>
</NodeContainer>
<McpServerInputDialog ref="mcpServerInputDialogRef" @refresh="handleMcpVariables" /> <McpServerInputDialog ref="mcpServerInputDialogRef" @refresh="handleMcpVariables" />
</NodeContainer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { cloneDeep, set } from 'lodash' import { cloneDeep, set } from 'lodash'
@ -258,7 +258,7 @@ import { t } from '@/locales'
import { MsgError, MsgSuccess } from '@/utils/message' import { MsgError, MsgSuccess } from '@/utils/message'
import TooltipLabel from '@/components/dynamics-form/items/label/TooltipLabel.vue' import TooltipLabel from '@/components/dynamics-form/items/label/TooltipLabel.vue'
import NodeCascader from '@/workflow/common/NodeCascader.vue' import NodeCascader from '@/workflow/common/NodeCascader.vue'
import McpServerInputDialog from "./component/McpServerInputDialog.vue"; import McpServerInputDialog from './component/McpServerInputDialog.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api' import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { resetUrl } from '@/utils/common' import { resetUrl } from '@/utils/common'
@ -371,32 +371,32 @@ function _getTools(mcp_servers: any) {
const mcpServerInputDialogRef = ref() const mcpServerInputDialogRef = ref()
// JSON {{...}} // JSON {{...}}
function extractPlaceholders(input: unknown): string[] { function extractPlaceholders(input: unknown): string[] {
const re = /\{\{\s*([a-zA-Z_][\w.]*)\s*\}\}/g; // {{ path.like.this }} const re = /\{\{\s*([a-zA-Z_][\w.]*)\s*\}\}/g // {{ path.like.this }}
const found = new Set<string>(); const found = new Set<string>()
const visit = (v: unknown) => { const visit = (v: unknown) => {
if (typeof v === 'string') { if (typeof v === 'string') {
let m: RegExpExecArray | null; let m: RegExpExecArray | null
while ((m = re.exec(v)) !== null) found.add(m[1]); while ((m = re.exec(v)) !== null) found.add(m[1])
} else if (Array.isArray(v)) { } else if (Array.isArray(v)) {
v.forEach(visit); v.forEach(visit)
} else if (v && typeof v === 'object') { } else if (v && typeof v === 'object') {
Object.values(v as Record<string, unknown>).forEach(visit); Object.values(v as Record<string, unknown>).forEach(visit)
}
} }
};
// JSON / // JSON /
if (typeof input === 'string') { if (typeof input === 'string') {
try { try {
visit(JSON.parse(input)); visit(JSON.parse(input))
} catch { } catch {
visit(input); visit(input)
} }
} else { } else {
visit(input); visit(input)
} }
return [...found]; return [...found]
} }
function handleMcpVariables(vars: any) { function handleMcpVariables(vars: any) {
@ -591,7 +591,10 @@ onMounted(() => {
set(props.nodeModel.properties.node_data, 'is_result', true) set(props.nodeModel.properties.node_data, 'is_result', true)
} }
} }
if (props.nodeModel.properties.node_data.mcp_servers && !props.nodeModel.properties.node_data.mcp_source) { if (
props.nodeModel.properties.node_data.mcp_servers &&
!props.nodeModel.properties.node_data.mcp_source
) {
set(props.nodeModel.properties.node_data, 'mcp_source', 'custom') set(props.nodeModel.properties.node_data, 'mcp_source', 'custom')
} }
getMcpToolSelectOptions() getMcpToolSelectOptions()