Skip to content

Commit c6394f6

Browse files
committed
feat: Exception branch
1 parent 74b7633 commit c6394f6

File tree

2 files changed

+49
-7
lines changed

2 files changed

+49
-7
lines changed

ui/src/workflow/common/NodeContainer.vue

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,16 @@
9090
/>
9191
<slot></slot>
9292
<template v-if="nodeFields.length > 0">
93-
<h5 class="title-decoration-1 mb-8 mt-8">
94-
{{ $t('common.param.outputParam') }}
95-
</h5>
93+
<div class="flex-between">
94+
<h5 class="title-decoration-1 mb-8 mt-8">
95+
{{ $t('common.param.outputParam') }}
96+
</h5>
97+
<el-switch
98+
v-if="exceptionNodeList.includes(nodeModel.type)"
99+
v-model="enable_exception"
100+
/>
101+
</div>
102+
96103
<template v-for="(item, index) in nodeFields" :key="index">
97104
<div
98105
class="flex-between border-r-6 p-8-12 mb-8 layout-bg lighter"
@@ -324,10 +331,25 @@ function clickNodes(item: any) {
324331
325332
closeNodeMenu()
326333
}
327-
328-
const props = defineProps<{
329-
nodeModel: any
330-
}>()
334+
const enable_exception = computed({
335+
set: (v) => {
336+
set(props.nodeModel.properties, 'enableException', v)
337+
},
338+
get: () => {
339+
if (props.nodeModel.properties.enableException !== undefined) {
340+
return props.nodeModel.properties.enableException
341+
}
342+
set(props.nodeModel.properties, 'enableException', false)
343+
return false
344+
},
345+
})
346+
const props = withDefaults(
347+
defineProps<{
348+
nodeModel: any
349+
exceptionNodeList?: string[]
350+
}>(),
351+
{ exceptionNodeList: () => ['ai-chat-node'] },
352+
)
331353
const nodeFields = computed(() => {
332354
if (props.nodeModel.properties.config.fields) {
333355
const fields = props.nodeModel.properties.config.fields?.map((field: any) => {
@@ -338,6 +360,17 @@ const nodeFields = computed(() => {
338360
globeValue: `{{context['${props.nodeModel.id}'].${field.value}}}`,
339361
}
340362
})
363+
if (enable_exception.value) {
364+
return [
365+
...fields,
366+
{
367+
label: '异常信息',
368+
value: 'exception',
369+
globeLabel: `{{${props.nodeModel.properties.stepName}.exception}}`,
370+
globeValue: `{{context['${props.nodeModel.id}'].exception}}`,
371+
},
372+
]
373+
}
341374
return fields
342375
}
343376
return []

ui/src/workflow/common/app-node.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,15 @@ class AppNodeModel extends HtmlResize.model {
454454
type: 'left',
455455
})
456456
}
457+
458+
if (this.properties.enableException) {
459+
anchors.push({
460+
x: x + width / 2 - 10,
461+
y: y+(this.height/2) -80,
462+
id: `${id}_exception_right`,
463+
type: 'right',
464+
})
465+
}
457466
anchors.push({
458467
x: x + width / 2 - 10,
459468
y: showNode ? y : y - 15,

0 commit comments

Comments
 (0)