From 191ed70bb434276e07c0b61a1e262f4252cb760f Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Wed, 18 Sep 2024 13:53:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E8=8A=82=E7=82=B9=E6=B7=BB=E5=8A=A0=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E6=96=87,=E4=BC=9A=E8=AF=9Did=E5=8F=82=E6=95=B0=20#1094?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flow/step_node/start_node/i_start_node.py | 3 - .../start_node/impl/base_start_node.py | 7 ++- ui/src/workflow/nodes/start-node/index.vue | 61 ++++++++----------- 3 files changed, 30 insertions(+), 41 deletions(-) diff --git a/apps/application/flow/step_node/start_node/i_start_node.py b/apps/application/flow/step_node/start_node/i_start_node.py index 4c1ecfd2a12..bb23ad3f53e 100644 --- a/apps/application/flow/step_node/start_node/i_start_node.py +++ b/apps/application/flow/step_node/start_node/i_start_node.py @@ -16,9 +16,6 @@ class IStarNode(INode): type = 'start-node' - def get_node_params_serializer_class(self) -> Type[serializers.Serializer] | None: - return None - def _run(self): return self.execute(**self.flow_params_serializer.data) diff --git a/apps/application/flow/step_node/start_node/impl/base_start_node.py b/apps/application/flow/step_node/start_node/impl/base_start_node.py index dc4fb541c97..f6528660d76 100644 --- a/apps/application/flow/step_node/start_node/impl/base_start_node.py +++ b/apps/application/flow/step_node/start_node/impl/base_start_node.py @@ -15,11 +15,16 @@ class BaseStartStepNode(IStarNode): def execute(self, question, **kwargs) -> NodeResult: + history_chat_record = self.flow_params_serializer.data.get('history_chat_record', []) + history_context = [{'question': chat_record.problem_text, 'answer': chat_record.answer_text} for chat_record in + history_chat_record] + chat_id = self.flow_params_serializer.data.get('chat_id') """ 开始节点 初始化全局变量 """ return NodeResult({'question': question}, - {'time': datetime.now().strftime('%Y-%m-%d %H:%M:%S'), 'start_time': time.time()}) + {'time': datetime.now().strftime('%Y-%m-%d %H:%M:%S'), 'start_time': time.time(), + 'history_context': history_context, 'chat_id': str(chat_id)}) def get_details(self, index: int, **kwargs): global_fields = [] diff --git a/ui/src/workflow/nodes/start-node/index.vue b/ui/src/workflow/nodes/start-node/index.vue index a91e98cbbac..e50a109a4c5 100644 --- a/ui/src/workflow/nodes/start-node/index.vue +++ b/ui/src/workflow/nodes/start-node/index.vue @@ -2,25 +2,18 @@
全局变量
- 当前时间 {time} + {{ item.label }} {{ '{' + item.value + '}' }} - - - - -
-
- {{ item.name }} {{ '{' + item.variable + '}' }} - - + @@ -28,42 +21,36 @@