mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-04-10 12:19:54 +00:00
fixed bugs
This commit is contained in:
parent
190e9f0693
commit
eddb3b68b7
@ -247,7 +247,6 @@ class LLMBinding:
|
||||
|
||||
def install_model(self, model_type:str, model_path:str, variant_name:str, client_id:int=None):
|
||||
print("Install model triggered")
|
||||
sanitize_path(model_path)
|
||||
model_path = model_path.replace("\\","/")
|
||||
parts = model_path.split("/")
|
||||
if parts[2]=="huggingface.co":
|
||||
|
@ -177,7 +177,19 @@ class SkillsLibrary:
|
||||
return list(set([r[0] for r in res]))
|
||||
|
||||
|
||||
def get_titles(self, category):
|
||||
def get_titles(self):
|
||||
conn = sqlite3.connect(self.db_path)
|
||||
cursor = conn.cursor()
|
||||
# Use direct string concatenation for the MATCH expression.
|
||||
# Ensure text is safely escaped to avoid SQL injection.
|
||||
query = "SELECT id, title FROM skills_library"
|
||||
cursor.execute(query)
|
||||
res = cursor.fetchall()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
return [{"id":r[0], "title":r[1]} for r in res]
|
||||
|
||||
def get_titles_by_category(self, category):
|
||||
conn = sqlite3.connect(self.db_path)
|
||||
cursor = conn.cursor()
|
||||
# Use direct string concatenation for the MATCH expression.
|
||||
|
@ -25,7 +25,7 @@ from pathlib import Path
|
||||
router = APIRouter()
|
||||
lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance()
|
||||
|
||||
class DiscussionInfos(BaseModel):
|
||||
class clientInfos(BaseModel):
|
||||
client_id: str
|
||||
|
||||
class SkillInfos(BaseModel):
|
||||
@ -45,18 +45,23 @@ class CategoryData(BaseModel):
|
||||
|
||||
|
||||
@router.post("/get_skills_library")
|
||||
def get_skills_library_categories(discussionInfos:DiscussionInfos):
|
||||
def get_skills_library_categories(discussionInfos:clientInfos):
|
||||
return {"status":True, "entries":lollmsElfServer.skills_library.dump()}
|
||||
|
||||
@router.post("/get_skills_library_categories")
|
||||
def get_skills_library_categories(discussionInfos:DiscussionInfos):
|
||||
def get_skills_library_categories(discussionInfos:clientInfos):
|
||||
# get_categories returns a list of strings, each entry is a category
|
||||
return {"status":True, "categories":lollmsElfServer.skills_library.get_categories()}
|
||||
|
||||
@router.post("/get_skills_library_titles")
|
||||
def get_skills_library_categories(categoryData:CategoryData):
|
||||
@router.post("/get_skills_library_titles_by_category")
|
||||
def get_skills_library_titles(categoryData:CategoryData):
|
||||
# Get titles returns a list of dict each entry has id and title
|
||||
return {"status":True, "titles":lollmsElfServer.skills_library.get_titles(categoryData.category)}
|
||||
return {"status":True, "titles":lollmsElfServer.skills_library.get_titles_by_category(categoryData.category)}
|
||||
|
||||
@router.post("/get_skills_library_titles")
|
||||
def get_skills_library_titles(clientInfos:clientInfos):
|
||||
# Get titles returns a list of dict each entry has id and title
|
||||
return {"status":True, "titles":lollmsElfServer.skills_library.get_titles()}
|
||||
|
||||
@router.post("/get_skills_library_content")
|
||||
def get_skills_library_content(skillInfos:SkillInfos):
|
||||
|
Loading…
x
Reference in New Issue
Block a user