Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: The Chinese characters in the form data have been transcoded #2192

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

shaohuzhang1
Copy link
Contributor

fix: The Chinese characters in the form data have been transcoded

Copy link

f2c-ci-robot bot commented Feb 10, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Feb 10, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@shaohuzhang1 shaohuzhang1 merged commit 041cf09 into main Feb 10, 2025
4 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@main@fix_form_node branch February 10, 2025 03:08
@@ -85,7 +85,7 @@ def get_details(self, index: int, **kwargs):
"chat_record_id": self.flow_params_serializer.data.get("chat_record_id"),
'form_data': self.context.get('form_data', {}),
"is_submit": self.context.get("is_submit", False)}
form = f'<form_rander>{json.dumps(form_setting)}</form_rander>'
form = f'<form_rander>{json.dumps(form_setting,ensure_ascii=False)}</form_rander>'
context = self.workflow_manage.get_workflow_content()
form_content_format = self.workflow_manage.reset_prompt(form_content_format)
prompt_template = PromptTemplate.from_template(form_content_format, template_format='jinja2')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code has minor issues that can be resolved. Here’s a detailed explanation of the changes needed:

File file_name.py

-        form = f'<form_rander>{json.dumps(form_setting)}</form_rander>'
+        form = f'<form_rander>{json.dumps(form_setting, ensure_ascii=False)}</form_rander>'

Explanation: The ensure_ascii=False parameter is necessary when you want to serialize JSON data with non-ASCII characters properly. If ensure_ascii=True, special characters might not be converted correctly.


General Suggestion

Ensure that within this file (file_name.py) and throughout all related files:

  • Always import necessary modules at the beginning.
  • Use meaningful variable names instead of short ones (e.g., replace context with workflow_context).
  • Ensure there are no typos or unnecessary functions/data structures.
  • Consider adding docstrings if your methods/actions do not have clear descriptions.

If you need further help or modifications, please specify!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant