Skip to content

fix: Embedding dialogue asker parameter does not take effect #2773

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

Merged
merged 1 commit into from
Apr 2, 2025

Conversation

shaohuzhang1
Copy link
Contributor

fix: Embedding dialogue asker parameter does not take effect

Copy link

f2c-ci-robot bot commented Apr 2, 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 Apr 2, 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

@@ -332,7 +332,8 @@ def get_query_api_input(self, application, params):
for field in input_field_list:
if field['assignment_method'] == 'api_input' and field['variable'] in params:
query += f"&{field['variable']}={params[field['variable']]}"

if 'asker' in params:
query += f"&asker={params.get('asker')}"
return query

class AccessTokenSerializer(serializers.Serializer):
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 snippet does not contain any obvious syntax errors or major issues. However, there is one potential optimization suggestion regarding string formatting methods:

Suggestion for Optimization:
Instead of using multiple += statements to build the query, consider using Python's built-in list comprehension within the join() function, which can simplify and potentially improve performance. Here’s how you could refactor this part of the code:

for field in input_field_list:
    if field['assignment_method'] == 'api_input' and field['variable'] in params:
        # Using join with list compression and f-strings can make it more concise and efficient
        query.append(f"{field['variable']}={params[field['variable']]}")
if 'asker' in params:
    query.append(f"asker={params.get('asker')}")

# Joining the list into a single string separated by '&'
return "&".join(query)

This approach will create a list of strings, then use &.join() to concatenate them efficiently. This method reduces the overhead associated with concatenation operations done by +=, especially when dealing with many fields.

@shaohuzhang1 shaohuzhang1 merged commit 27d4603 into main Apr 2, 2025
4 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@main@fix_embed_chat branch April 2, 2025 06:00
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