diff --git a/ui/src/workflow/common/data.ts b/ui/src/workflow/common/data.ts
index e4af22363..c94d50ee1 100644
--- a/ui/src/workflow/common/data.ts
+++ b/ui/src/workflow/common/data.ts
@@ -170,3 +170,13 @@ export const nodeDict: any = {
export function isWorkFlow(type: string | undefined) {
return type === 'WORK_FLOW'
}
+
+export function isLastNode(nodeModel: any) {
+ const incoming = nodeModel.graphModel.getNodeIncomingNode(nodeModel.id)
+ const outcomming = nodeModel.graphModel.getNodeOutgoingNode(nodeModel.id)
+ if (incoming.length > 0 && outcomming.length === 0) {
+ return true
+ } else {
+ return false
+ }
+}
diff --git a/ui/src/workflow/nodes/ai-chat-node/index.vue b/ui/src/workflow/nodes/ai-chat-node/index.vue
index 4eff08f7b..fe5a22d28 100644
--- a/ui/src/workflow/nodes/ai-chat-node/index.vue
+++ b/ui/src/workflow/nodes/ai-chat-node/index.vue
@@ -132,6 +132,23 @@
class="w-full"
/>
+
+
+
+
+ 返回内容*
+
+
+
+ 关闭后该节点的内容则不输出给用户。
+ 如果你想让用户看到该节点的输出内容,请打开开关。
+
+
+
+
+
+
+
@@ -156,6 +173,7 @@ import applicationApi from '@/api/application'
import useStore from '@/stores'
import { relatedObject } from '@/utils/utils'
import type { Provider } from '@/api/type/model'
+import { isLastNode } from '@/workflow/common/data'
const { model } = useStore()
const isKeyDown = ref(false)
@@ -180,7 +198,8 @@ const form = {
model_id: '',
system: '',
prompt: defaultPrompt,
- dialogue_number: 1
+ dialogue_number: 1,
+ is_return: false
}
const chat_data = computed({
@@ -240,6 +259,10 @@ const openCreateModel = (provider?: Provider) => {
onMounted(() => {
getProvider()
getModel()
+ if (isLastNode(props.nodeModel)) {
+ set(props.nodeModel.properties.node_data, 'is_return', true)
+ }
+
set(props.nodeModel, 'validate', validate)
})
diff --git a/ui/src/workflow/nodes/question-node/index.vue b/ui/src/workflow/nodes/question-node/index.vue
index adac82aea..13d3f6be4 100644
--- a/ui/src/workflow/nodes/question-node/index.vue
+++ b/ui/src/workflow/nodes/question-node/index.vue
@@ -133,6 +133,23 @@
class="w-full"
/>
+
+
+
+
+ 返回内容*
+
+
+
+ 关闭后该节点的内容则不输出给用户。
+ 如果你想让用户看到该节点的输出内容,请打开开关。
+
+
+
+
+
+
+
@@ -156,6 +173,8 @@ import applicationApi from '@/api/application'
import useStore from '@/stores'
import { relatedObject } from '@/utils/utils'
import type { Provider } from '@/api/type/model'
+import { isLastNode } from '@/workflow/common/data'
+
const { model } = useStore()
const isKeyDown = ref(false)
const wheel = (e: any) => {
@@ -177,7 +196,8 @@ const form = {
model_id: '',
system: '你是一个问题优化大师',
prompt: defaultPrompt,
- dialogue_number: 1
+ dialogue_number: 1,
+ is_return: false
}
const form_data = computed({
@@ -237,6 +257,9 @@ const openCreateModel = (provider?: Provider) => {
onMounted(() => {
getProvider()
getModel()
+ if (isLastNode(props.nodeModel)) {
+ set(props.nodeModel.properties.node_data, 'is_return', true)
+ }
set(props.nodeModel, 'validate', validate)
})
diff --git a/ui/src/workflow/nodes/reply-node/index.vue b/ui/src/workflow/nodes/reply-node/index.vue
index 6e395cf4e..bb0571002 100644
--- a/ui/src/workflow/nodes/reply-node/index.vue
+++ b/ui/src/workflow/nodes/reply-node/index.vue
@@ -46,6 +46,23 @@
v-model="form_data.fields"
/>
+
+
+
+
+ 返回内容*
+
+
+
+ 关闭后该节点的内容则不输出给用户。
+ 如果你想让用户看到该节点的输出内容,请打开开关。
+
+
+
+
+
+
+
@@ -64,12 +81,14 @@ import { set } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue'
import NodeCascader from '@/workflow/common/NodeCascader.vue'
import { ref, computed, onMounted } from 'vue'
+import { isLastNode } from '@/workflow/common/data'
const props = defineProps<{ nodeModel: any }>()
const form = {
reply_type: 'content',
content: '',
- fields: []
+ fields: [],
+ is_return: false
}
const footers: any = [null, '=', 0]
@@ -111,6 +130,10 @@ const validate = () => {
}
onMounted(() => {
+ if (isLastNode(props.nodeModel)) {
+ set(props.nodeModel.properties.node_data, 'is_return', true)
+ }
+
set(props.nodeModel, 'validate', validate)
})