feat: 高级编排
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
wangdan-fit2cloud 2024-06-21 15:04:38 +08:00
parent 2f6b725a2d
commit 125c55be57
7 changed files with 70 additions and 23 deletions

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718950836622" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="14660" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M366.08 301.269333l-215.552 235.178667L354.133333 771.669333a21.333333 21.333333 0 0 1-0.810666 28.8l-27.904 28.842667a21.333333 21.333333 0 0 1-31.36-0.810667L50.944 550.826667a21.333333 21.333333 0 0 1 0.298667-28.458667L306.773333 243.669333a21.333333 21.333333 0 0 1 31.018667-0.426666l27.904 28.8a21.333333 21.333333 0 0 1 0.426667 29.226666z m513.578667 235.178667l-206.08-235.178667a21.333333 21.333333 0 0 1 0.682666-28.928l27.904-28.8a21.333333 21.333333 0 0 1 31.317334 0.682667l245.674666 277.845333a21.333333 21.333333 0 0 1-0.298666 28.544l-255.402667 278.613334a21.333333 21.333333 0 0 1-31.061333 0.426666l-27.904-28.757333a21.333333 21.333333 0 0 1-0.384-29.269333l215.594666-235.178667z m-324.864-474.88l42.410666 4.906667a21.333333 21.333333 0 0 1 18.730667 23.637333L514.133333 965.12a21.333333 21.333333 0 0 1-23.637333 18.730667l-42.368-4.949334a21.333333 21.333333 0 0 1-18.773333-23.637333L531.2 80.213333a21.333333 21.333333 0 0 1 23.68-18.730666z" p-id="14661" fill="#FF8800"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -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<any>('')
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

View File

@ -23,11 +23,39 @@ const props = defineProps<{
nodeModel: any
}>()
const options = ref<Array<any>>([])
const options = ref<Array<any>>([
{
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,

View File

@ -1,5 +1,5 @@
const end_nodes = ['ai-chat-node', 'reply-node']
export class WorkFlow {
export class WorkFlowInstanse {
nodes
edges
constructor(workflow: { nodes: Array<any>; edges: Array<any> }) {

View File

@ -0,0 +1,4 @@
<template>
<img src="@/assets/icon_globe_color.svg" style="width: 18px" alt="" />
</template>
<script setup lang="ts"></script>

View File

@ -20,7 +20,7 @@
prop="model_id"
:rules="{
required: true,
message: 'AI 模型',
message: '请选择 AI 模型',
trigger: 'change'
}"
>

View File

@ -20,7 +20,7 @@
prop="model_id"
:rules="{
required: true,
message: 'AI 模型',
message: '请选择 AI 模型',
trigger: 'change'
}"
>