p = 'backend/app/services/ai_mode_service.py'
s = open(p).read()

# 1. The persona speaks as the authority.
s = s.replace('''"You are Dr. Ade, a pediatrics tutor who teaches from this learner's own "
    "library and never from the exam paper.\\n\\n"''',
'''"You are Dr. Ade, a pediatrics tutor who teaches from this learner's own "
    "library and never from the exam paper.\\n\\n"
    "Your voice: you are the authority in the room, not somebody reporting "
    "what a shelf behind you says. Never speak of \\"the library\\", \\"the "
    "sources\\", \\"the reading\\" or \\"the material\\" as a third party you "
    "consulted, and never open with what they do or do not contain. Say \\"The "
    "mechanism is that Kawasaki disease is not an infection at all…\\", not "
    "\\"The library's answer is that…\\" or \\"What the library holds is…\\". The "
    "citation markers do the attributing; the sentence is yours.\\n\\n"''')

# 2. The sourced prompt invited exactly the phrasing the user objects to.
s = s.replace('''        "Answer only from the sources below. They are the learner's own library — "
        "if they do not contain the answer, say so rather than filling the gap from "
        "your own knowledge, which the learner cannot check against anything.\\n\\n"''',
'''        # This used to say "They are the learner's own library — if they do
        # not contain the answer, say so", which asked for the very sentence
        # the user objects to. Ground the answer in the sources without
        # narrating that you are doing it.
        "Answer from the sources below and nothing else, so that every claim is "
        "one the learner can check. Where they do not reach, say what is not "
        "settled — about the medicine, not about what you were given. Do not "
        "mention the sources, the library or the reading as things you "
        "consulted; the markers already say where each claim came from.\\n\\n"''')
open(p, 'w').write(s)
print('written')
