更新内容: - 后端 AI 服务优化(能力分析、知识点解析等) - 前端考试和陪练界面更新 - 修复多个 prompt 和 JSON 解析问题 - 更新 Coze 语音客户端
This commit is contained in:
@@ -256,6 +256,16 @@ def _preprocess_text(text: str) -> str:
|
||||
# 移除零宽字符
|
||||
text = re.sub(r'[\u200b\u200c\u200d\ufeff]', '', text)
|
||||
|
||||
# 【重要】先替换中文标点为英文标点(在找边界之前做,否则中文引号会破坏边界检测)
|
||||
cn_punctuation = {
|
||||
',': ',', '。': '.', ':': ':', ';': ';',
|
||||
'"': '"', '"': '"', ''': "'", ''': "'",
|
||||
'【': '[', '】': ']', '(': '(', ')': ')',
|
||||
'{': '{', '}': '}',
|
||||
}
|
||||
for cn, en in cn_punctuation.items():
|
||||
text = text.replace(cn, en)
|
||||
|
||||
# 提取 Markdown 代码块
|
||||
patterns = [
|
||||
r'```json\s*([\s\S]*?)\s*```',
|
||||
@@ -705,3 +715,4 @@ def clean_llm_output(text: str) -> Tuple[str, List[str]]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user