From 2144fb07b53812f565b2801f99e69cee9b28cab3 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期三, 11 十二月 2024 17:26:57 +0800
Subject: [PATCH] 代理、输出

---
 src/components/vue-flow/VueFlowHelper.ts |   84 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 83 insertions(+), 1 deletions(-)

diff --git a/src/components/vue-flow/VueFlowHelper.ts b/src/components/vue-flow/VueFlowHelper.ts
index cbb0d0e..760090e 100644
--- a/src/components/vue-flow/VueFlowHelper.ts
+++ b/src/components/vue-flow/VueFlowHelper.ts
@@ -9,7 +9,7 @@
 		return uuid().slice(0, 8);
 	}
 
-	static genGeometryId(){
+	static genGeometryId() {
 		return uuid().slice(0, 12);
 	}
 
@@ -46,6 +46,77 @@
 					},
 				];
 				break;
+			case NodeType.LLM:
+				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
+					{
+						name: '妯″瀷璁剧疆',
+
+						[VueFlowConstant.PARAMS_KEY]: [
+							{
+								key: 'llm_model',
+								label: '妯″瀷',
+								type: 'llm_model',
+								value: '',
+								required: true,
+								placeholder: '璇烽�夋嫨妯″瀷',
+							},
+							{ key: 'temperature', label: '娓╁害', type: 'slide', scope: [0, 2], step: 0.1, value: 0.6 },
+						],
+					},
+					{
+						name: '鎻愮ず璇�',
+						[VueFlowConstant.PARAMS_KEY]: [{ key: 'prompt', label: '鎻愮ず璇�', type: 'textarea', value: '' }],
+					},
+				];
+				break;
+
+			case NodeType.Agent:
+				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
+					{
+
+						[VueFlowConstant.PARAMS_KEY]: [
+							{
+								key: 'agent',
+								label: '浠g悊',
+								type: 'agent_input',
+								value: '',
+								required: true,
+								placeholder: '浠g悊',
+							},
+						],
+					},
+					
+				];
+				break;
+			case NodeType.Output:
+				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
+					{
+
+						[VueFlowConstant.PARAMS_KEY]: [
+							{
+								key: 'output_msg',
+								label: '娑堟伅鍐呭',
+								type: 'var_textarea_file',
+								required: true,
+								placeholder:
+									'杈撳叆闇�瑕佸彂閫佺粰鐢ㄦ埛鐨勬秷鎭紝渚嬪鈥滄帴涓嬫潵鎴戝皢鎵ц XX 鎿嶄綔锛岃鎮ㄧ‘璁も�濓紝鈥滀互涓嬫槸鎴戠殑鍒濈増鑽夌锛屾偍鍙互鍦ㄥ叾鍩虹涓婅繘琛屼慨鏀光��',
+								value: { msg: '', files: [] },
+							},
+							{
+								key: 'output_result',
+								label: '浜や簰绫诲瀷',
+								global: 'value.type=input',
+								type: 'output_form',
+								required: true,
+								value: { type: 'none', value: '' },
+								options: [
+									
+								],
+							},
+						],
+					},
+				];
+
 			default:
 				break;
 		}
@@ -82,6 +153,15 @@
 			return varList;
 		}
 	};
+
+	static getGroupParam = (data, index = 0) => {
+		const group = data?.[VueFlowConstant.GROUP_PARAMS_KEY]?.[index];
+		return group;
+	};
+
+	static getParams = (group, key) => {
+		return group?.[VueFlowConstant.PARAMS_KEY]?.find((item) => item.key === key);
+	};
 }
 
 export class StartNodeHelper {
@@ -104,6 +184,7 @@
 		left?: {
 			var: string;
 			label: string;
+			value: string;
 		},
 		right?: {
 			type: VarType;
@@ -116,6 +197,7 @@
 			id: VueFlowHelper.genId(),
 			left_var: left?.var ?? '',
 			left_label: left?.label ?? '',
+			left_value: left?.var ?? '',
 			comparison_operation: operation ?? '',
 			right_value_type: right?.type ?? VarType.Input,
 			right_value: right?.value ?? '',

--
Gitblit v1.9.3