From dd407c5da58ca201a1fc91af028ace3a6491853b Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 23 十二月 2024 11:21:33 +0800 Subject: [PATCH] 输出参数名 --- src/components/vue-flow/ui/nodes/LLMNode.vue | 144 ++++++++++++++--------------------------------- 1 files changed, 44 insertions(+), 100 deletions(-) diff --git a/src/components/vue-flow/ui/nodes/LLMNode.vue b/src/components/vue-flow/ui/nodes/LLMNode.vue index c90e462..f114e2d 100644 --- a/src/components/vue-flow/ui/nodes/LLMNode.vue +++ b/src/components/vue-flow/ui/nodes/LLMNode.vue @@ -1,85 +1,48 @@ <template> - <div - class="w-max-[520px] border-2 rounded-lg border-solid border-gray-100 bg-white p-3 shadow-md relative hover:border-blue-500 group" + <NodeBasicLayout + v-model:title="data.title" + :type="NodeType.LLM" + :description="VueFlowHelper.getConfigValue(data, 'description', '璋冪敤澶фā鍨嬪洖绛旂敤鎴烽棶棰樻垨鑰呭鐞嗕换鍔°��')" > <Handle :id="targetHandleId" type="target" :position="Position.Left" /> - <div - class="group-hover:visible invisible flex absolute divide-y-[1.5px] divide-solid divide-gray-100 rounded-lg right-0 -top-0.5 translate-y-[-100%]" - style="box-shadow: 0 0 15px #dbdee6" - > - <el-tooltip effect="dark" content="澶嶅埗" placement="top"> - <div - class="flex content-center items-center border-x-0 p-1 hover:bg-gray-200 active:bg-gray-300 cursor-pointer" - @click="handleClickDuplicateBtn" - > - <span class="ywifont !text-[20px] mb-1 p-1.5 ywicon-copy"></span> + <FieldLayout :title="outputParam.name"> + <el-input class="w-full flex-0" v-model="outputParam.params[0].value" placeholder="杈撳嚭鍙傛暟鍚�"> </el-input> + </FieldLayout> + <FieldLayout :title="VueFlowHelper.getConfigValue(modelSetting, 'name', '妯″瀷璁剧疆')"> + <div class="w-[340px] flex-items-center gap-x-2"> + <div class="flex-column gap-y-1.5"> + <span class="text-gray-500">{{ VueFlowHelper.getParams(modelSetting, 'llm_model').label }}</span> + + <el-select + v-model="VueFlowHelper.getParams(modelSetting, 'llm_model').value" + class="w-[150px]" + :placeholder="VueFlowHelper.getParams(modelSetting, 'llm_model').placeholder" + > + <el-option v-for="item in VueFlowConstant.LLM_MODEL_LIST" :key="item.value" :label="item.label" :value="item.value" /> + </el-select> </div> - </el-tooltip> - <el-tooltip effect="dark" content="鍒犻櫎" placement="top"> - <div - @click="clickDeleteBtn" - class="flex content-center items-center border-x-0 p-1 hover:bg-gray-200 active:bg-gray-300 hover:text-red-400 cursor-pointer" - > - <span class="ywifont !text-[20px] mb-1 p-1.5 ywicon-shanchu"></span> - </div> - </el-tooltip> - </div> - <div class="flex flex-col gap-y-2"> - <div class="flex justify-between flex-0"> - <div class="flex items-center gap-x-2"> - <YWIcon - :name="VueFlowConfig.nodeStyleMap.get(NodeType.LLM).icon" - :fontSize="VueFlowConfig.nodeStyleMap.get(NodeType.LLM).fontSize" - :color="VueFlowConfig.nodeStyleMap.get(NodeType.LLM).color" - class="rounded-lg p-1.5" - :class="VueFlowConfig.nodeStyleMap.get(NodeType.LLM).class" - /> - <div class="flex flex-col gap-y-1"> - <p v-if="!titleIsEdit" class="text-xl font-bold text-gray-500" @click="titleIsEdit = true">{{ data.title }}</p> - <el-input v-else v-elInputFocus="false" v-model="data.title" @blur="() => (titleIsEdit = false)"></el-input> - </div> + <div class="flex-column gap-y-1.5"> + <span class="text-gray-500">{{ VueFlowHelper.getParams(modelSetting, 'temperature').label }}</span> + <el-input-number + v-model="VueFlowHelper.getParams(modelSetting, 'temperature').value" + class="w-[180px]" + placeholder="" + ></el-input-number> </div> </div> - - <div class="flex-auto gap-y-2 flex-col flex nodrag"> - <div class="text-lg font-bold">妯″瀷璁剧疆</div> - - <div class="min-w-[340px] flex-items-center gap-x-2"> - <div class="flex-column gap-y-1.5"> - <span class="text-gray-500">妯″瀷</span> - - <el-select v-model="VueFlowHelper.getParams(modelSetting, 'llm_model').value" class="w-[150px]" placeholder="璇烽�夋嫨妯″瀷"> - <el-option v-for="item in VueFlowConstant.LLM_MODEL_LIST" :key="item.value" :label="item.label" :value="item.value" /> - </el-select> - </div> - <div class="flex-column gap-y-1.5"> - <span class="text-gray-500">娓╁害</span> - <el-input-number - v-model="VueFlowHelper.getParams(modelSetting, 'temperature').value" - class="w-[180px]" - placeholder="娓╁害" - ></el-input-number> - </div> - </div> - </div> - - <div class="flex-auto gap-y-2 flex-col flex nodrag w-full"> - <div class="text-lg font-bold">鎻愮ず璇�</div> - - <div class="flex-column gap-y-1.5 w-full"> - <!-- <span class="text-gray-500">妯″瀷</span> --> - <el-input v-model="VueFlowHelper.getParams(prompt, 'prompt').value" type="textarea" :rows="3" autocomplete="off"> </el-input> - </div> - </div> - </div> + </FieldLayout> + <FieldLayout :title="prompt.name"> + <el-input + class="nowheel" + v-model="VueFlowHelper.getParams(prompt, 'prompt').value" + type="textarea" + :autosize="{ minRows: 3, maxRows: 6 }" + autocomplete="off" + > + </el-input> + </FieldLayout> <Handle :id="sourceHandleId" type="source" :position="Position.Right" /> - </div> - - <!-- <div> - <span>璧峰</span> - - <Handle type="source" :position="Position.Right" /> - </div> --> + </NodeBasicLayout> </template> <script lang="ts" setup> @@ -89,10 +52,12 @@ import type { NodeProps } from '@vue-flow/core'; import { VueFlowConstant } from '../../VueFlowConstant'; import { VueFlowHelper } from '../../VueFlowHelper'; -import { LLMNodeData, LLMNodeEvents } from './index'; +import type { LLMNodeData, LLMNodeEvents } from './index'; import { deepClone } from '/@/utils/other'; import { NodeType } from '../../vueFlowEnum'; -import { VueFlowConfig } from '../VueFlowConfig'; + +import FieldLayout from './components/FieldLayout.vue'; +import NodeBasicLayout from './components/NodeBasicLayout.vue'; defineProps<NodeProps<LLMNodeData, LLMNodeEvents>>(); @@ -101,29 +66,8 @@ const targetHandleId = ref(VueFlowHelper.getHandleId(node.node, 'target')); const data = ref(node.node.data); - -const varList = ref(VueFlowHelper.getFieldValue(data.value, 'var_list')); -const titleIsEdit = ref(false); - const modelSetting = ref(VueFlowHelper.getGroupParam(data.value, 0)); const prompt = ref(VueFlowHelper.getGroupParam(data.value, 1)); - -const { removeNodes, nodes, addNodes } = useVueFlow(); - -function handleClickDuplicateBtn() { - const { type, position, data } = node.node; - const newNode = { - id: VueFlowHelper.genGeometryId(), - type, - position: { - x: position.x + 100, - y: position.y + 100, - }, - data: deepClone(data), - }; - addNodes(newNode); -} -const clickDeleteBtn = () => { - removeNodes(node.id); -}; +const outputParam = ref(VueFlowHelper.getGroupParam(data.value, 2)); +VueFlowHelper.getConfigValue(VueFlowHelper.getParams(prompt.value, 'prompt'), 'label', ''); </script> -- Gitblit v1.9.3