fix: 修复工作流多个form表单收集后面节点无法使用表单数据 (#1717)

This commit is contained in:
shaohuzhang1 2024-11-30 23:08:40 +08:00 committed by GitHub
parent b8aa4756c5
commit 5ebb88b6de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View File

@ -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,

View File

@ -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():