Skip to content

fix: The simple application demonstration cannot be opened #3028

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 29, 2025

Conversation

shaohuzhang1
Copy link
Contributor

fix: The simple application demonstration cannot be opened

Copy link

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

@@ -1012,7 +1012,7 @@ def profile(self, with_valid=True):
'stt_autosend': application.stt_autosend,
'file_upload_enable': application.file_upload_enable,
'file_upload_setting': application.file_upload_setting,
'work_flow': {'nodes': [node for node in application.work_flow.get('nodes') if
'work_flow': {'nodes': [node for node in ((application.work_flow or {}).get('nodes', []) or []) if
node.get('id') == 'base-node']},
'show_source': application_access_token.show_source,
'language': application_access_token.language,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks good! There are no major irregularities or issues found in the code. However, it's worth noting that accessing application.work_flow twice is redundant when using the ternary operator to handle potential None value scenarios. Here's a simplified version:

self.config = {
    "stt_autosend": application.stt_autosend,
    "file_upload_enable": application.file_upload_enable,
    "file_upload_setting": application.file_upload_setting,
    "work_flow": {  # Handle case where work_flow might not exist or be empty
        "nodes": [
            node for node in (application.work_flow.get("nodes", [])
                             if isinstance(application.work_flow, dict)
                             and 'nodes' in application_work_flow)
                              if node.get('id') == 'base-node']
    },
    "show_source": application_access_token.show_source,
    "language": application_access_token.language
}

This approach ensures that you only access the dictionary once and includes checks to ensure that both application.work_flow and its nodes key exist before processing them.

@shaohuzhang1 shaohuzhang1 merged commit 96e59a0 into main Apr 29, 2025
4 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@main@fix_application branch April 29, 2025 14:12
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