Skip to content

Commit aab3083

Browse files
committed
fix: stripMd 清理不成对** + has_code解析增强 + prompt禁止**残留
1 parent a8085a9 commit aab3083

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

prompts/deep-analysis.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ arXiv ID: {arxivId}
3333
## 机器摘要
3434
**必须严格按照以下键值对格式输出,每行一个键值对,键名必须与示例完全一致,禁止输出散文段落。如果某项信息无法确定,写"未说明"。**
3535
36+
**格式红线**:严禁在键值对中的任何位置使用 `**`、`*`、`__` 等 Markdown 格式标记。`**has_code:** 是` 和 `has_code: ** 是` 都是错误的,必须写纯文本 `has_code: 是`。**
37+
3638
```
3739
rank_bucket: 前10% / 前25% / 前50% / 后50%
3840
innovation: X.X

prompts/gap-fill.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ arXiv ID: {arxivId}
4747
4. **保留格式**:输出必须包含以下完整章节,格式与已有分析一致:
4848
- ## 评分(**必须**以 `X.X/10` 格式输出总分)
4949
- ## 机器摘要(**极其重要,必须严格遵守**):
50-
* 每行必须是 `key: value` 格式,**不要用 `-`、`*`、`1.` 等列表符号开头**
51-
* **不要加粗键名**(`**rank_bucket**: 是错误的)
50+
* 每行必须是 `key: value` 格式,**不要用 `-`、`*`、`1.` 等列表符号开头**
51+
* **禁止加粗键名或值**(`**rank_bucket**:` 和 `has_code: ** 是` 都是错误的,必须写 `has_code: 是`)
52+
* **值部分严禁出现任何 Markdown 格式标记**(`**`、`__`、`*` 等)
5253
* 键名必须是英文小写+下划线:rank_bucket / innovation / technical_rigor / experimental_sufficiency / clarity / impact / open_source / reproducibility / engineering_score / confidence / primary_task_tag / primary_method_tag / sota_claim / has_code / has_model / has_dataset
5354
* `rank_bucket` 只能写 前10% / 前25% / 前50% / 后50%,**严禁使用字母或英文**
5455
* `innovation`、`technical_rigor`、`experimental_sufficiency`、`clarity`、`impact`、`open_source`、`reproducibility`、`engineering_score` 必须是纯数字,**严禁使用文字描述**

scripts/utils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ function stripMd(text) {
178178
t = t.replace(/\*\*(.+?)\*\*/g, '$1');
179179
t = t.replace(/__(.+?)__/g, '$1');
180180
t = t.replace(/\*(.+?)\*/g, '$1');
181+
// 清理残留的不成对 ** 和 __
182+
t = t.replace(/\*\*/g, '');
183+
t = t.replace(/__/g, '');
181184
return t.trim();
182185
}
183186

@@ -309,6 +312,8 @@ function parseMachineSummary(analysis) {
309312

310313
// 对于 has_code/has_model/has_dataset,标准化
311314
if (['hasCode', 'hasModel', 'hasDataset'].includes(mappedKey)) {
315+
// 先清理残留的 Markdown 加粗标记
316+
val = val.replace(/\*\*/g, '').trim();
312317
const yesNoMap = {
313318
'是': '是', 'yes': '是', 'y': '是', '有': '是',
314319
'否': '否', 'no': '否', 'n': '否', '无': '否',

scripts/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def strip_md(t):
3030
t = re.sub(r'\*(.+?)\*', r'\1', t)
3131
t = re.sub(r'_(.+?)_', r'\1', t)
3232
t = re.sub(r'`(.+?)`', r'\1', t)
33+
# 清理残留的不成对 ** 和 __
34+
t = t.replace('**', '')
35+
t = t.replace('__', '')
3336
t = re.sub(r'^#{1,6}\s+', '', t, flags=re.MULTILINE)
3437
return t.strip()
3538

0 commit comments

Comments
 (0)