moved skills library to lollms ap

This commit is contained in:
Saifeddine ALOUI 2024-03-11 01:02:41 +01:00
parent c6fcfa3686
commit 1c6d48b174
2 changed files with 3 additions and 4 deletions

View File

@ -63,6 +63,7 @@ class LollmsApplication(LoLLMsCom):
self.session = Session(lollms_paths) self.session = Session(lollms_paths)
self.skills_library = SkillsLibrary(self.lollms_paths.personal_skills_path/(self.config.skills_lib_database_name+".db")) self.skills_library = SkillsLibrary(self.lollms_paths.personal_skills_path/(self.config.skills_lib_database_name+".db"))
if not free_mode: if not free_mode:
try: try:
if config.auto_update: if config.auto_update:
@ -131,7 +132,6 @@ class LollmsApplication(LoLLMsCom):
def add_discussion_to_skills_library(self, client: Client): def add_discussion_to_skills_library(self, client: Client):
messages = client.discussion.get_messages() messages = client.discussion.get_messages()
db = client.discussion.skills_db
# Extract relevant information from messages # Extract relevant information from messages
content = self._extract_content(messages) content = self._extract_content(messages)
@ -145,7 +145,7 @@ class LollmsApplication(LoLLMsCom):
category = self._generate_text(category_prompt) category = self._generate_text(category_prompt)
# Add entry to skills library # Add entry to skills library
db.add_entry(1, category, title, content) self.skills_library.add_entry(1, category, title, content)
return category, title, content return category, title, content
def _extract_content(self, messages:List[Message]): def _extract_content(self, messages:List[Message]):

View File

@ -599,8 +599,7 @@ class Discussion:
self.discussion_skills_folder.mkdir(exist_ok=True) self.discussion_skills_folder.mkdir(exist_ok=True)
self.discussion_rag_folder.mkdir(exist_ok=True) self.discussion_rag_folder.mkdir(exist_ok=True)
self.messages = self.get_messages() self.messages = self.get_messages()
self.skills_db_path = self.discussion_skills_folder/"skills_db.db"
self.skills_db = SkillsLibrary(self.skills_db_path)
if len(self.messages)>0: if len(self.messages)>0:
self.current_message = self.messages[-1] self.current_message = self.messages[-1]