From 43e2f055d29a7fbb79ecee55f528badeb6ab27e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Fri, 24 Apr 2026 12:28:22 +0800
Subject: [PATCH 1/8] fix: Fix the `.` dot in the regex not matching `\n`
---
.../step_node/application_node/impl/base_application_node.py | 4 ++--
apps/common/utils/common.py | 2 +-
apps/knowledge/task/handler.py | 2 +-
.../component/operation-button/ChatOperationButton.vue | 2 +-
.../ai-chat/component/operation-button/LogOperationButton.vue | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/apps/application/flow/step_node/application_node/impl/base_application_node.py b/apps/application/flow/step_node/application_node/impl/base_application_node.py
index 330bae66441..11d27eff937 100644
--- a/apps/application/flow/step_node/application_node/impl/base_application_node.py
+++ b/apps/application/flow/step_node/application_node/impl/base_application_node.py
@@ -131,14 +131,14 @@ def reset_application_node_dict(application_node_dict, runtime_node_id, node_dat
application_node = application_node_dict[key]
if application_node.get('runtime_node_id') == runtime_node_id:
content: str = application_node.get('content')
- match = re.search('.*?', content)
+ match = re.search('[\d\D]*?<\/form_rander>', content)
if match:
form_setting_str = match.group().replace('', '').replace('', '')
form_setting = json.loads(form_setting_str)
form_setting['is_submit'] = True
form_setting['form_data'] = node_data
value = f'{json.dumps(form_setting)}'
- res = re.sub('.*?',
+ res = re.sub('[\d\D]*?<\/form_rander>',
'${value}', content)
application_node['content'] = res.replace('${value}', value)
except Exception as e:
diff --git a/apps/common/utils/common.py b/apps/common/utils/common.py
index e2c6ace2721..118619b66e1 100644
--- a/apps/common/utils/common.py
+++ b/apps/common/utils/common.py
@@ -125,7 +125,7 @@ def markdown_to_plain_text(md: str) -> str:
# 去除多余的空白字符(包括换行符、制表符等)
text = re.sub(r'\s+', ' ', text)
# 去除表单渲染
- re.sub(r'[\s\S]*?<\/form_rander>', '', text)
+ re.sub('[\d\D]*?<\/form_rander>', '', text)
# 去除首尾空格
text = text.strip()
return text
diff --git a/apps/knowledge/task/handler.py b/apps/knowledge/task/handler.py
index f0a8a54853c..3d075f64bac 100644
--- a/apps/knowledge/task/handler.py
+++ b/apps/knowledge/task/handler.py
@@ -103,7 +103,7 @@ def save_problem(knowledge_id, document_id, paragraph_id, problem):
# print(f"problem: {problem}")
problem = re.sub(r"^\d+\.\s*", "", problem)
pattern = r"(.*?)"
- match = re.search(pattern, problem)
+ match = re.search(pattern, problem, flags=re.DOTALL)
problem = match.group(1) if match else None
if problem is None or len(problem) == 0:
return
diff --git a/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue b/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue
index bddd993d2d3..3adc99b580c 100644
--- a/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue
+++ b/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue
@@ -274,7 +274,7 @@ function markdownToPlainText(md: string) {
}
function removeFormRander(text: string) {
- return text.replace(/[\s\S]*?<\/form_rander>/g, '').trim()
+ return text.replace(/[\d\D]*?<\/form_rander>/g, '').trim()
}
function getKey(keys: Array, index: number) {
// 从后往前查找第一个小于等于index的键
diff --git a/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue b/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue
index 6688e96e62e..12b10e19cd7 100644
--- a/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue
+++ b/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue
@@ -180,7 +180,7 @@ function markdownToPlainText(md: string) {
}
function removeFormRander(text: string) {
- return text.replace(/[\s\S]*?<\/form_rander>/g, '').trim()
+ return text.replace(/[\d\D]*?<\/form_rander>/g, '').trim()
}
const playAnswerText = (text: string) => {
From 7a8f4108a9574ae530e6e0362cfd7ec7274dbaa1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Fri, 24 Apr 2026 12:32:19 +0800
Subject: [PATCH 2/8] fix style
---
.../flow/step_node/ai_chat_step_node/impl/base_chat_node.py | 2 +-
.../step_node/application_node/impl/base_application_node.py | 4 ++--
.../flow/step_node/intent_node/impl/base_intent_node.py | 2 +-
.../flow/step_node/question_node/impl/base_question_node.py | 2 +-
apps/common/utils/common.py | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py b/apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py
index 59f8a5fbb12..1fcbc7166a4 100644
--- a/apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py
+++ b/apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py
@@ -383,7 +383,7 @@ def get_history_message(history_chat_record, dialogue_number, dialogue_type, run
range(start_index if start_index > 0 else 0, len(history_chat_record))], [])
for message in history_message:
if isinstance(message.content, str):
- message.content = re.sub('[\d\D]*?<\/form_rander>', '', message.content)
+ message.content = re.sub(r'[\d\D]*?', '', message.content)
return history_message
def generate_prompt_question(self, prompt):
diff --git a/apps/application/flow/step_node/application_node/impl/base_application_node.py b/apps/application/flow/step_node/application_node/impl/base_application_node.py
index 11d27eff937..45995f8303a 100644
--- a/apps/application/flow/step_node/application_node/impl/base_application_node.py
+++ b/apps/application/flow/step_node/application_node/impl/base_application_node.py
@@ -131,14 +131,14 @@ def reset_application_node_dict(application_node_dict, runtime_node_id, node_dat
application_node = application_node_dict[key]
if application_node.get('runtime_node_id') == runtime_node_id:
content: str = application_node.get('content')
- match = re.search('[\d\D]*?<\/form_rander>', content)
+ match = re.search(r'[\d\D]*?', content)
if match:
form_setting_str = match.group().replace('', '').replace('', '')
form_setting = json.loads(form_setting_str)
form_setting['is_submit'] = True
form_setting['form_data'] = node_data
value = f'{json.dumps(form_setting)}'
- res = re.sub('[\d\D]*?<\/form_rander>',
+ res = re.sub(r'[\d\D]*?',
'${value}', content)
application_node['content'] = res.replace('${value}', value)
except Exception as e:
diff --git a/apps/application/flow/step_node/intent_node/impl/base_intent_node.py b/apps/application/flow/step_node/intent_node/impl/base_intent_node.py
index 64822aa9a20..0ac7f375e4b 100644
--- a/apps/application/flow/step_node/intent_node/impl/base_intent_node.py
+++ b/apps/application/flow/step_node/intent_node/impl/base_intent_node.py
@@ -133,7 +133,7 @@ def get_history_message(history_chat_record, dialogue_number):
for message in history_message:
if isinstance(message.content, str):
- message.content = re.sub('[\d\D]*?<\/form_rander>', '', message.content)
+ message.content = re.sub(r'[\d\D]*?', '', message.content)
return history_message
def build_system_prompt(self) -> str:
diff --git a/apps/application/flow/step_node/question_node/impl/base_question_node.py b/apps/application/flow/step_node/question_node/impl/base_question_node.py
index 3f622c5f2dc..47188e6b848 100644
--- a/apps/application/flow/step_node/question_node/impl/base_question_node.py
+++ b/apps/application/flow/step_node/question_node/impl/base_question_node.py
@@ -130,7 +130,7 @@ def get_history_message(history_chat_record, dialogue_number):
range(start_index if start_index > 0 else 0, len(history_chat_record))], [])
for message in history_message:
if isinstance(message.content, str):
- message.content = re.sub('[\d\D]*?<\/form_rander>', '', message.content)
+ message.content = re.sub(r'[\d\D]*?', '', message.content)
return history_message
def generate_prompt_question(self, prompt):
diff --git a/apps/common/utils/common.py b/apps/common/utils/common.py
index 118619b66e1..b0a81e478b4 100644
--- a/apps/common/utils/common.py
+++ b/apps/common/utils/common.py
@@ -125,7 +125,7 @@ def markdown_to_plain_text(md: str) -> str:
# 去除多余的空白字符(包括换行符、制表符等)
text = re.sub(r'\s+', ' ', text)
# 去除表单渲染
- re.sub('[\d\D]*?<\/form_rander>', '', text)
+ re.sub(r'[\d\D]*?', '', text)
# 去除首尾空格
text = text.strip()
return text
From 5f7fa53692cfab54cf06d77a008cfed7a6c1c871 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Fri, 24 Apr 2026 12:48:50 +0800
Subject: [PATCH 3/8] fix
---
apps/knowledge/task/handler.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/knowledge/task/handler.py b/apps/knowledge/task/handler.py
index 3d075f64bac..d6e8ce85e30 100644
--- a/apps/knowledge/task/handler.py
+++ b/apps/knowledge/task/handler.py
@@ -102,8 +102,8 @@ def save_problem(knowledge_id, document_id, paragraph_id, problem):
# print(f"paragraph_id: {paragraph_id}")
# print(f"problem: {problem}")
problem = re.sub(r"^\d+\.\s*", "", problem)
- pattern = r"(.*?)"
- match = re.search(pattern, problem, flags=re.DOTALL)
+ pattern = r"([\d\D]*?)"
+ match = re.search(pattern, problem)
problem = match.group(1) if match else None
if problem is None or len(problem) == 0:
return
From eb9debefde9e63cf5f05886d2b165d8f08756b3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Fri, 24 Apr 2026 13:25:05 +0800
Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87?=
=?UTF-8?q?=E6=9C=AA=E4=BF=9D=E5=AD=98=E5=AE=8C=E5=85=A8=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/knowledge/serializers/common.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/knowledge/serializers/common.py b/apps/knowledge/serializers/common.py
index e33fa545251..9a5fb5cb604 100644
--- a/apps/knowledge/serializers/common.py
+++ b/apps/knowledge/serializers/common.py
@@ -189,10 +189,10 @@ def write_image(zip_path: str, image_list: List[str]):
r = text.replace('(./oss/file/', '').replace(')', '')
r = r.strip().split(" ")[0]
if not is_valid_uuid(r):
- break
+ continue
file = QuerySet(File).filter(id=r).first()
if file is None:
- break
+ continue
zip_inner_path = os.path.join('oss', 'file', r)
file_path = os.path.join(zip_path, zip_inner_path)
if not os.path.exists(os.path.dirname(file_path)):
From 8bb4c36e65315d757c2007c26222959268a0887f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Fri, 24 Apr 2026 18:25:14 +0800
Subject: [PATCH 5/8] bugfix
---
apps/common/utils/common.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/common/utils/common.py b/apps/common/utils/common.py
index b0a81e478b4..41fde376b50 100644
--- a/apps/common/utils/common.py
+++ b/apps/common/utils/common.py
@@ -125,7 +125,7 @@ def markdown_to_plain_text(md: str) -> str:
# 去除多余的空白字符(包括换行符、制表符等)
text = re.sub(r'\s+', ' ', text)
# 去除表单渲染
- re.sub(r'[\d\D]*?', '', text)
+ text = re.sub(r'[\d\D]*?', '', text)
# 去除首尾空格
text = text.strip()
return text
From 8a51213f2ad45a778027f4654d2603da58712418 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Fri, 24 Apr 2026 19:36:51 +0800
Subject: [PATCH 6/8] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=98=E9=87=8F?=
=?UTF-8?q?=E5=90=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/knowledge/serializers/common.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/apps/knowledge/serializers/common.py b/apps/knowledge/serializers/common.py
index 9a5fb5cb604..398a63edc63 100644
--- a/apps/knowledge/serializers/common.py
+++ b/apps/knowledge/serializers/common.py
@@ -186,14 +186,14 @@ def write_image(zip_path: str, image_list: List[str]):
if search:
text = search.group()
if text.startswith('(./oss/file/'):
- r = text.replace('(./oss/file/', '').replace(')', '')
- r = r.strip().split(" ")[0]
- if not is_valid_uuid(r):
+ image_id = text.replace('(./oss/file/', '').replace(')', '')
+ image_id = image_id.strip().split(" ")[0]
+ if not is_valid_uuid(image_id):
continue
- file = QuerySet(File).filter(id=r).first()
+ file = QuerySet(File).filter(id=image_id).first()
if file is None:
continue
- zip_inner_path = os.path.join('oss', 'file', r)
+ zip_inner_path = os.path.join('oss', 'file', image_id)
file_path = os.path.join(zip_path, zip_inner_path)
if not os.path.exists(os.path.dirname(file_path)):
os.makedirs(os.path.dirname(file_path))
From 31451b4e70a93793c9c59eaf400b657380cc41ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Fri, 24 Apr 2026 19:59:00 +0800
Subject: [PATCH 7/8] optimize
---
apps/trigger/handler/simple_tools.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/apps/trigger/handler/simple_tools.py b/apps/trigger/handler/simple_tools.py
index dd3ff5748c8..b8886fc0b33 100644
--- a/apps/trigger/handler/simple_tools.py
+++ b/apps/trigger/handler/simple_tools.py
@@ -53,5 +53,6 @@ def undeploy(trigger, **kwargs):
@return:
"""
for simple_trigger_handler in simple_trigger_handlers:
- return simple_trigger_handler.undeploy(trigger, **kwargs)
+ if simple_trigger_handler.support(trigger, **kwargs):
+ return simple_trigger_handler.undeploy(trigger, **kwargs)
raise Exception("不支持的触发器类型")
From 561c5c7c1d3e88008926c7ee05c07aff02aedfdc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Mon, 27 Apr 2026 13:15:37 +0800
Subject: [PATCH 8/8] perf
---
apps/models_provider/serializers/model_serializer.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/models_provider/serializers/model_serializer.py b/apps/models_provider/serializers/model_serializer.py
index be41df50462..d28727d2d69 100644
--- a/apps/models_provider/serializers/model_serializer.py
+++ b/apps/models_provider/serializers/model_serializer.py
@@ -150,8 +150,8 @@ def one_meta(self, with_valid=False):
super().is_valid(raise_exception=True)
model = QuerySet(Model).filter(id=self.data.get("id"),
workspace_id=self.data.get('workspace_id', 'None')).first()
- if model is None:
- raise AppApiException(500, _('Model does not exist'))
+ if model is None:
+ raise AppApiException(500, _('Model does not exist'))
return {'id': str(model.id), 'provider': model.provider, 'name': model.name, 'model_type': model.model_type,
'model_name': model.model_name,
'status': model.status,