"""Apply the user's offline Doubao environment note to presentation copies only.""" from pathlib import Path import hashlib import json WORK = Path(__file__).resolve().parent POLICY = 'offline-doubao-environment-user-note-20261109' def main(): edits = json.loads((WORK / 'presentation-edits.json').read_bytes()) def change(path, replacements, original=None): target = WORK / path original = original or path value = (WORK / original).read_text(encoding='utf-8') if not target.exists() else target.read_text(encoding='utf-8') for before, after in replacements: if before not in value: assert any(e.get('policy') == POLICY and e['display'] == path and e['before'] == before for e in edits['edits']) continue assert value.count(before) == 1, path value = value.replace(before, after, 1) record = {'policy': POLICY, 'source': original, 'display': path, 'before': before, 'after': after, 'reason': 'remove model/tool payment or collection-cost framing following user environment clarification; preserve product economics and raw dialogue'} if record not in edits['edits']: edits['edits'].append(record) target.write_text(value, encoding='utf-8') change('rounds/R03/prompt-display.txt', [ ('可继续用已有授权和免费公开来源补充必要证据;涉及新增费用时,先给具体采集范围、用途和预算。', '可继续用已有授权范围内的公开来源补充必要证据。'), ], 'rounds/R03/prompt-verbatim.txt') change('rounds/R04/prompt-display.txt', [ ('免费公开资料', '公开资料'), ('继续在已有授权和无新增费用范围内补证,不把每品牌30条当作充分验证。涉及付费或实物测试时,再提出具体方案和预算。', '继续在已有授权范围内补证,不把每品牌30条当作充分验证。涉及实物测试时,先提出具体方案。'), ], 'rounds/R04/prompt-verbatim.txt') change('rounds/R03/reply-display.md', [ ('问题 2 零费用,库内定向检索即可;', '问题 2 可在库内定向检索;'), ]) change('rounds/R02/artifacts/atlas-display.html', [ ('本轮未采集、未付费、未做实物测试', '本轮未采集、未做实物测试'), ]) change('rounds/R03/artifacts/atlas-display.html', [ ('研究问题 1 的成本最高(需外部采集授权),问题 2 成本最低(库内定向检索即可,零费用)。', '研究问题 1 需外部采集,问题 2 可在库内定向检索。'), ('未采集、未付费、未做实物测试、未改研究资料', '未采集、未做实物测试、未改研究资料'), ]) change('rounds/R04/artifacts/comparison-display.html', [ ('零新增费用,未购样、未实测', '未购样、未实测'), ('本页零付费、未购样、未做实物测试', '本页未购样、未做实物测试'), ]) # This was already provided to the user. Preserve it; prepare an alternate # wording without implying that it has been forwarded or executed. change('rounds/R05/prompt-current.txt', [ ('本轮继续使用免费公开资料,不购样、不付费测试。', '本轮先核对公开资料,暂不购样或开展实物测试。'), ], 'rounds/R05/prompt-verbatim.txt') edits['environmentPolicyApplied'] = POLICY (WORK / 'presentation-edits.json').write_text(json.dumps(edits, ensure_ascii=False, indent=2) + '\n', encoding='utf-8') case = json.loads((WORK / 'case.json').read_bytes()) case['operatingContext'] = { 'source': 'user-explicit-environment-note', 'date': '2026-11-09', 'platform': 'offline classroom uses Doubao with free Skill installation and workflow execution', 'modelAndSkillPaymentFraming': 'omit from prompts, feedback, acceptance and demonstration', 'productEconomicsStillRelevant': True, 'physicalResources': 'state concrete needs when relevant; do not conflate with model execution', 'actualCapabilities': 'verify actual access separately; free installation does not prove collection availability', 'originalDialoguePreserved': True} fifth = next(r for r in case['rounds'] if r['roundId'] == 'R05') fifth['currentPromptPath'] = 'rounds/R05/prompt-current.txt' fifth['promptVariantReason'] = 'user clarified offline Doubao environment after original prompt was provided' for original, digest in edits['originalFileSha256'].items(): assert hashlib.sha256((WORK / original).read_bytes()).hexdigest() == digest (WORK / 'case.json').write_text(json.dumps(case, ensure_ascii=False, indent=2) + '\n', encoding='utf-8') print(json.dumps({'environmentNoteRecorded': True, 'rawDialogueUnchanged': True, 'newBusinessExecution': False}, ensure_ascii=False)) if __name__ == '__main__': main()