From 63e8e264f8c1fb5422d97b3205f3a6ae2d06445e Mon Sep 17 00:00:00 2001 From: "zhaoqingyu.1075" Date: Fri, 3 Jan 2025 17:31:54 +0800 Subject: [PATCH 1/3] fix: Encode Chinese characters with Unicode before querying to match the Unicode encoded Chinese characters in the database --- api/services/workflow_app_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/services/workflow_app_service.py b/api/services/workflow_app_service.py index f89487415deef0..0bab2fd778d746 100644 --- a/api/services/workflow_app_service.py +++ b/api/services/workflow_app_service.py @@ -27,7 +27,7 @@ def get_paginate_workflow_app_logs(self, app_model: App, args: dict) -> Paginati query = query.join(WorkflowRun, WorkflowRun.id == WorkflowAppLog.workflow_run_id) if keyword: - keyword_like_val = f"%{args['keyword'][:30]}%" + keyword_like_val = f"%{keyword[:30].encode('unicode_escape').decode('utf-8').replace(r"\u", r"\\u")}%" keyword_conditions = [ WorkflowRun.inputs.ilike(keyword_like_val), WorkflowRun.outputs.ilike(keyword_like_val), From b5aaa91f3eed6965a6624d23054b36b45a05e442 Mon Sep 17 00:00:00 2001 From: "zhaoqingyu.1075" Date: Fri, 3 Jan 2025 18:40:35 +0800 Subject: [PATCH 2/3] fix: fix SyntaxError --- api/services/workflow_app_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/services/workflow_app_service.py b/api/services/workflow_app_service.py index 0bab2fd778d746..4edd18b00feb58 100644 --- a/api/services/workflow_app_service.py +++ b/api/services/workflow_app_service.py @@ -27,7 +27,7 @@ def get_paginate_workflow_app_logs(self, app_model: App, args: dict) -> Paginati query = query.join(WorkflowRun, WorkflowRun.id == WorkflowAppLog.workflow_run_id) if keyword: - keyword_like_val = f"%{keyword[:30].encode('unicode_escape').decode('utf-8').replace(r"\u", r"\\u")}%" + keyword_like_val = f"%{keyword[:30].encode('unicode_escape').decode('utf-8')}%".replace(r'\u', r'\\u') keyword_conditions = [ WorkflowRun.inputs.ilike(keyword_like_val), WorkflowRun.outputs.ilike(keyword_like_val), From 6dc70e72aab8b0c23a25224eed1a166452ba8841 Mon Sep 17 00:00:00 2001 From: "zhaoqingyu.1075" Date: Fri, 3 Jan 2025 18:46:10 +0800 Subject: [PATCH 3/3] fix: run dev/reformat --- api/services/workflow_app_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/services/workflow_app_service.py b/api/services/workflow_app_service.py index 4edd18b00feb58..7eab0ac1d8611f 100644 --- a/api/services/workflow_app_service.py +++ b/api/services/workflow_app_service.py @@ -27,7 +27,7 @@ def get_paginate_workflow_app_logs(self, app_model: App, args: dict) -> Paginati query = query.join(WorkflowRun, WorkflowRun.id == WorkflowAppLog.workflow_run_id) if keyword: - keyword_like_val = f"%{keyword[:30].encode('unicode_escape').decode('utf-8')}%".replace(r'\u', r'\\u') + keyword_like_val = f"%{keyword[:30].encode('unicode_escape').decode('utf-8')}%".replace(r"\u", r"\\u") keyword_conditions = [ WorkflowRun.inputs.ilike(keyword_like_val), WorkflowRun.outputs.ilike(keyword_like_val),