Why: The U1 controlled trial finished; its fixtures, validator, runner, per-run results, report, and renderer spike must be reviewable from the task branch, and the task card needs the final PASS/FAIL record. Evidence: results/summary.json + report.md (SELF, MiniMax official channel, CNY 3 of 200 cap); make evidence receipts for precheck, task-sync, and make test follow in this branch. Impact: Task-scoped experiment artifacts only (.task/genui-u1/); no production code changes. Refs: Documents PR #62 (proposal r2); task card feature/generative-ui-u1
25 lines
944 B
Python
25 lines
944 B
Python
#!/usr/bin/env python3
|
|
"""剥离 MiniMax 内联 <think> 段:B 臂 markdown 与 G 臂原始输出统一清洗(保留 raw_* 备审计)。"""
|
|
import glob, json, re
|
|
n = 0
|
|
for f in glob.glob('results/*/*.json'):
|
|
if f.endswith('summary.json'):
|
|
continue
|
|
r = json.load(open(f))
|
|
for mdkey in ('markdown',):
|
|
md = r.get(mdkey, '')
|
|
if '<think>' in md:
|
|
r['raw_' + mdkey] = md
|
|
r[mdkey] = re.sub(r'<think>.*?</think>\s*', '', md, flags=re.S).strip()
|
|
r['think_stripped'] = True
|
|
if mdkey == 'markdown':
|
|
r['ok'] = bool(r[mdkey])
|
|
n += 1
|
|
for rk in ('raw_first', 'raw_repair'):
|
|
rv = r.get(rk, '')
|
|
if '<think>' in rv:
|
|
r[rk + '_original'] = rv
|
|
r[rk] = re.sub(r'<think>.*?</think>\s*', '', rv, flags=re.S).strip()
|
|
json.dump(r, open(f, 'w'), ensure_ascii=False, indent=1)
|
|
print('cleaned', n, 'records')
|