mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-03-10 22:44:22 +00:00
fixed execution engines
This commit is contained in:
parent
cadcdbaa62
commit
c9f0381535
@ -83,7 +83,7 @@ def execute_graphviz(code, client:Client, message_id, build_file=False):
|
|||||||
root_folder.mkdir(parents=True,exist_ok=True)
|
root_folder.mkdir(parents=True,exist_ok=True)
|
||||||
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))
|
f.write(build_graphviz_output(code)["output"])
|
||||||
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}"
|
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}"
|
||||||
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
|
||||||
|
@ -64,7 +64,7 @@ def execute_javascript(code, client:Client, message_id, build_file=False):
|
|||||||
root_folder.mkdir(parents=True,exist_ok=True)
|
root_folder.mkdir(parents=True,exist_ok=True)
|
||||||
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))
|
f.write(build_javascript_output(code)["output"])
|
||||||
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}"
|
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}"
|
||||||
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
|
||||||
|
@ -97,7 +97,7 @@ def execute_mermaid(code, client:Client, message_id, build_file=False):
|
|||||||
root_folder.mkdir(parents=True,exist_ok=True)
|
root_folder.mkdir(parents=True,exist_ok=True)
|
||||||
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))
|
f.write(build_mermaid_output(code)["output"])
|
||||||
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}"
|
link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}"
|
||||||
# Stop the timer.
|
# Stop the timer.
|
||||||
execution_time = time.time() - start_time
|
execution_time = time.time() - start_time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user