File size: 729 Bytes
a20b02d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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")