From 5ebb88b6de2586d197fd2098de3481791ab85145 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:08:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E5=A4=9A=E4=B8=AAform=E8=A1=A8=E5=8D=95=E6=94=B6?= =?UTF-8?q?=E9=9B=86=E5=90=8E=E9=9D=A2=E8=8A=82=E7=82=B9=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=A1=A8=E5=8D=95=E6=95=B0=E6=8D=AE=20(#1717?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flow/step_node/form_node/impl/base_form_node.py | 6 +++++- apps/application/serializers/chat_message_serializers.py | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/application/flow/step_node/form_node/impl/base_form_node.py b/apps/application/flow/step_node/form_node/impl/base_form_node.py index ae37fc59e..ae86b11d6 100644 --- a/apps/application/flow/step_node/form_node/impl/base_form_node.py +++ b/apps/application/flow/step_node/form_node/impl/base_form_node.py @@ -29,14 +29,18 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow): class BaseFormNode(IFormNode): def save_context(self, details, workflow_manage): + form_data = details.get('form_data', None) self.context['result'] = details.get('result') self.context['form_content_format'] = details.get('form_content_format') self.context['form_field_list'] = details.get('form_field_list') self.context['run_time'] = details.get('run_time') self.context['start_time'] = details.get('start_time') - self.context['form_data'] = details.get('form_data') + self.context['form_data'] = form_data self.context['is_submit'] = details.get('is_submit') self.answer_text = details.get('result') + if form_data is not None: + for key in form_data: + self.context[key] = form_data[key] def execute(self, form_field_list, form_content_format, **kwargs) -> NodeResult: form_setting = {"form_field_list": form_field_list, "runtime_node_id": self.runtime_node_id, diff --git a/apps/application/serializers/chat_message_serializers.py b/apps/application/serializers/chat_message_serializers.py index f3599156b..5f38cfc7d 100644 --- a/apps/application/serializers/chat_message_serializers.py +++ b/apps/application/serializers/chat_message_serializers.py @@ -120,8 +120,15 @@ class ChatInfo: def append_chat_record(self, chat_record: ChatRecord, client_id=None): chat_record.problem_text = chat_record.problem_text[0:10240] if chat_record.problem_text is not None else "" chat_record.answer_text = chat_record.answer_text[0:40960] if chat_record.problem_text is not None else "" + is_save = True # 存入缓存中 - self.chat_record_list.append(chat_record) + for index in range(len(self.chat_record_list)): + record = self.chat_record_list[index] + if record.id == chat_record.id: + self.chat_record_list[index] = chat_record + is_save = False + if is_save: + self.chat_record_list.append(chat_record) if self.application.id is not None: # 插入数据库 if not QuerySet(Chat).filter(id=self.chat_id).exists():