From 10ab6a46af767c69c290e9baf07079910e282a4e Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期一, 16 十二月 2024 17:31:44 +0800
Subject: [PATCH] 发布、调整输入框大小

---
 src/components/vue-flow/VueFlowHelper.ts |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 112 insertions(+), 8 deletions(-)

diff --git a/src/components/vue-flow/VueFlowHelper.ts b/src/components/vue-flow/VueFlowHelper.ts
index 6eaef88..842f394 100644
--- a/src/components/vue-flow/VueFlowHelper.ts
+++ b/src/components/vue-flow/VueFlowHelper.ts
@@ -19,6 +19,10 @@
 		};
 		switch (type) {
 			case NodeType.Start:
+				data = {
+					...data,
+					description: '宸ヤ綔娴佽繍琛岀殑璧峰鑺傜偣銆�',
+				};
 				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
 					{
 						[VueFlowConstant.PARAMS_KEY]: [
@@ -32,7 +36,17 @@
 					},
 				];
 				break;
+			case NodeType.End:
+				data = {
+					...data,
+					description: '宸ヤ綔娴佽繍琛屽埌姝ょ粨鏉熴��',
+				};
+				break;
 			case NodeType.Condition:
+				data = {
+					...data,
+					description: '鏍规嵁鏉′欢琛ㄨ揪寮忔墽琛屼笉鍚岀殑鍒嗘敮銆�',
+				};
 				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
 					{
 						[VueFlowConstant.PARAMS_KEY]: [
@@ -40,13 +54,17 @@
 								key: 'condition',
 								label: '',
 								type: 'condition',
-								value: [ConditionHelper.getDefaultConditionGroup(),ConditionHelper.getDefaultConditionGroup(true)],
+								value: [ConditionHelper.getDefaultConditionGroup(), ConditionHelper.getDefaultConditionGroup(true)],
 							},
 						],
 					},
 				];
 				break;
 			case NodeType.LLM:
+				data = {
+					...data,
+					description: '璋冪敤澶фā鍨嬪洖绛旂敤鎴烽棶棰樻垨鑰呭鐞嗕换鍔°��',
+				};
 				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
 					{
 						name: '妯″瀷璁剧疆',
@@ -65,29 +83,101 @@
 					},
 					{
 						name: '鎻愮ず璇�',
-						[VueFlowConstant.PARAMS_KEY]: [{ key: 'prompt', label: '鎻愮ず璇�', type: 'textarea', value: '' }],
+						[VueFlowConstant.PARAMS_KEY]: [{ key: 'prompt', label: '', type: 'textarea', value: '' }],
 					},
 				];
 				break;
-
+			case NodeType.Code:
+				data = {
+					...data,
+					description: '鑷畾涔夐渶瑕佹墽琛岀殑浠g爜銆�',
+					[VueFlowConstant.GROUP_PARAMS_KEY]: [
+						{
+							name: '鍏ュ弬',
+							[VueFlowConstant.PARAMS_KEY]: [
+								{
+									key: 'code_input',
+									type: 'code_input',
+									required: true,
+									value: [
+										{ key: 'arg1', type: 'input', label: '', value: '' },
+										{ key: 'arg2', type: 'input', label: '', value: '' },
+									],
+								},
+							],
+						},
+						{
+							name: '鎵ц浠g爜',
+							[VueFlowConstant.PARAMS_KEY]: [
+								{
+									key: 'code',
+									type: 'code',
+									required: true,
+									value: 'const main = (arg1, arg2) =>{\n  return {\n    result1: arg1,\n    result2: arg2\n  }\n}',
+								},
+							],
+						},
+						{
+							name: '鍑哄弬',
+							[VueFlowConstant.PARAMS_KEY]: [
+								{
+									key: 'code_output',
+									type: 'code_output',
+									// global: 'code:value.map(el => ({ label: el.key, value: el.key }))',
+									required: true,
+									value: [
+										{ key: 'result1', type: 'string' },
+										{ key: 'result2', type: 'string' },
+									],
+								},
+							],
+						},
+					],
+				};
+				break;
 			case NodeType.Agent:
 				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
 					{
+						name: '浠g悊鍚嶇О',
 						[VueFlowConstant.PARAMS_KEY]: [
 							{
 								key: 'agent',
-								label: '浠g悊',
+								label: '',
 								type: 'agent_select',
 								value: '',
 								// value_label:'',
 								required: true,
-								placeholder: '浠g悊',
+								placeholder: '浠g悊鍚嶇О',
+							},
+						],
+					},
+				];
+				break;
+
+			case NodeType.Func:
+				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
+					{
+						name: '鍑芥暟鍚嶇О',
+						[VueFlowConstant.PARAMS_KEY]: [
+							{
+								key: 'func_name',
+								label: '',
+								type: 'func_name_select',
+								value: '',
+								// value_label:'',
+								required: true,
+								placeholder: '鍑芥暟鍚嶇О',
 							},
 						],
 					},
 				];
 				break;
 			case NodeType.Output:
+				data = {
+					...data,
+					description:
+						'鍙悜鐢ㄦ埛鍙戦�佹秷鎭紝骞朵笖鏀寔杩涜鏇翠赴瀵岀殑浜や簰锛屼緥濡傝姹傜敤鎴锋壒鍑嗚繘琛屾煇椤规晱鎰熸搷浣溿�佸厑璁哥敤鎴峰湪妯″瀷杈撳嚭鍐呭鐨勫熀纭�涓婄洿鎺ヤ慨鏀瑰苟鎻愪氦銆�',
+				};
 				data[VueFlowConstant.GROUP_PARAMS_KEY] = [
 					{
 						[VueFlowConstant.PARAMS_KEY]: [
@@ -117,6 +207,22 @@
 				break;
 		}
 		return data;
+	};
+
+	/**
+	 * 寮哄埗鍐欏叆鍒伴厤缃俊鎭腑锛岀敤浜� patch 杩囧幓鐗堟湰涓病鏈夌殑瀛楁锛屾垨瀛楁鍚嶇О宸茬粡淇敼
+	 *
+	 * 鐗堟湰绋冲畾鍚庡彲鍒犻櫎姝ゆ柟娉�
+	 * @param obj
+	 * @param key
+	 * @param val
+	 */
+	static getConfigValue = (obj: any, key: string, val: string) => {
+		const value = obj[key];
+		if (!value || value !== val) {
+			obj[key] = val;
+		}
+		return val;
 	};
 
 	static getHandleId = (node: any, handleType: HandleType, order?: number) => {
@@ -212,9 +318,7 @@
 			: {
 					id: VueFlowHelper.genId(),
 					operator: ConditionOperator.And,
-					conditions: [
-						ConditionHelper.getConditionItem()
-					],
+					conditions: [ConditionHelper.getConditionItem()],
 			  };
 	};
 }

--
Gitblit v1.9.3