mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-29 07:52:50 +00:00
feat: 工作编排
This commit is contained in:
parent
40b515dae6
commit
c74854c325
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<div class="application-workflow">
|
||||
<div class="application-workflow" v-loading="loading">
|
||||
<div class="header border-b flex-between p-16-24">
|
||||
<div class="flex align-center">
|
||||
<back-button to="-1"></back-button>
|
||||
<h4>创建应用</h4>
|
||||
<h4>{{ detail?.name }}</h4>
|
||||
</div>
|
||||
<div>
|
||||
<el-button icon="Plus" @click="showPopover = !showPopover" v-click-outside="clickoutside">
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
</div>
|
||||
</el-collapse-transition>
|
||||
<div class="workflow-main">
|
||||
<workflow ref="workflowRef" />
|
||||
<workflow ref="workflowRef" v-if="detail" :data="detail?.work_flow" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -41,6 +41,8 @@ import { menuNodes } from '@/workflow/common/data'
|
|||
import { iconComponent } from '@/workflow/icons/utils'
|
||||
import applicationApi from '@/api/application'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import useStore from '@/stores'
|
||||
const { application } = useStore()
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
|
|
@ -49,6 +51,7 @@ const {
|
|||
const workflowRef = ref()
|
||||
|
||||
const loading = ref(false)
|
||||
const detail = ref<any>(null)
|
||||
|
||||
const showPopover = ref(false)
|
||||
|
||||
|
|
@ -75,7 +78,15 @@ function getGraphData() {
|
|||
return workflowRef.value?.getGraphData()
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
function getDetail() {
|
||||
application.asyncGetApplicationDetail(id, loading).then((res: any) => {
|
||||
detail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ const submitHandle = async (formEl: FormInstance | undefined) => {
|
|||
if (applicationForm.value.type === 'WORK_FLOW') {
|
||||
router.push({ path: `/application/${res.data.id}/workflow` })
|
||||
} else {
|
||||
router.push({ path: `/application/${res.data.id}/${item.type}/setting` })
|
||||
router.push({ path: `/application/${res.data.id}/${res.data.type}/setting` })
|
||||
}
|
||||
|
||||
dialogVisible.value = false
|
||||
|
|
|
|||
|
|
@ -80,12 +80,7 @@
|
|||
:content="$t('views.application.applicationList.card.setting')"
|
||||
placement="top"
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
@click.stop="
|
||||
router.push({ path: `/application/${item.id}/${item.type}/setting` })
|
||||
"
|
||||
>
|
||||
<el-button text @click.stop="settingApplication(item)">
|
||||
<AppIcon iconName="Setting"></AppIcon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
|
|
@ -134,6 +129,14 @@ const paginationConfig = reactive({
|
|||
|
||||
const searchValue = ref('')
|
||||
|
||||
function settingApplication(row: any) {
|
||||
if (row.type === 'WORK_FLOW') {
|
||||
router.push({ path: `/application/${row.id}/workflow` })
|
||||
} else {
|
||||
router.push({ path: `/application/${row.id}/${row.type}/setting` })
|
||||
}
|
||||
}
|
||||
|
||||
function openCreateDialog() {
|
||||
CreateApplicationDialogRef.value.open()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import LogicFlow from '@logicflow/core'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import AppEdge from './common/edge'
|
||||
import Control from './common/NodeControl.vue'
|
||||
import { baseNodes } from '@/workflow/common/data'
|
||||
|
|
@ -27,467 +27,487 @@ type ShapeItem = {
|
|||
callback?: (lf: LogicFlow, container?: HTMLElement) => void
|
||||
}
|
||||
|
||||
const graphData = {
|
||||
nodes: [
|
||||
...baseNodes,
|
||||
{
|
||||
id: 'e781559d-e54b-45d8-bcea-d2d426fd58a3',
|
||||
type: 'ai-chat-node',
|
||||
x: 600,
|
||||
y: 560,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: 'AI 对话',
|
||||
fields: [{ label: 'AI 回答内容', value: 'answer' }],
|
||||
node_data: {
|
||||
model_id: '9bdd1ab3-135b-11ef-b688-a8a1595801ab',
|
||||
system: '你是问题分类大师',
|
||||
prompt:
|
||||
"请直接返回所属的问题分类,不要说推理过程。\n用户问题为:{{context['start-node'].question}}\n问题分类是:\n打招呼 \n售前咨询\n售后咨询\n其他咨询",
|
||||
dialogue_number: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
type: 'condition-node',
|
||||
x: 1140,
|
||||
y: 284,
|
||||
properties: {
|
||||
noRender: true,
|
||||
width: 600,
|
||||
stepName: '判断器',
|
||||
node_data: {
|
||||
branch: [
|
||||
{
|
||||
conditions: [
|
||||
{
|
||||
field: ['e781559d-e54b-45d8-bcea-d2d426fd58a3', 'answer'],
|
||||
compare: 'contain',
|
||||
value: '打招呼 '
|
||||
}
|
||||
],
|
||||
id: '5675',
|
||||
type: 'IF',
|
||||
condition: 'and'
|
||||
},
|
||||
{
|
||||
conditions: [
|
||||
{
|
||||
field: ['e781559d-e54b-45d8-bcea-d2d426fd58a3', 'answer'],
|
||||
compare: 'contain',
|
||||
value: '售前咨询'
|
||||
}
|
||||
],
|
||||
type: 'ELSE IF 1',
|
||||
id: '9947',
|
||||
condition: 'and'
|
||||
},
|
||||
{
|
||||
conditions: [
|
||||
{
|
||||
field: ['e781559d-e54b-45d8-bcea-d2d426fd58a3', 'answer'],
|
||||
compare: 'contain',
|
||||
value: '售后咨询'
|
||||
}
|
||||
],
|
||||
type: 'ELSE IF 2',
|
||||
id: '5048',
|
||||
condition: 'and'
|
||||
},
|
||||
{ conditions: [], id: '6750', type: 'ELSE', condition: 'and' }
|
||||
]
|
||||
},
|
||||
branch_condition_list: [
|
||||
{ index: 0, height: 115.778, id: '5675' },
|
||||
{ index: 1, height: 115.778, id: '9947' },
|
||||
{ index: 2, height: 115.778, id: '5048' },
|
||||
{ index: 3, height: 40, id: '6750' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'ec6f5581-fef3-45a1-8be1-6611a8c9ccfc',
|
||||
type: 'reply-node',
|
||||
x: 1830,
|
||||
y: -220,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: '指定回复',
|
||||
node_data: {
|
||||
reply_type: 'content',
|
||||
content: '你好我是ai只能机器人,很高兴为你服务',
|
||||
fields: []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '2ac57a56-9150-4f04-a7b9-6390bdaade19',
|
||||
type: 'search-dataset-node',
|
||||
x: 1810,
|
||||
y: 290,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: '知识库检索',
|
||||
fields: [
|
||||
{ label: '段落列表', value: 'paragraph_list' },
|
||||
{ label: '满足直接回答的段落列表', value: 'is_hit_handling_method_list' },
|
||||
{ label: '检索结果', value: 'data' },
|
||||
{ label: '满足直接回答的分段内容', value: 'directly_return' }
|
||||
],
|
||||
node_data: {
|
||||
dataset_id_list: ['8ba47817-28a1-11ef-90fd-a8a1595801ab'],
|
||||
dataset_setting: {
|
||||
top_n: 3,
|
||||
similarity: 0.6,
|
||||
max_paragraph_char_number: 5000,
|
||||
search_mode: 'embedding'
|
||||
},
|
||||
question_reference_address: ['start-node', 'question']
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'bd9dd852-d749-4b42-9b95-80f25b9a606d',
|
||||
type: 'ai-chat-node',
|
||||
x: 2430,
|
||||
y: 310,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: 'AI 对话',
|
||||
fields: [{ label: 'AI 回答内容', value: 'answer' }],
|
||||
node_data: {
|
||||
model_id: '9bdd1ab3-135b-11ef-b688-a8a1595801ab',
|
||||
system: '你是售前咨询知识库',
|
||||
prompt:
|
||||
"已知信息:\n{{context['2ac57a56-9150-4f04-a7b9-6390bdaade19'].data}}\n问题:\n{{context['start-node'].question}}",
|
||||
dialogue_number: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '1cd54877-bfff-4791-b8f5-08c49f8bdf66',
|
||||
type: 'search-dataset-node',
|
||||
x: 1770,
|
||||
y: 840,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: '知识库检索',
|
||||
fields: [
|
||||
{ label: '段落列表', value: 'paragraph_list' },
|
||||
{ label: '满足直接回答的段落列表', value: 'is_hit_handling_method_list' },
|
||||
{ label: '检索结果', value: 'data' },
|
||||
{ label: '满足直接回答的分段内容', value: 'directly_return' }
|
||||
],
|
||||
node_data: {
|
||||
dataset_id_list: ['188c3fa1-28a3-11ef-99e8-a8a1595801ab'],
|
||||
dataset_setting: {
|
||||
top_n: 3,
|
||||
similarity: 0.6,
|
||||
max_paragraph_char_number: 5000,
|
||||
search_mode: 'embedding'
|
||||
},
|
||||
question_reference_address: ['start-node', 'question']
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
type: 'condition-node',
|
||||
x: 2310,
|
||||
y: 930,
|
||||
properties: {
|
||||
noRender: true,
|
||||
width: 600,
|
||||
stepName: '判断器',
|
||||
node_data: {
|
||||
branch: [
|
||||
{
|
||||
conditions: [
|
||||
{
|
||||
field: ['1cd54877-bfff-4791-b8f5-08c49f8bdf66', 'is_hit_handling_method_list'],
|
||||
compare: 'ge',
|
||||
value: '1'
|
||||
}
|
||||
],
|
||||
id: '3014',
|
||||
type: 'IF',
|
||||
condition: 'and'
|
||||
},
|
||||
{
|
||||
conditions: [
|
||||
{
|
||||
field: ['1cd54877-bfff-4791-b8f5-08c49f8bdf66', 'paragraph_list'],
|
||||
compare: 'ge',
|
||||
value: '1'
|
||||
}
|
||||
],
|
||||
type: 'ELSE IF 1',
|
||||
id: '4658',
|
||||
condition: 'and'
|
||||
},
|
||||
{ conditions: [], id: '8871', type: 'ELSE', condition: 'and' }
|
||||
]
|
||||
},
|
||||
branch_condition_list: [
|
||||
{ index: 0, height: 115.778, id: '3014' },
|
||||
{ index: 1, height: 115.778, id: '4658' },
|
||||
{ index: 2, height: 40, id: '8871' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '62ab766b-b218-4bea-895f-b7e83614c8b7',
|
||||
type: 'reply-node',
|
||||
x: 2940,
|
||||
y: 530,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: '指定回复',
|
||||
node_data: {
|
||||
reply_type: 'referencing',
|
||||
content: '',
|
||||
fields: ['1cd54877-bfff-4791-b8f5-08c49f8bdf66', 'directly_return']
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '04837361-30ea-41bd-96bc-768ee58d69d6',
|
||||
type: 'ai-chat-node',
|
||||
x: 2930,
|
||||
y: 1000,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: 'AI 对话',
|
||||
fields: [{ label: 'AI 回答内容', value: 'answer' }],
|
||||
node_data: {
|
||||
model_id: '9bdd1ab3-135b-11ef-b688-a8a1595801ab',
|
||||
system: '你是售后工程师',
|
||||
prompt:
|
||||
"已知信息:\n{{context['1cd54877-bfff-4791-b8f5-08c49f8bdf66'].data}}\n问题:\n{{context['start-node'].question}}",
|
||||
dialogue_number: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'fe4d14fd-9aeb-40ad-b7e0-3d88bf1c5933',
|
||||
type: 'reply-node',
|
||||
x: 2960,
|
||||
y: 1470,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: '指定回复',
|
||||
node_data: { reply_type: 'content', content: '未找到相关内容', fields: [] }
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'c9b74adb-e219-4d2b-8fd5-ecc2bac8786e',
|
||||
type: 'ai-chat-node',
|
||||
x: 1740,
|
||||
y: 1470,
|
||||
properties: {
|
||||
noRender: true,
|
||||
stepName: 'AI 对话',
|
||||
fields: [{ label: 'AI 回答内容', value: 'answer' }],
|
||||
node_data: {
|
||||
model_id: '9bdd1ab3-135b-11ef-b688-a8a1595801ab',
|
||||
system: '',
|
||||
prompt: "{{context['start-node'].question}}",
|
||||
dialogue_number: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
edges: [
|
||||
{
|
||||
id: '21096f2c-d89f-4fb3-b12-61484b0686d4',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'start-node',
|
||||
targetNodeId: 'e781559d-e54b-45d8-bcea-d2d426fd58a3',
|
||||
startPoint: { x: 340, y: 720 },
|
||||
endPoint: { x: 440, y: 560 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 340, y: 720 },
|
||||
{ x: 450, y: 720 },
|
||||
{ x: 330, y: 560 },
|
||||
{ x: 440, y: 560 }
|
||||
],
|
||||
sourceAnchorId: 'start-node_right',
|
||||
targetAnchorId: 'e781559d-e54b-45d8-bcea-d2d426fd58a3_left'
|
||||
},
|
||||
{
|
||||
id: '6019001b-f9e8-4081-9538-ef1e717eac7b',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'e781559d-e54b-45d8-bcea-d2d426fd58a3',
|
||||
targetNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
startPoint: { x: 760, y: 560 },
|
||||
endPoint: { x: 850, y: 284 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 760, y: 560 },
|
||||
{ x: 870, y: 560 },
|
||||
{ x: 740, y: 284 },
|
||||
{ x: 850, y: 284 }
|
||||
],
|
||||
sourceAnchorId: 'e781559d-e54b-45d8-bcea-d2d426fd58a3_right',
|
||||
targetAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_left'
|
||||
},
|
||||
{
|
||||
id: '6dba7e71-c14c-427e-b7de-09f3b1064291',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
targetNodeId: 'ec6f5581-fef3-45a1-8be1-6611a8c9ccfc',
|
||||
startPoint: { x: 1430, y: 127.33350000000002 },
|
||||
endPoint: { x: 1670, y: -220 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 1430, y: 127.33350000000002 },
|
||||
{ x: 1540, y: 127.33350000000002 },
|
||||
{ x: 1560, y: -220 },
|
||||
{ x: 1670, y: -220 }
|
||||
],
|
||||
sourceAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_5675_right',
|
||||
targetAnchorId: 'ec6f5581-fef3-45a1-8be1-6611a8c9ccfc_left'
|
||||
},
|
||||
{
|
||||
id: '45a83361-1dfe-499e-8407-8c1670386b04',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
targetNodeId: '2ac57a56-9150-4f04-a7b9-6390bdaade19',
|
||||
startPoint: { x: 1430, y: 251.11150000000004 },
|
||||
endPoint: { x: 1650, y: 290 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 1430, y: 251.11150000000004 },
|
||||
{ x: 1540, y: 251.11150000000004 },
|
||||
{ x: 1540, y: 290 },
|
||||
{ x: 1650, y: 290 }
|
||||
],
|
||||
sourceAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_9947_right',
|
||||
targetAnchorId: '2ac57a56-9150-4f04-a7b9-6390bdaade19_left'
|
||||
},
|
||||
{
|
||||
id: 'b18a10f9-df1a-415b-b419-cf44229b3345',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: '2ac57a56-9150-4f04-a7b9-6390bdaade19',
|
||||
targetNodeId: 'bd9dd852-d749-4b42-9b95-80f25b9a606d',
|
||||
startPoint: { x: 1970, y: 290 },
|
||||
endPoint: { x: 2270, y: 310 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 1970, y: 290 },
|
||||
{ x: 2080, y: 290 },
|
||||
{ x: 2160, y: 310 },
|
||||
{ x: 2270, y: 310 }
|
||||
],
|
||||
sourceAnchorId: '2ac57a56-9150-4f04-a7b9-6390bdaade19_right',
|
||||
targetAnchorId: 'bd9dd852-d749-4b42-9b95-80f25b9a606d_left'
|
||||
},
|
||||
{
|
||||
id: 'd9b31737-a480-48e5-84b6-a8556d1d68a5',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
targetNodeId: '1cd54877-bfff-4791-b8f5-08c49f8bdf66',
|
||||
startPoint: { x: 1430, y: 374.8895 },
|
||||
endPoint: { x: 1610, y: 840 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 1430, y: 374.8895 },
|
||||
{ x: 1540, y: 374.8895 },
|
||||
{ x: 1500, y: 840 },
|
||||
{ x: 1610, y: 840 }
|
||||
],
|
||||
sourceAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_5048_right',
|
||||
targetAnchorId: '1cd54877-bfff-4791-b8f5-08c49f8bdf66_left'
|
||||
},
|
||||
{
|
||||
id: '32d36445-b2b8-4472-9c86-3a9c147ceea2',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: '1cd54877-bfff-4791-b8f5-08c49f8bdf66',
|
||||
targetNodeId: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
startPoint: { x: 1930, y: 840 },
|
||||
endPoint: { x: 2020, y: 930 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 1930, y: 840 },
|
||||
{ x: 2040, y: 840 },
|
||||
{ x: 1910, y: 930 },
|
||||
{ x: 2020, y: 930 }
|
||||
],
|
||||
sourceAnchorId: '1cd54877-bfff-4791-b8f5-08c49f8bdf66_right',
|
||||
targetAnchorId: 'e99869b2-251f-47a7-9966-c54ffb59b381_left'
|
||||
},
|
||||
{
|
||||
id: '98c9014f-0bfc-4595-9c79-48ea785dc6cd',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
targetNodeId: '62ab766b-b218-4bea-895f-b7e83614c8b7',
|
||||
startPoint: { x: 2600, y: 835.2225 },
|
||||
endPoint: { x: 2780, y: 530 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 2600, y: 835.2225 },
|
||||
{ x: 2710, y: 835.2225 },
|
||||
{ x: 2670, y: 530 },
|
||||
{ x: 2780, y: 530 }
|
||||
],
|
||||
sourceAnchorId: 'e99869b2-251f-47a7-9966-c54ffb59b381_3014_right',
|
||||
targetAnchorId: '62ab766b-b218-4bea-895f-b7e83614c8b7_left'
|
||||
},
|
||||
{
|
||||
id: '57e76e75-5c7f-42cb-a120-cc890243bb17',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
targetNodeId: '04837361-30ea-41bd-96bc-768ee58d69d6',
|
||||
startPoint: { x: 2600, y: 959.0005 },
|
||||
endPoint: { x: 2770, y: 1000 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 2600, y: 959.0005 },
|
||||
{ x: 2710, y: 959.0005 },
|
||||
{ x: 2660, y: 1000 },
|
||||
{ x: 2770, y: 1000 }
|
||||
],
|
||||
sourceAnchorId: 'e99869b2-251f-47a7-9966-c54ffb59b381_4658_right',
|
||||
targetAnchorId: '04837361-30ea-41bd-96bc-768ee58d69d6_left'
|
||||
},
|
||||
{
|
||||
id: '8becdf8e-243a-482a-bdf6-22e947aa9bd2',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
targetNodeId: 'fe4d14fd-9aeb-40ad-b7e0-3d88bf1c5933',
|
||||
startPoint: { x: 2600, y: 1044.8895 },
|
||||
endPoint: { x: 2800, y: 1470 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 2600, y: 1044.8895 },
|
||||
{ x: 2710, y: 1044.8895 },
|
||||
{ x: 2690, y: 1470 },
|
||||
{ x: 2800, y: 1470 }
|
||||
],
|
||||
sourceAnchorId: 'e99869b2-251f-47a7-9966-c54ffb59b381_8871_right',
|
||||
targetAnchorId: 'fe4d14fd-9aeb-40ad-b7e0-3d88bf1c5933_left'
|
||||
},
|
||||
{
|
||||
id: 'f0277552-0d5a-4642-838f-989e59afe350',
|
||||
type: 'app-edge',
|
||||
sourceNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
targetNodeId: 'c9b74adb-e219-4d2b-8fd5-ecc2bac8786e',
|
||||
startPoint: { x: 1430, y: 460.7785 },
|
||||
endPoint: { x: 1580, y: 1470 },
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{ x: 1430, y: 460.7785 },
|
||||
{ x: 1540, y: 460.7785 },
|
||||
{ x: 1470, y: 1470 },
|
||||
{ x: 1580, y: 1470 }
|
||||
],
|
||||
sourceAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_6750_right',
|
||||
targetAnchorId: 'c9b74adb-e219-4d2b-8fd5-ecc2bac8786e_left'
|
||||
}
|
||||
]
|
||||
const props = defineProps({
|
||||
data: Object || null
|
||||
})
|
||||
|
||||
const defaultData = {
|
||||
nodes: [...baseNodes]
|
||||
}
|
||||
const graphData = computed({
|
||||
get: () => {
|
||||
if (props.data) {
|
||||
return props.data
|
||||
} else {
|
||||
return defaultData
|
||||
}
|
||||
},
|
||||
set: (value) => {
|
||||
return value
|
||||
}
|
||||
})
|
||||
|
||||
// const graphData = {
|
||||
// nodes: [
|
||||
// ...baseNodes,
|
||||
// {
|
||||
// id: 'e781559d-e54b-45d8-bcea-d2d426fd58a3',
|
||||
// type: 'ai-chat-node',
|
||||
// x: 600,
|
||||
// y: 560,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: 'AI 对话',
|
||||
// fields: [{ label: 'AI 回答内容', value: 'answer' }],
|
||||
// node_data: {
|
||||
// model_id: '9bdd1ab3-135b-11ef-b688-a8a1595801ab',
|
||||
// system: '你是问题分类大师',
|
||||
// prompt:
|
||||
// "请直接返回所属的问题分类,不要说推理过程。\n用户问题为:{{context['start-node'].question}}\n问题分类是:\n打招呼 \n售前咨询\n售后咨询\n其他咨询",
|
||||
// dialogue_number: 0
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
// type: 'condition-node',
|
||||
// x: 1140,
|
||||
// y: 284,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// width: 600,
|
||||
// stepName: '判断器',
|
||||
// node_data: {
|
||||
// branch: [
|
||||
// {
|
||||
// conditions: [
|
||||
// {
|
||||
// field: ['e781559d-e54b-45d8-bcea-d2d426fd58a3', 'answer'],
|
||||
// compare: 'contain',
|
||||
// value: '打招呼 '
|
||||
// }
|
||||
// ],
|
||||
// id: '5675',
|
||||
// type: 'IF',
|
||||
// condition: 'and'
|
||||
// },
|
||||
// {
|
||||
// conditions: [
|
||||
// {
|
||||
// field: ['e781559d-e54b-45d8-bcea-d2d426fd58a3', 'answer'],
|
||||
// compare: 'contain',
|
||||
// value: '售前咨询'
|
||||
// }
|
||||
// ],
|
||||
// type: 'ELSE IF 1',
|
||||
// id: '9947',
|
||||
// condition: 'and'
|
||||
// },
|
||||
// {
|
||||
// conditions: [
|
||||
// {
|
||||
// field: ['e781559d-e54b-45d8-bcea-d2d426fd58a3', 'answer'],
|
||||
// compare: 'contain',
|
||||
// value: '售后咨询'
|
||||
// }
|
||||
// ],
|
||||
// type: 'ELSE IF 2',
|
||||
// id: '5048',
|
||||
// condition: 'and'
|
||||
// },
|
||||
// { conditions: [], id: '6750', type: 'ELSE', condition: 'and' }
|
||||
// ]
|
||||
// },
|
||||
// branch_condition_list: [
|
||||
// { index: 0, height: 115.778, id: '5675' },
|
||||
// { index: 1, height: 115.778, id: '9947' },
|
||||
// { index: 2, height: 115.778, id: '5048' },
|
||||
// { index: 3, height: 40, id: '6750' }
|
||||
// ]
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'ec6f5581-fef3-45a1-8be1-6611a8c9ccfc',
|
||||
// type: 'reply-node',
|
||||
// x: 1830,
|
||||
// y: -220,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: '指定回复',
|
||||
// node_data: {
|
||||
// reply_type: 'content',
|
||||
// content: '你好我是ai只能机器人,很高兴为你服务',
|
||||
// fields: []
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: '2ac57a56-9150-4f04-a7b9-6390bdaade19',
|
||||
// type: 'search-dataset-node',
|
||||
// x: 1810,
|
||||
// y: 290,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: '知识库检索',
|
||||
// fields: [
|
||||
// { label: '段落列表', value: 'paragraph_list' },
|
||||
// { label: '满足直接回答的段落列表', value: 'is_hit_handling_method_list' },
|
||||
// { label: '检索结果', value: 'data' },
|
||||
// { label: '满足直接回答的分段内容', value: 'directly_return' }
|
||||
// ],
|
||||
// node_data: {
|
||||
// dataset_id_list: ['8ba47817-28a1-11ef-90fd-a8a1595801ab'],
|
||||
// dataset_setting: {
|
||||
// top_n: 3,
|
||||
// similarity: 0.6,
|
||||
// max_paragraph_char_number: 5000,
|
||||
// search_mode: 'embedding'
|
||||
// },
|
||||
// question_reference_address: ['start-node', 'question']
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'bd9dd852-d749-4b42-9b95-80f25b9a606d',
|
||||
// type: 'ai-chat-node',
|
||||
// x: 2430,
|
||||
// y: 310,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: 'AI 对话',
|
||||
// fields: [{ label: 'AI 回答内容', value: 'answer' }],
|
||||
// node_data: {
|
||||
// model_id: '9bdd1ab3-135b-11ef-b688-a8a1595801ab',
|
||||
// system: '你是售前咨询知识库',
|
||||
// prompt:
|
||||
// "已知信息:\n{{context['2ac57a56-9150-4f04-a7b9-6390bdaade19'].data}}\n问题:\n{{context['start-node'].question}}",
|
||||
// dialogue_number: 0
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: '1cd54877-bfff-4791-b8f5-08c49f8bdf66',
|
||||
// type: 'search-dataset-node',
|
||||
// x: 1770,
|
||||
// y: 840,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: '知识库检索',
|
||||
// fields: [
|
||||
// { label: '段落列表', value: 'paragraph_list' },
|
||||
// { label: '满足直接回答的段落列表', value: 'is_hit_handling_method_list' },
|
||||
// { label: '检索结果', value: 'data' },
|
||||
// { label: '满足直接回答的分段内容', value: 'directly_return' }
|
||||
// ],
|
||||
// node_data: {
|
||||
// dataset_id_list: ['188c3fa1-28a3-11ef-99e8-a8a1595801ab'],
|
||||
// dataset_setting: {
|
||||
// top_n: 3,
|
||||
// similarity: 0.6,
|
||||
// max_paragraph_char_number: 5000,
|
||||
// search_mode: 'embedding'
|
||||
// },
|
||||
// question_reference_address: ['start-node', 'question']
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
// type: 'condition-node',
|
||||
// x: 2310,
|
||||
// y: 930,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// width: 600,
|
||||
// stepName: '判断器',
|
||||
// node_data: {
|
||||
// branch: [
|
||||
// {
|
||||
// conditions: [
|
||||
// {
|
||||
// field: ['1cd54877-bfff-4791-b8f5-08c49f8bdf66', 'is_hit_handling_method_list'],
|
||||
// compare: 'ge',
|
||||
// value: '1'
|
||||
// }
|
||||
// ],
|
||||
// id: '3014',
|
||||
// type: 'IF',
|
||||
// condition: 'and'
|
||||
// },
|
||||
// {
|
||||
// conditions: [
|
||||
// {
|
||||
// field: ['1cd54877-bfff-4791-b8f5-08c49f8bdf66', 'paragraph_list'],
|
||||
// compare: 'ge',
|
||||
// value: '1'
|
||||
// }
|
||||
// ],
|
||||
// type: 'ELSE IF 1',
|
||||
// id: '4658',
|
||||
// condition: 'and'
|
||||
// },
|
||||
// { conditions: [], id: '8871', type: 'ELSE', condition: 'and' }
|
||||
// ]
|
||||
// },
|
||||
// branch_condition_list: [
|
||||
// { index: 0, height: 115.778, id: '3014' },
|
||||
// { index: 1, height: 115.778, id: '4658' },
|
||||
// { index: 2, height: 40, id: '8871' }
|
||||
// ]
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: '62ab766b-b218-4bea-895f-b7e83614c8b7',
|
||||
// type: 'reply-node',
|
||||
// x: 2940,
|
||||
// y: 530,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: '指定回复',
|
||||
// node_data: {
|
||||
// reply_type: 'referencing',
|
||||
// content: '',
|
||||
// fields: ['1cd54877-bfff-4791-b8f5-08c49f8bdf66', 'directly_return']
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: '04837361-30ea-41bd-96bc-768ee58d69d6',
|
||||
// type: 'ai-chat-node',
|
||||
// x: 2930,
|
||||
// y: 1000,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: 'AI 对话',
|
||||
// fields: [{ label: 'AI 回答内容', value: 'answer' }],
|
||||
// node_data: {
|
||||
// model_id: '9bdd1ab3-135b-11ef-b688-a8a1595801ab',
|
||||
// system: '你是售后工程师',
|
||||
// prompt:
|
||||
// "已知信息:\n{{context['1cd54877-bfff-4791-b8f5-08c49f8bdf66'].data}}\n问题:\n{{context['start-node'].question}}",
|
||||
// dialogue_number: 0
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'fe4d14fd-9aeb-40ad-b7e0-3d88bf1c5933',
|
||||
// type: 'reply-node',
|
||||
// x: 2960,
|
||||
// y: 1470,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: '指定回复',
|
||||
// node_data: { reply_type: 'content', content: '未找到相关内容', fields: [] }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'c9b74adb-e219-4d2b-8fd5-ecc2bac8786e',
|
||||
// type: 'ai-chat-node',
|
||||
// x: 1740,
|
||||
// y: 1470,
|
||||
// properties: {
|
||||
// noRender: true,
|
||||
// stepName: 'AI 对话',
|
||||
// fields: [{ label: 'AI 回答内容', value: 'answer' }],
|
||||
// node_data: {
|
||||
// model_id: '9bdd1ab3-135b-11ef-b688-a8a1595801ab',
|
||||
// system: '',
|
||||
// prompt: "{{context['start-node'].question}}",
|
||||
// dialogue_number: 0
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
// edges: [
|
||||
// {
|
||||
// id: '21096f2c-d89f-4fb3-b12-61484b0686d4',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'start-node',
|
||||
// targetNodeId: 'e781559d-e54b-45d8-bcea-d2d426fd58a3',
|
||||
// startPoint: { x: 340, y: 720 },
|
||||
// endPoint: { x: 440, y: 560 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 340, y: 720 },
|
||||
// { x: 450, y: 720 },
|
||||
// { x: 330, y: 560 },
|
||||
// { x: 440, y: 560 }
|
||||
// ],
|
||||
// sourceAnchorId: 'start-node_right',
|
||||
// targetAnchorId: 'e781559d-e54b-45d8-bcea-d2d426fd58a3_left'
|
||||
// },
|
||||
// {
|
||||
// id: '6019001b-f9e8-4081-9538-ef1e717eac7b',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'e781559d-e54b-45d8-bcea-d2d426fd58a3',
|
||||
// targetNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
// startPoint: { x: 760, y: 560 },
|
||||
// endPoint: { x: 850, y: 284 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 760, y: 560 },
|
||||
// { x: 870, y: 560 },
|
||||
// { x: 740, y: 284 },
|
||||
// { x: 850, y: 284 }
|
||||
// ],
|
||||
// sourceAnchorId: 'e781559d-e54b-45d8-bcea-d2d426fd58a3_right',
|
||||
// targetAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_left'
|
||||
// },
|
||||
// {
|
||||
// id: '6dba7e71-c14c-427e-b7de-09f3b1064291',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
// targetNodeId: 'ec6f5581-fef3-45a1-8be1-6611a8c9ccfc',
|
||||
// startPoint: { x: 1430, y: 127.33350000000002 },
|
||||
// endPoint: { x: 1670, y: -220 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 1430, y: 127.33350000000002 },
|
||||
// { x: 1540, y: 127.33350000000002 },
|
||||
// { x: 1560, y: -220 },
|
||||
// { x: 1670, y: -220 }
|
||||
// ],
|
||||
// sourceAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_5675_right',
|
||||
// targetAnchorId: 'ec6f5581-fef3-45a1-8be1-6611a8c9ccfc_left'
|
||||
// },
|
||||
// {
|
||||
// id: '45a83361-1dfe-499e-8407-8c1670386b04',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
// targetNodeId: '2ac57a56-9150-4f04-a7b9-6390bdaade19',
|
||||
// startPoint: { x: 1430, y: 251.11150000000004 },
|
||||
// endPoint: { x: 1650, y: 290 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 1430, y: 251.11150000000004 },
|
||||
// { x: 1540, y: 251.11150000000004 },
|
||||
// { x: 1540, y: 290 },
|
||||
// { x: 1650, y: 290 }
|
||||
// ],
|
||||
// sourceAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_9947_right',
|
||||
// targetAnchorId: '2ac57a56-9150-4f04-a7b9-6390bdaade19_left'
|
||||
// },
|
||||
// {
|
||||
// id: 'b18a10f9-df1a-415b-b419-cf44229b3345',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: '2ac57a56-9150-4f04-a7b9-6390bdaade19',
|
||||
// targetNodeId: 'bd9dd852-d749-4b42-9b95-80f25b9a606d',
|
||||
// startPoint: { x: 1970, y: 290 },
|
||||
// endPoint: { x: 2270, y: 310 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 1970, y: 290 },
|
||||
// { x: 2080, y: 290 },
|
||||
// { x: 2160, y: 310 },
|
||||
// { x: 2270, y: 310 }
|
||||
// ],
|
||||
// sourceAnchorId: '2ac57a56-9150-4f04-a7b9-6390bdaade19_right',
|
||||
// targetAnchorId: 'bd9dd852-d749-4b42-9b95-80f25b9a606d_left'
|
||||
// },
|
||||
// {
|
||||
// id: 'd9b31737-a480-48e5-84b6-a8556d1d68a5',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
// targetNodeId: '1cd54877-bfff-4791-b8f5-08c49f8bdf66',
|
||||
// startPoint: { x: 1430, y: 374.8895 },
|
||||
// endPoint: { x: 1610, y: 840 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 1430, y: 374.8895 },
|
||||
// { x: 1540, y: 374.8895 },
|
||||
// { x: 1500, y: 840 },
|
||||
// { x: 1610, y: 840 }
|
||||
// ],
|
||||
// sourceAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_5048_right',
|
||||
// targetAnchorId: '1cd54877-bfff-4791-b8f5-08c49f8bdf66_left'
|
||||
// },
|
||||
// {
|
||||
// id: '32d36445-b2b8-4472-9c86-3a9c147ceea2',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: '1cd54877-bfff-4791-b8f5-08c49f8bdf66',
|
||||
// targetNodeId: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
// startPoint: { x: 1930, y: 840 },
|
||||
// endPoint: { x: 2020, y: 930 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 1930, y: 840 },
|
||||
// { x: 2040, y: 840 },
|
||||
// { x: 1910, y: 930 },
|
||||
// { x: 2020, y: 930 }
|
||||
// ],
|
||||
// sourceAnchorId: '1cd54877-bfff-4791-b8f5-08c49f8bdf66_right',
|
||||
// targetAnchorId: 'e99869b2-251f-47a7-9966-c54ffb59b381_left'
|
||||
// },
|
||||
// {
|
||||
// id: '98c9014f-0bfc-4595-9c79-48ea785dc6cd',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
// targetNodeId: '62ab766b-b218-4bea-895f-b7e83614c8b7',
|
||||
// startPoint: { x: 2600, y: 835.2225 },
|
||||
// endPoint: { x: 2780, y: 530 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 2600, y: 835.2225 },
|
||||
// { x: 2710, y: 835.2225 },
|
||||
// { x: 2670, y: 530 },
|
||||
// { x: 2780, y: 530 }
|
||||
// ],
|
||||
// sourceAnchorId: 'e99869b2-251f-47a7-9966-c54ffb59b381_3014_right',
|
||||
// targetAnchorId: '62ab766b-b218-4bea-895f-b7e83614c8b7_left'
|
||||
// },
|
||||
// {
|
||||
// id: '57e76e75-5c7f-42cb-a120-cc890243bb17',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
// targetNodeId: '04837361-30ea-41bd-96bc-768ee58d69d6',
|
||||
// startPoint: { x: 2600, y: 959.0005 },
|
||||
// endPoint: { x: 2770, y: 1000 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 2600, y: 959.0005 },
|
||||
// { x: 2710, y: 959.0005 },
|
||||
// { x: 2660, y: 1000 },
|
||||
// { x: 2770, y: 1000 }
|
||||
// ],
|
||||
// sourceAnchorId: 'e99869b2-251f-47a7-9966-c54ffb59b381_4658_right',
|
||||
// targetAnchorId: '04837361-30ea-41bd-96bc-768ee58d69d6_left'
|
||||
// },
|
||||
// {
|
||||
// id: '8becdf8e-243a-482a-bdf6-22e947aa9bd2',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'e99869b2-251f-47a7-9966-c54ffb59b381',
|
||||
// targetNodeId: 'fe4d14fd-9aeb-40ad-b7e0-3d88bf1c5933',
|
||||
// startPoint: { x: 2600, y: 1044.8895 },
|
||||
// endPoint: { x: 2800, y: 1470 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 2600, y: 1044.8895 },
|
||||
// { x: 2710, y: 1044.8895 },
|
||||
// { x: 2690, y: 1470 },
|
||||
// { x: 2800, y: 1470 }
|
||||
// ],
|
||||
// sourceAnchorId: 'e99869b2-251f-47a7-9966-c54ffb59b381_8871_right',
|
||||
// targetAnchorId: 'fe4d14fd-9aeb-40ad-b7e0-3d88bf1c5933_left'
|
||||
// },
|
||||
// {
|
||||
// id: 'f0277552-0d5a-4642-838f-989e59afe350',
|
||||
// type: 'app-edge',
|
||||
// sourceNodeId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382',
|
||||
// targetNodeId: 'c9b74adb-e219-4d2b-8fd5-ecc2bac8786e',
|
||||
// startPoint: { x: 1430, y: 460.7785 },
|
||||
// endPoint: { x: 1580, y: 1470 },
|
||||
// properties: {},
|
||||
// pointsList: [
|
||||
// { x: 1430, y: 460.7785 },
|
||||
// { x: 1540, y: 460.7785 },
|
||||
// { x: 1470, y: 1470 },
|
||||
// { x: 1580, y: 1470 }
|
||||
// ],
|
||||
// sourceAnchorId: 'c94a8bfb-34b0-4b1b-8456-0a164870d382_6750_right',
|
||||
// targetAnchorId: 'c9b74adb-e219-4d2b-8fd5-ecc2bac8786e_left'
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
const lf = ref()
|
||||
const TRANSLATION_DISTANCE = 40
|
||||
|
|
@ -524,7 +544,7 @@ onMounted(() => {
|
|||
lf.value.batchRegister([...Object.keys(nodes).map((key) => nodes[key].default), AppEdge])
|
||||
lf.value.setDefaultEdgeType('app-edge')
|
||||
|
||||
lf.value.render(graphData)
|
||||
lf.value.render(graphData.value)
|
||||
|
||||
lf.value.graphModel.eventCenter.on('delete_edge', (id_list: Array<string>) => {
|
||||
id_list.forEach((id: string) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue