mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-20 04:47:55 +00:00
advanced
This commit is contained in:
parent
ac0e86c29b
commit
d011fec1bc
@ -107,6 +107,7 @@ async def open_code_folder_in_vs_code(request: Request):
|
||||
"""
|
||||
|
||||
try:
|
||||
if "discussion_id" in data:
|
||||
data = (await request.json())
|
||||
code = data["code"]
|
||||
discussion_id = data.get("discussion_id","unknown_discussion")
|
||||
@ -122,6 +123,13 @@ async def open_code_folder_in_vs_code(request: Request):
|
||||
f.write(code)
|
||||
|
||||
os.system('code ' + str(root_folder))
|
||||
elif "folder_path" in data:
|
||||
ASCIIColors.info("Opening folder:")
|
||||
# Create a temporary file.
|
||||
root_folder = data["folder_path"]
|
||||
root_folder.mkdir(parents=True,exist_ok=True)
|
||||
os.system('code ' + str(root_folder))
|
||||
|
||||
return {"output": "OK", "execution_time": 0}
|
||||
except Exception as ex:
|
||||
trace_exception(ex)
|
||||
@ -192,6 +200,7 @@ async def open_code_folder(request: Request):
|
||||
|
||||
try:
|
||||
data = (await request.json())
|
||||
if "discussion_id" in data:
|
||||
discussion_id = data.get("discussion_id","unknown_discussion")
|
||||
|
||||
ASCIIColors.info("Opening folder:")
|
||||
@ -205,6 +214,19 @@ async def open_code_folder(request: Request):
|
||||
elif platform.system() == 'Darwin':
|
||||
os.system('open ' + str(root_folder))
|
||||
return {"output": "OK", "execution_time": 0}
|
||||
elif "folder_path" in data:
|
||||
ASCIIColors.info("Opening folder:")
|
||||
# Create a temporary file.
|
||||
root_folder = data["folder_path"]
|
||||
root_folder.mkdir(parents=True,exist_ok=True)
|
||||
if platform.system() == 'Windows':
|
||||
os.startfile(str(root_folder))
|
||||
elif platform.system() == 'Linux':
|
||||
os.system('xdg-open ' + str(root_folder))
|
||||
elif platform.system() == 'Darwin':
|
||||
os.system('open ' + str(root_folder))
|
||||
return {"output": "OK", "execution_time": 0}
|
||||
|
||||
except Exception as ex:
|
||||
trace_exception(ex)
|
||||
lollmsElfServer.error(ex)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 5cb7a7598716dbe733cb2cbbc911e87c50fdf9fb
|
||||
Subproject commit 3a2c5c3995076d2a415e79c23439dee92cb049ad
|
Loading…
Reference in New Issue
Block a user