mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-20 04:47:55 +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
|
# Check the return code of the pdflatex command
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
error_message = result.stderr.strip()
|
error_message = result.stderr.strip()
|
||||||
|
std_mesasge = result.stdout.strip()
|
||||||
execution_time = time.time() - start_time
|
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
|
return error_json
|
||||||
# If the compilation is successful, you will get a PDF file
|
# If the compilation is successful, you will get a PDF file
|
||||||
pdf_file = tmp_file.with_suffix('.pdf')
|
pdf_file = tmp_file.with_suffix('.pdf')
|
||||||
|
@ -55,9 +55,9 @@ def execute_python(code, client:Client, message_id):
|
|||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
# The child process threw an exception.
|
# The child process threw an exception.
|
||||||
try:
|
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:
|
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}
|
error_json = {"output": "<div class='text-red-500'>"+error_message+"</div>", "execution_time": execution_time}
|
||||||
return error_json
|
return error_json
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user