<template>
|
<NodeBasicLayout
|
v-model:title="data.title"
|
:type="NodeType.Start"
|
:description="VueFlowHelper.getConfigValue(data, 'description', '工作流运行的起始节点。')"
|
>
|
<FieldLayout :title="VueFlowHelper.getConfigValue(varListConfig, 'name', '流程参数')">
|
<el-table class="flex-auto" :data="varList" border>
|
<el-table-column prop="name" width="170" label="参数名" fixed>
|
<template #default="scope">
|
<el-input v-model="scope.row.name"></el-input>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column prop="type" width="220" label="类型">
|
<template #default="scope">
|
<el-select v-model="scope.row.type">
|
<el-option
|
v-for="item in Object.keys(parameterTypeMap)"
|
:key="item"
|
:value="item"
|
:label="parameterTypeMap[item]"
|
></el-option>
|
</el-select>
|
</template>
|
</el-table-column> -->
|
<el-table-column prop="description" width="380" label="描述">
|
<template #default="scope">
|
<el-input class="nowheel" type="textarea" :autosize="{ minRows: 1, maxRows: 6 }" v-model="scope.row.description"></el-input>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column prop="isRequired" width="56" label="必填">
|
<template #default="scope">
|
<el-checkbox v-model="scope.row.isRequired"></el-checkbox>
|
</template>
|
</el-table-column> -->
|
|
<el-table-column label="操作" width="55" fixed="right">
|
<template #default="scope">
|
<el-tooltip effect="dark" content="删除" placement="top">
|
<i
|
class="ywifont ywicon-shanchu !text-[17px] text-red-400 cursor-pointer"
|
@click="handleClickDeleteBtn(scope.$index)"
|
></i>
|
</el-tooltip>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-button class="w-fit" type="primary" @click="handleClickAddBtn">添加参数</el-button>
|
</FieldLayout>
|
<Handle :id="handleId" type="source" :position="Position.Right" />
|
</NodeBasicLayout>
|
</template>
|
|
<script lang="ts" setup>
|
import { Handle, Position, useNode, useVueFlow } from '@vue-flow/core';
|
import { ref } from 'vue';
|
|
import type { NodeProps } from '@vue-flow/core';
|
import { VueFlowHelper } from '../../VueFlowHelper';
|
import { NodeType, parameterTypeMap } from '../../vueFlowEnum';
|
import { LLMNodeData, LLMNodeEvents } from './index';
|
|
import NodeBasicLayout from './components/NodeBasicLayout.vue';
|
import FieldLayout from './components/FieldLayout.vue';
|
defineProps<NodeProps<LLMNodeData, LLMNodeEvents>>();
|
const node = useNode();
|
const handleId = ref(VueFlowHelper.getHandleId(node.node, 'source'));
|
|
const data = ref(node.node.data);
|
|
const varList = ref(VueFlowHelper.getFieldValue(data.value, 'var_list'));
|
|
function handleClickAddBtn() {
|
varList.value.push({
|
name: '',
|
description: '',
|
type: '',
|
isRequired: true,
|
});
|
}
|
const varListConfig = ref(VueFlowHelper.getGroupParam(data.value, 0));
|
|
const varListParam = ref(VueFlowHelper.getParams(varListConfig.value, 'var_list'));
|
|
VueFlowHelper.getConfigValue(varListParam.value, 'label', '');
|
|
function handleClickDeleteBtn(index: number) {
|
varList.value.splice(index, 1);
|
}
|
</script>
|