Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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('<form_rander>[\d\D]*?<\/form_rander>', '', message.content)
message.content = re.sub(r'<form_rander>[\d\D]*?</form_rander>', '', message.content)
return history_message

def generate_prompt_question(self, prompt):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<form_rander>.*?</form_rander>', content)
match = re.search(r'<form_rander>[\d\D]*?</form_rander>', content)
if match:
form_setting_str = match.group().replace('<form_rander>', '').replace('</form_rander>', '')
form_setting = json.loads(form_setting_str)
form_setting['is_submit'] = True
form_setting['form_data'] = node_data
value = f'<form_rander>{json.dumps(form_setting)}</form_rander>'
res = re.sub('<form_rander>.*?</form_rander>',
res = re.sub(r'<form_rander>[\d\D]*?</form_rander>',
'${value}', content)
application_node['content'] = res.replace('${value}', value)
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<form_rander>[\d\D]*?<\/form_rander>', '', message.content)
message.content = re.sub(r'<form_rander>[\d\D]*?</form_rander>', '', message.content)
return history_message

def build_system_prompt(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<form_rander>[\d\D]*?<\/form_rander>', '', message.content)
message.content = re.sub(r'<form_rander>[\d\D]*?</form_rander>', '', message.content)
return history_message

def generate_prompt_question(self, prompt):
Expand Down
2 changes: 1 addition & 1 deletion apps/common/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def markdown_to_plain_text(md: str) -> str:
# 去除多余的空白字符(包括换行符、制表符等)
text = re.sub(r'\s+', ' ', text)
# 去除表单渲染
re.sub(r'<form_rander>[\s\S]*?<\/form_rander>', '', text)
text = re.sub(r'<form_rander>[\d\D]*?</form_rander>', '', text)
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 Apr 24, 2026

Choose a reason for hiding this comment

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

遗漏了 text =

# 去除首尾空格
text = text.strip()
return text
Expand Down
14 changes: 7 additions & 7 deletions apps/knowledge/serializers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
break
file = QuerySet(File).filter(id=r).first()
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=image_id).first()
if file is None:
break
zip_inner_path = os.path.join('oss', 'file', r)
continue
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 Apr 24, 2026

Choose a reason for hiding this comment

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

顺便修复:所有图片处理完

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))
Expand Down
2 changes: 1 addition & 1 deletion apps/knowledge/task/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ 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"<question>(.*?)</question>"
pattern = r"<question>([\d\D]*?)</question>"
match = re.search(pattern, problem)
problem = match.group(1) if match else None
if problem is None or len(problem) == 0:
Expand Down
4 changes: 2 additions & 2 deletions apps/models_provider/serializers/model_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

顺便优化:if with_valid 未进入时,model 也为 None,也要抛出该异常,所以移到 if with_valid 之外。

return {'id': str(model.id), 'provider': model.provider, 'name': model.name, 'model_type': model.model_type,
'model_name': model.model_name,
'status': model.status,
Expand Down
3 changes: 2 additions & 1 deletion apps/trigger/handler/simple_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("不支持的触发器类型")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

顺便优化:遗漏了判断。

Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function markdownToPlainText(md: string) {
}

function removeFormRander(text: string) {
return text.replace(/<form_rander>[\s\S]*?<\/form_rander>/g, '').trim()
return text.replace(/<form_rander>[\d\D]*?<\/form_rander>/g, '').trim()
}
function getKey(keys: Array<number>, index: number) {
// 从后往前查找第一个小于等于index的键
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function markdownToPlainText(md: string) {
}

function removeFormRander(text: string) {
return text.replace(/<form_rander>[\s\S]*?<\/form_rander>/g, '').trim()
return text.replace(/<form_rander>[\d\D]*?<\/form_rander>/g, '').trim()
}

const playAnswerText = (text: string) => {
Expand Down
Loading