This commit is contained in:
saloui 2024-01-24 12:08:01 +01:00
parent 4d23e76d23
commit f4e5aa3d7a
3 changed files with 24 additions and 7 deletions

View File

@ -2423,7 +2423,8 @@ The AI should respond in this format using data from actions_list:
block_infos["type"]=sub_text[:next_index] block_infos["type"]=sub_text[:next_index]
next_pos = indices[index+1]-code_delimiter_position+3 next_pos = indices[index+1]-code_delimiter_position+3
block_infos["content"]=sub_text[start_pos:next_pos] block_infos["content"]=sub_text[start_pos:next_pos].strip()
code_blocks.append(block_infos)
is_start = False is_start = False
else: else:
is_start = True is_start = True

View File

@ -15,7 +15,7 @@ from lollms.utilities import load_config
from pathlib import Path from pathlib import Path
from typing import List from typing import List
import psutil import psutil
import os
# ----------------------- Defining router and main class ------------------------------ # ----------------------- Defining router and main class ------------------------------
router = APIRouter() router = APIRouter()
lollmsElfServer = LOLLMSElfServer.get_instance() lollmsElfServer = LOLLMSElfServer.get_instance()
@ -49,4 +49,16 @@ def get_server_address(request:Request):
def open_folder(path: str):
path = Path(path).absolute()
if not path.is_dir():
raise FileNotFoundError(f"The provided path '{path}' is not a directory.")
os.startfile(path)
@router.get("/open_folder")
async def open_folder(request: Request, path: str):
if Path(path).exists() and Path(path).is_dir():
os.startfile(path)
return {"message": "Folder opened successfully."}
else:
return {"message": "Invalid folder path or the folder does not exist."}

View File

@ -40,12 +40,16 @@ def verify_xtts(lollms_paths:LollmsPaths):
xtts_folder = shared_folder / "xtts" xtts_folder = shared_folder / "xtts"
return xtts_folder.exists() return xtts_folder.exists()
def install_xtts(lollms_paths:LollmsPaths): def install_xtts(lollms_app:LollmsApplication):
root_dir = lollms_paths.personal_path root_dir = lollms_app.lollms_paths.personal_path
shared_folder = root_dir/"shared" shared_folder = root_dir/"shared"
xtts_folder = shared_folder / "xtts" xtts_folder = shared_folder / "xtts"
if not PackageManager.check_package_installed("xtts-api-server"): if xtts_folder.exists() and PackageManager.check_package_installed("xtts-api-server"):
PackageManager.install_package("xtts-api-server") if not lollms_app.YesNoMessage("It looks like xtts is already installed on your system.\nDo you want to reinstall it?"):
lollms_app.error("Service installation canceled")
return
PackageManager.install_package("xtts-api-server")
xtts_folder.mkdir(exist_ok=True,parents=True) xtts_folder.mkdir(exist_ok=True,parents=True)
ASCIIColors.green("XTTS server installed successfully") ASCIIColors.green("XTTS server installed successfully")