MCPcopy Create free account
hub / github.com/SamuelSchmidgall/AgentLaboratory / execute_command

Method execute_command

papersolver.py:136–156  ·  view source on GitHub ↗
(self, *args)

Source from the content-addressed store, hash-verified

134 )
135
136 def execute_command(self, *args) -> str:
137 # args[0] -> N (int)
138 # args[1] -> M (int)
139 # args[2] -> old latex
140 # args[3] -> new lines to replace
141 try:
142 args = args[0]
143 current_latex = args[2]
144 lines_to_add = list(reversed(args[3]))
145 lines_to_replace = list(reversed(range(args[0], args[1]+1)))
146 for _ln in lines_to_replace:
147 current_latex.pop(_ln)
148 for _line in lines_to_add:
149 current_latex.insert(args[0], _line)
150 new_latex = "\n".join(current_latex)
151 latex_exec = f"{new_latex}"
152 latex_ret = compile_latex(latex_exec, self.save_loc, compile=args[4])
153 if "error" in latex_ret.lower(): return (False, None, latex_ret)
154 return (True, current_latex, latex_ret)
155 except Exception as e:
156 return (False, None, str(e))
157
158 def matches_command(self, cmd_str) -> bool:
159 if "```EDIT" in cmd_str: return True

Callers

nothing calls this directly

Calls 1

compile_latexFunction · 0.85

Tested by

no test coverage detected