import re with open("frontend/interactive_server.py", "r", encoding="utf-8") as f: content = f.read() # Replace ctx.web_ctx.web_runtime with ctx.web_runtime content = content.replace("ctx.web_ctx.web_runtime", "ctx.web_runtime") # In command_worker_loop, run_pipeline_threadsafe was called with ctx.web_runtime, but it should be ctx # Let's find the call and fix it. content = content.replace("ctx.web_runtime,\n command[\"token\"]", "ctx,\n command[\"token\"]") # Replace current_sim with ctx.sim content = content.replace("current_sim", "ctx.sim") with open("frontend/interactive_server.py", "w", encoding="utf-8") as f: f.write(content) print("Fixed interactive_server.py")