| | |
| | | |
| | | <div class="flex-auto gap-y-2 flex-col flex nodrag"> |
| | | <div class="text-lg font-bold">参数</div> |
| | | <el-table size="small" class="flex-auto" :data="parameterTable" border> |
| | | <el-table size="small" class="flex-auto" :data="varList" border> |
| | | <el-table-column prop="name" width="90" label="参数名" fixed> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.name"></el-input> |
| | |
| | | |
| | | <script lang="ts" setup> |
| | | import { Handle, Position, useNode, useVueFlow } from '@vue-flow/core'; |
| | | import { ref } from 'vue'; |
| | | import { ref, watchEffect } from 'vue'; |
| | | |
| | | import type { NodeProps } from '@vue-flow/core'; |
| | | import { computed } from 'vue'; |
| | | import { VueFlowConstant } from '../../VueFlowConstant'; |
| | | import { VueFlowHelper } from '../../VueFlowHelper'; |
| | | import { parameterTypeMap } from '../../vueFlowEnum'; |
| | | import { LLMNodeData, LLMNodeEvents } from './index'; |
| | | import { deepClone } from '/@/utils/other'; |
| | | import { VueFlowHelper } from '../../VueFlowHelper'; |
| | | |
| | | defineProps<NodeProps<LLMNodeData, LLMNodeEvents>>(); |
| | | |
| | |
| | | const handleId = ref(VueFlowHelper.getHandleId(node.node, 'source')); |
| | | |
| | | const data = ref(node.node.data); |
| | | const titleIsEdit = ref(false); |
| | | const parameterTable = computed(() => data.value[VueFlowConstant.PARAMS_KEY]); |
| | | function handleClickAddBtn() { |
| | | if (!data.value[VueFlowConstant.PARAMS_KEY]) { |
| | | data.value[VueFlowConstant.PARAMS_KEY] = []; |
| | | } |
| | | |
| | | data.value[VueFlowConstant.PARAMS_KEY].push({ |
| | | const getVarList = () =>{ |
| | | const varList = data.value[VueFlowConstant.GROUP_PARAMS_KEY][0][VueFlowConstant.PARAMS_KEY].find( |
| | | (item) => item.key === 'condition' |
| | | ).value; |
| | | return varList; |
| | | } |
| | | |
| | | const varList = ref(VueFlowHelper.getFieldValue(data.value,'var_list')); |
| | | const titleIsEdit = ref(false); |
| | | |
| | | function handleClickAddBtn() { |
| | | |
| | | |
| | | varList.value.push({ |
| | | name: '', |
| | | description: '', |
| | | type: '', |
| | |
| | | } |
| | | |
| | | function handleClickDeleteBtn(index: number) { |
| | | data.value[VueFlowConstant.PARAMS_KEY].splice(index, 1); |
| | | varList.value.splice(index, 1); |
| | | } |
| | | const { removeNodes, nodes, addNodes } = useVueFlow(); |
| | | |
| | | function handleClickDuplicateBtn() { |
| | | const { type, position, data } = node.node; |
| | | const newNode = { |
| | | id: (nodes.value.length + 1).toString(), |
| | | id: VueFlowHelper.genGeometryId(), |
| | | type, |
| | | position: { |
| | | x: position.x + 100, |
| | |
| | | const clickDeleteBtn = () => { |
| | | removeNodes(node.id); |
| | | }; |
| | | |
| | | |
| | | |
| | | </script> |