Skip to content

Commit 56d32c1

Browse files
authored
feat: Add additional fields to form nodes (#4195)
1 parent 05e0f2a commit 56d32c1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ def execute(self, form_field_list, form_content_format, form_data, **kwargs) ->
121121
context = self.workflow_manage.get_workflow_content()
122122
form_content_format = self.workflow_manage.reset_prompt(form_content_format)
123123
prompt_template = PromptTemplate.from_template(form_content_format, template_format='jinja2')
124-
value = prompt_template.format(form=form, context=context)
124+
value = prompt_template.format(form=form, context=context, runtime_node_id=self.runtime_node_id,
125+
chat_record_id=self.flow_params_serializer.data.get("chat_record_id"),
126+
form_field_list=form_field_list)
125127

126128
return NodeResult(
127129
{'result': value, 'form_field_list': form_field_list, 'form_content_format': form_content_format}, {},
@@ -138,7 +140,9 @@ def get_answer_list(self) -> List[Answer] | None:
138140
context = self.workflow_manage.get_workflow_content()
139141
form_content_format = self.workflow_manage.reset_prompt(form_content_format)
140142
prompt_template = PromptTemplate.from_template(form_content_format, template_format='jinja2')
141-
value = prompt_template.format(form=form, context=context)
143+
value = prompt_template.format(form=form, context=context, runtime_node_id=self.runtime_node_id,
144+
chat_record_id=self.flow_params_serializer.data.get("chat_record_id"),
145+
form_field_list=form_field_list)
142146
return [Answer(value, self.view_type, self.runtime_node_id, self.workflow_params['chat_record_id'], None,
143147
self.runtime_node_id, '')]
144148

@@ -153,7 +157,9 @@ def get_details(self, index: int, **kwargs):
153157
context = self.workflow_manage.get_workflow_content()
154158
form_content_format = self.workflow_manage.reset_prompt(form_content_format)
155159
prompt_template = PromptTemplate.from_template(form_content_format, template_format='jinja2')
156-
value = prompt_template.format(form=form, context=context)
160+
value = prompt_template.format(form=form, context=context, runtime_node_id=self.runtime_node_id,
161+
chat_record_id=self.flow_params_serializer.data.get("chat_record_id"),
162+
form_field_list=form_field_list)
157163
return {
158164
'name': self.node.properties.get('stepName'),
159165
"index": index,

0 commit comments

Comments
 (0)