diff --git a/ui/src/assets/icon_globe_color.svg b/ui/src/assets/icon_globe_color.svg
new file mode 100644
index 000000000..7ede591d5
--- /dev/null
+++ b/ui/src/assets/icon_globe_color.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/ui/src/views/application-workflow/index.vue b/ui/src/views/application-workflow/index.vue
index e2d2dfdf7..714575730 100644
--- a/ui/src/views/application-workflow/index.vue
+++ b/ui/src/views/application-workflow/index.vue
@@ -83,7 +83,7 @@ import applicationApi from '@/api/application'
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
import { datetimeFormat } from '@/utils/time'
import useStore from '@/stores'
-import { WorkFlow } from '@/workflow/common/validate'
+import { WorkFlowInstanse } from '@/workflow/common/validate'
const { application } = useStore()
const route = useRoute()
@@ -103,29 +103,43 @@ const enlarge = ref(false)
const saveTime = ref('')
function publicHandle() {
- workflowRef.value?.validate().then(() => {
- const obj = {
- work_flow: getGraphData()
- }
- applicationApi.putPublishApplication(id as String, obj, loading).then(() => {
- MsgSuccess('发布成功')
- getDetail()
+ workflowRef.value
+ ?.validate()
+ .then(() => {
+ const obj = {
+ work_flow: getGraphData()
+ }
+ applicationApi.putPublishApplication(id as String, obj, loading).then(() => {
+ MsgSuccess('发布成功')
+ getDetail()
+ })
+ })
+ .catch((res: any) => {
+ const keys = Object.keys(res)
+ MsgError(res[keys[0]]?.[0]?.message)
})
- })
}
function clickoutside() {
showPopover.value = false
}
const clickShowDebug = () => {
- const graphData = getGraphData()
- const workflow = new WorkFlow(graphData)
- try {
- workflow.is_valid()
- showDebug.value = true
- } catch (e: any) {
- MsgError(e.toString())
- }
+ workflowRef.value
+ ?.validate()
+ .then(() => {
+ const graphData = getGraphData()
+ const workflow = new WorkFlowInstanse(graphData)
+ try {
+ workflow.is_valid()
+ showDebug.value = true
+ } catch (e: any) {
+ MsgError(e.toString())
+ }
+ })
+ .catch((res: any) => {
+ const keys = Object.keys(res)
+ MsgError(res[keys[0]]?.[0]?.message)
+ })
}
function clickoutsideDebug() {
showDebug.value = false
diff --git a/ui/src/workflow/common/NodeCascader.vue b/ui/src/workflow/common/NodeCascader.vue
index b76ef01f5..0b6377c32 100644
--- a/ui/src/workflow/common/NodeCascader.vue
+++ b/ui/src/workflow/common/NodeCascader.vue
@@ -23,11 +23,39 @@ const props = defineProps<{
nodeModel: any
}>()
-const options = ref>([])
+const options = ref>([
+ {
+ value: 'globe',
+ label: '全局变量',
+ type: 'globe',
+ children: [
+ {
+ value: 'time',
+ label: '当前时间',
+ globeLabel: '{{全局变量.time}}',
+ globeValue: "{{content['globe'].time}}"
+ }
+ ]
+ }
+])
function visibleChange(bool: boolean) {
if (bool) {
- options.value = []
+ options.value = [
+ {
+ value: 'globe',
+ label: '全局变量',
+ type: 'globe',
+ children: [
+ {
+ value: 'time',
+ label: '当前时间',
+ globeLabel: '{{全局变量.time}}',
+ globeValue: "{{content['globe'].time}}"
+ }
+ ]
+ }
+ ]
getIncomingNode(props.nodeModel.id)
}
}
@@ -37,7 +65,7 @@ function getIncomingNode(id: string) {
if (list.length > 0) {
list.forEach((item: any) => {
if (!options.value.some((obj: any) => obj.id === item.id)) {
- options.value.unshift({
+ options.value.splice(1, 1, {
value: item.id,
label: item.properties.stepName,
type: item.type,
diff --git a/ui/src/workflow/common/validate.ts b/ui/src/workflow/common/validate.ts
index 62b923309..a5459c910 100644
--- a/ui/src/workflow/common/validate.ts
+++ b/ui/src/workflow/common/validate.ts
@@ -1,5 +1,5 @@
const end_nodes = ['ai-chat-node', 'reply-node']
-export class WorkFlow {
+export class WorkFlowInstanse {
nodes
edges
constructor(workflow: { nodes: Array; edges: Array }) {
diff --git a/ui/src/workflow/icons/globe-icon.vue b/ui/src/workflow/icons/globe-icon.vue
new file mode 100644
index 000000000..5d476dc74
--- /dev/null
+++ b/ui/src/workflow/icons/globe-icon.vue
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/ui/src/workflow/nodes/ai-chat-node/index.vue b/ui/src/workflow/nodes/ai-chat-node/index.vue
index ceac6e778..f48537d61 100644
--- a/ui/src/workflow/nodes/ai-chat-node/index.vue
+++ b/ui/src/workflow/nodes/ai-chat-node/index.vue
@@ -20,7 +20,7 @@
prop="model_id"
:rules="{
required: true,
- message: 'AI 模型',
+ message: '请选择 AI 模型',
trigger: 'change'
}"
>
diff --git a/ui/src/workflow/nodes/question-node/index.vue b/ui/src/workflow/nodes/question-node/index.vue
index 558844ffa..de4c0ca89 100644
--- a/ui/src/workflow/nodes/question-node/index.vue
+++ b/ui/src/workflow/nodes/question-node/index.vue
@@ -20,7 +20,7 @@
prop="model_id"
:rules="{
required: true,
- message: 'AI 模型',
+ message: '请选择 AI 模型',
trigger: 'change'
}"
>