mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-02-23 10:30:15 +00:00
Update app.py
This commit is contained in:
parent
ad7177a8ac
commit
b7414853da
@ -7,8 +7,10 @@ from lollms.config import InstallOption
|
|||||||
from lollms.helpers import trace_exception
|
from lollms.helpers import trace_exception
|
||||||
from lollms.terminal import MainMenu
|
from lollms.terminal import MainMenu
|
||||||
from lollms.utilities import PromptReshaper
|
from lollms.utilities import PromptReshaper
|
||||||
|
from safe_store import TextVectorizer, VectorizationMethod, VisualizationMethod
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
from ascii_colors import ASCIIColors
|
from ascii_colors import ASCIIColors
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import importlib
|
import importlib
|
||||||
@ -38,8 +40,9 @@ class LollmsApplication:
|
|||||||
|
|
||||||
self.mounted_extensions = []
|
self.mounted_extensions = []
|
||||||
self.notification_callback = notification_callback
|
self.notification_callback = notification_callback
|
||||||
self.binding=None
|
self.binding = None
|
||||||
self.model:LLMBinding=None
|
self.model:LLMBinding = None
|
||||||
|
self.long_term_memory = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if config.auto_update:
|
if config.auto_update:
|
||||||
@ -106,6 +109,22 @@ class LollmsApplication:
|
|||||||
self.mount_personalities()
|
self.mount_personalities()
|
||||||
self.mount_extensions()
|
self.mount_extensions()
|
||||||
|
|
||||||
|
def build_long_term_skills_memory(self):
|
||||||
|
db_path:Path = self.lollms_paths.personal_databases_path/self.config.db_path.split(".")[0]
|
||||||
|
db_path.mkdir(exist_ok=True, parents=True)
|
||||||
|
self.long_term_memory = TextVectorizer(
|
||||||
|
vectorization_method=VectorizationMethod.TFIDF_VECTORIZER,
|
||||||
|
model=self.model,
|
||||||
|
database_path=db_path/"skills_memory.json",
|
||||||
|
save_db=True,
|
||||||
|
data_visualization_method=VisualizationMethod.PCA,
|
||||||
|
)
|
||||||
|
return self.long_term_memory
|
||||||
|
|
||||||
|
def learn_from_discussion(self, discussion):
|
||||||
|
learned_skill = self.model.generate(f"{discussion}\n\n!@>What should we learn from this discussion?!@>Summerizer: Here is a summary of the most important informations extracted from the discussion:\n",)
|
||||||
|
return learned_skill
|
||||||
|
|
||||||
|
|
||||||
def remove_text_from_string(self, string, text_to_find):
|
def remove_text_from_string(self, string, text_to_find):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user