From ec33b9908edd56839215220d7a3507d61c5f274c Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 10 Sep 2025 18:41:12 +0800 Subject: [PATCH] fix(trigger): improve formatting of OAuth client response in TriggerOAuthClientManageApi - Refactored the return statement in the TriggerOAuthClientManageApi to enhance readability and maintainability. - Ensured consistent formatting of the response structure for better clarity in API responses. --- .../console/workspace/trigger_providers.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/api/controllers/console/workspace/trigger_providers.py b/api/controllers/console/workspace/trigger_providers.py index 5f56d2eb88..8da0fa6dbd 100644 --- a/api/controllers/console/workspace/trigger_providers.py +++ b/api/controllers/console/workspace/trigger_providers.py @@ -447,14 +447,16 @@ class TriggerOAuthClientManageApi(Resource): provider_id=provider_id, ) provider_controller = TriggerManager.get_trigger_provider(user.current_tenant_id, provider_id) - return jsonable_encoder({ - "configured": bool(custom_params or system_client), - "oauth_client_schema": provider_controller.get_oauth_client_schema(), - "custom_configured": bool(custom_params), - "custom_enabled": is_custom_enabled, - "redirect_uri": f"{dify_config.CONSOLE_API_URL}/console/api/oauth/plugin/{provider}/trigger/callback", - "params": custom_params if custom_params else {}, - }) + return jsonable_encoder( + { + "configured": bool(custom_params or system_client), + "oauth_client_schema": provider_controller.get_oauth_client_schema(), + "custom_configured": bool(custom_params), + "custom_enabled": is_custom_enabled, + "redirect_uri": f"{dify_config.CONSOLE_API_URL}/console/api/oauth/plugin/{provider}/trigger/callback", + "params": custom_params if custom_params else {}, + } + ) except Exception as e: logger.exception("Error getting OAuth client", exc_info=e)