mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
enhanced execution engines
This commit is contained in:
parent
bd2588d73a
commit
b9a93a2d1b
@ -55,8 +55,9 @@ def execute_latex(code, client:Client, message_id):
|
||||
# Check the return code of the pdflatex command
|
||||
if result.returncode != 0:
|
||||
error_message = result.stderr.strip()
|
||||
std_mesasge = result.stdout.strip()
|
||||
execution_time = time.time() - start_time
|
||||
error_json = {"output": f"Error occurred while compiling LaTeX: {error_message}", "execution_time": execution_time}
|
||||
error_json = {"output": f"Output:{std_mesasge}\nError occurred while compiling LaTeX:\n{error_message}", "execution_time": execution_time}
|
||||
return error_json
|
||||
# If the compilation is successful, you will get a PDF file
|
||||
pdf_file = tmp_file.with_suffix('.pdf')
|
||||
|
@ -55,9 +55,9 @@ def execute_python(code, client:Client, message_id):
|
||||
if process.returncode != 0:
|
||||
# The child process threw an exception.
|
||||
try:
|
||||
error_message = f"Error executing Python code: {error.decode('utf8')}"
|
||||
error_message = f"Output:{output.decode('utf-8', errors="ignore")}\nError executing Python code:\n{error.decode('utf-8', errors="ignore")}"
|
||||
except:
|
||||
error_message = f"Error executing Python code: {error}"
|
||||
error_message = f"Error executing Python code:\n{error}"
|
||||
error_json = {"output": "<div class='text-red-500'>"+error_message+"</div>", "execution_time": execution_time}
|
||||
return error_json
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user