fix: 修复正则表达式中的括号匹配,优化统计输出格式

This commit is contained in:
春河晴
2025-04-16 16:26:15 +09:00
parent a8d48fc6cf
commit 328d759ace
4 changed files with 15 additions and 25 deletions

View File

@@ -119,7 +119,7 @@ class Prompt(str):
# 解析模板
template_args = []
result = re.findall(r"\{(.*?)\}", processed_fstr)
result = re.findall(r"\{(.*?)}", processed_fstr)
for expr in result:
if expr and expr not in template_args:
template_args.append(expr)
@@ -164,7 +164,7 @@ class Prompt(str):
processed_template = cls._process_escaped_braces(template)
template_args = []
result = re.findall(r"\{(.*?)\}", processed_template)
result = re.findall(r"\{(.*?)}", processed_template)
for expr in result:
if expr and expr not in template_args:
template_args.append(expr)