mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-18 20:27:58 +00:00
Enhanced
This commit is contained in:
parent
10af0b25f2
commit
1accdb2f27
@ -1,5 +1,5 @@
|
|||||||
# =================== Lord Of Large Language Models Configuration file ===========================
|
# =================== Lord Of Large Language Models Configuration file ===========================
|
||||||
version: 27
|
version: 28
|
||||||
binding_name: null
|
binding_name: null
|
||||||
model_name: null
|
model_name: null
|
||||||
|
|
||||||
@ -43,6 +43,7 @@ db_path: database.db
|
|||||||
debug: False
|
debug: False
|
||||||
auto_update: true
|
auto_update: true
|
||||||
auto_save: true
|
auto_save: true
|
||||||
|
auto_title: false
|
||||||
# Enables gpu usage
|
# Enables gpu usage
|
||||||
enable_gpu: true
|
enable_gpu: true
|
||||||
# Automatically open the browser
|
# Automatically open the browser
|
||||||
|
@ -12,7 +12,7 @@ from lollms.config import InstallOption, TypedConfig, BaseConfig
|
|||||||
from lollms.main_config import LOLLMSConfig
|
from lollms.main_config import LOLLMSConfig
|
||||||
from lollms.paths import LollmsPaths
|
from lollms.paths import LollmsPaths
|
||||||
from lollms.binding import LLMBinding
|
from lollms.binding import LLMBinding
|
||||||
from lollms.utilities import PromptReshaper
|
from lollms.utilities import PromptReshaper, PackageManager
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
@ -1576,6 +1576,17 @@ class APScript(StateMachine):
|
|||||||
if callback:
|
if callback:
|
||||||
callback(full_text, MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_USER)
|
callback(full_text, MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_USER)
|
||||||
|
|
||||||
|
def build_python_code(self, prompt, max_title_length=4096):
|
||||||
|
if not PackageManager.check_package_installed("autopep8"):
|
||||||
|
PackageManager.install_package("autopep8")
|
||||||
|
import autopep8
|
||||||
|
global_prompt = f"{prompt}\n##>Code Builder:```python\n"
|
||||||
|
code = self.fast_gen(global_prompt,max_title_length)
|
||||||
|
code = code.rstrip("`") # Remove trailing backticks
|
||||||
|
formatted_code = autopep8.fix_code(code) # Fix indentation errors
|
||||||
|
return formatted_code
|
||||||
|
|
||||||
|
|
||||||
def make_title(self, prompt, max_title_length: int = 50):
|
def make_title(self, prompt, max_title_length: int = 50):
|
||||||
"""
|
"""
|
||||||
Generates a title for a given prompt.
|
Generates a title for a given prompt.
|
||||||
|
@ -23,7 +23,7 @@ from PIL import Image
|
|||||||
import requests
|
import requests
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import base64
|
import base64
|
||||||
|
import importlib
|
||||||
|
|
||||||
def load_image(image_file):
|
def load_image(image_file):
|
||||||
s_image_file = str(image_file)
|
s_image_file = str(image_file)
|
||||||
@ -350,6 +350,26 @@ class PackageManager:
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
subprocess.check_call([sys.executable, "-m", "pip", "install", package_name])
|
subprocess.check_call([sys.executable, "-m", "pip", "install", package_name])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check_package_installed(package_name):
|
||||||
|
try:
|
||||||
|
importlib.import_module(package_name)
|
||||||
|
return True
|
||||||
|
except ImportError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def safe_import(module_name, library_name=None):
|
||||||
|
if not PackageManager.check_package_installed(module_name):
|
||||||
|
print(f"{module_name} module not found. Installing...")
|
||||||
|
if library_name:
|
||||||
|
PackageManager.install_package(library_name)
|
||||||
|
else:
|
||||||
|
PackageManager.install_package(module_name)
|
||||||
|
globals()[module_name] = importlib.import_module(module_name)
|
||||||
|
print(f"{module_name} module imported successfully.")
|
||||||
|
|
||||||
|
|
||||||
class GitManager:
|
class GitManager:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -18,3 +18,5 @@ scikit-learn
|
|||||||
ascii_colors
|
ascii_colors
|
||||||
safe_store
|
safe_store
|
||||||
ascii_colors>=0.1.3
|
ascii_colors>=0.1.3
|
||||||
|
|
||||||
|
autopep8
|
||||||
|
@ -8,4 +8,6 @@ simple-websocket
|
|||||||
wget
|
wget
|
||||||
setuptools
|
setuptools
|
||||||
requests
|
requests
|
||||||
safe_store
|
safe_store
|
||||||
|
|
||||||
|
autopep8
|
2
setup.py
2
setup.py
@ -26,7 +26,7 @@ def get_all_files(path):
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="lollms",
|
name="lollms",
|
||||||
version="6.4.2",
|
version="6.5.0",
|
||||||
author="Saifeddine ALOUI",
|
author="Saifeddine ALOUI",
|
||||||
author_email="aloui.saifeddine@gmail.com",
|
author_email="aloui.saifeddine@gmail.com",
|
||||||
description="A python library for AI personality definition",
|
description="A python library for AI personality definition",
|
||||||
|
Loading…
Reference in New Issue
Block a user