Skip to content

Commit 835ee21

Browse files
committed
fix: 修复工作流多个form表单收集后面节点无法使用表单数据
1 parent b8aa475 commit 835ee21

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

apps/application/flow/step_node/form_node/impl/base_form_node.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow):
2929

3030
class BaseFormNode(IFormNode):
3131
def save_context(self, details, workflow_manage):
32+
form_data = details.get('form_data', None)
3233
self.context['result'] = details.get('result')
3334
self.context['form_content_format'] = details.get('form_content_format')
3435
self.context['form_field_list'] = details.get('form_field_list')
3536
self.context['run_time'] = details.get('run_time')
3637
self.context['start_time'] = details.get('start_time')
37-
self.context['form_data'] = details.get('form_data')
38+
self.context['form_data'] = form_data
3839
self.context['is_submit'] = details.get('is_submit')
3940
self.answer_text = details.get('result')
41+
if form_data is not None:
42+
for key in form_data:
43+
self.context[key] = form_data[key]
4044

4145
def execute(self, form_field_list, form_content_format, **kwargs) -> NodeResult:
4246
form_setting = {"form_field_list": form_field_list, "runtime_node_id": self.runtime_node_id,

apps/application/serializers/chat_message_serializers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,15 @@ def to_pipeline_manage_params(self, problem_text: str, post_response_handler: Po
120120
def append_chat_record(self, chat_record: ChatRecord, client_id=None):
121121
chat_record.problem_text = chat_record.problem_text[0:10240] if chat_record.problem_text is not None else ""
122122
chat_record.answer_text = chat_record.answer_text[0:40960] if chat_record.problem_text is not None else ""
123+
is_save = True
123124
# 存入缓存中
124-
self.chat_record_list.append(chat_record)
125+
for index in range(len(self.chat_record_list)):
126+
record = self.chat_record_list[index]
127+
if record.id == chat_record.id:
128+
self.chat_record_list[index] = chat_record
129+
is_save = False
130+
if is_save:
131+
self.chat_record_list.append(chat_record)
125132
if self.application.id is not None:
126133
# 插入数据库
127134
if not QuerySet(Chat).filter(id=self.chat_id).exists():

0 commit comments

Comments
 (0)