import os with open("core/templates/base.html", "r") as f: content = f.read() widget_html = """
MasarX AI
{% trans "Hello! How can I help you with your shipments today?" %}
" if "masar-chat-toggle" not in content: new_content = content.replace("", widget_html + "\n") with open("core/templates/base.html", "w") as f: f.write(new_content) print("Updated base.html") else: print("Widget already exists")