This commit is contained in:
Saifeddine ALOUI 2024-07-05 06:53:17 +02:00
parent 46a368c29c
commit ddd6090982
8 changed files with 8 additions and 8 deletions

@ -1 +1 @@
Subproject commit 593cb246715c4f7c7db189530c3db527e015f705 Subproject commit 971b4e89cd40fba2f6d1f46e2d4428ae193bb10b

View File

@ -106,7 +106,7 @@ def execute_graphviz(code, client:Client, message_id, build_file=False):
tmp_file = root_folder/f"ai_code_{message_id}.html" tmp_file = root_folder/f"ai_code_{message_id}.html"
with open(tmp_file,"w",encoding="utf8") as f: with open(tmp_file,"w",encoding="utf8") as f:
f.write(build_graphviz_output(code)["output"]) f.write(build_graphviz_output(code)["output"])
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_to_url(tmp_file)}" link = f"{host}:{lollmsElfServer.config.port}{discussion_path_to_url(tmp_file)}"
execution_time = time.time() - start_time execution_time = time.time() - start_time
output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time} output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time}
return output_json return output_json

View File

@ -56,7 +56,7 @@ def execute_html(code, client:Client, message_id, build_file=False):
tmp_file = root_folder/f"ai_code_{message_id}.html" tmp_file = root_folder/f"ai_code_{message_id}.html"
with open(tmp_file,"w",encoding="utf8") as f: with open(tmp_file,"w",encoding="utf8") as f:
f.write(code) f.write(code)
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_to_url(tmp_file)}" link = f"{host}:{lollmsElfServer.config.port}{discussion_path_to_url(tmp_file)}"
# Stop the timer. # Stop the timer.
execution_time = time.time() - start_time execution_time = time.time() - start_time
output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time} output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time}

View File

@ -75,7 +75,7 @@ def execute_javascript(code, client:Client, message_id, build_file=False):
tmp_file = root_folder/f"ai_code_{message_id}.html" tmp_file = root_folder/f"ai_code_{message_id}.html"
with open(tmp_file,"w",encoding="utf8") as f: with open(tmp_file,"w",encoding="utf8") as f:
f.write(build_javascript_output(code)["output"]) f.write(build_javascript_output(code)["output"])
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_to_url(tmp_file)}" link = f"{host}:{lollmsElfServer.config.port}{discussion_path_to_url(tmp_file)}"
execution_time = time.time() - start_time execution_time = time.time() - start_time
output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time} output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time}
return output_json return output_json

View File

@ -105,6 +105,6 @@ def execute_latex(code, client:Client, message_id):
else: else:
host = lollmsElfServer.config.host host = lollmsElfServer.config.host
url = f"{host}:{lollmsElfServer.config.port}/{discussion_path_to_url(pdf_file)}" url = f"{host}:{lollmsElfServer.config.port}{discussion_path_to_url(pdf_file)}"
output_json = {"output": f"Pdf file generated at: {pdf_file}\n<a href='{url}' target='_blank'>Click here to show</a>", "execution_time": execution_time} output_json = {"output": f"Pdf file generated at: {pdf_file}\n<a href='{url}' target='_blank'>Click here to show</a>", "execution_time": execution_time}
return output_json return output_json

View File

@ -139,7 +139,7 @@ def execute_mermaid(code, client:Client, message_id, build_file=False):
tmp_file = root_folder/f"ai_code_{message_id}.html" tmp_file = root_folder/f"ai_code_{message_id}.html"
with open(tmp_file,"w",encoding="utf8") as f: with open(tmp_file,"w",encoding="utf8") as f:
f.write(build_mermaid_output(code)["output"]) f.write(build_mermaid_output(code)["output"])
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_to_url(tmp_file)}" link = f"{host}:{lollmsElfServer.config.port}{discussion_path_to_url(tmp_file)}"
# Stop the timer. # Stop the timer.
execution_time = time.time() - start_time execution_time = time.time() - start_time
output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time} output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time}

View File

@ -139,7 +139,7 @@ def execute_svg(code, client:Client, message_id, build_file=False):
tmp_file = root_folder/f"ai_svg_{message_id}.svg" tmp_file = root_folder/f"ai_svg_{message_id}.svg"
with open(tmp_file,"w",encoding="utf8") as f: with open(tmp_file,"w",encoding="utf8") as f:
f.write(code) f.write(code)
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_to_url(tmp_file)}" link = f"{host}:{lollmsElfServer.config.port}{discussion_path_to_url(tmp_file)}"
# Stop the timer. # Stop the timer.
execution_time = time.time() - start_time execution_time = time.time() - start_time
output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time} output_json = {"output": f'<b>Page built successfully</b><br><a href="{link}" target="_blank">Press here to view the page</a>', "execution_time": execution_time}

@ -1 +1 @@
Subproject commit 08e1f607cf439a509dc4742b5b32cacdbe2cff3e Subproject commit d036a6c69c35dbb1487857151a53a4c890a17a0d