mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-19 20:57:58 +00:00
added creation and update date to personalities
This commit is contained in:
parent
9aaa79e4a1
commit
2dce9311fa
@ -654,16 +654,6 @@ class LollmsApplication(LoLLMsCom):
|
|||||||
return model
|
return model
|
||||||
|
|
||||||
|
|
||||||
def mount_extension(self, id:int, callback=None):
|
|
||||||
try:
|
|
||||||
extension = ExtensionBuilder().build_extension(self.config["extensions"][id], self.lollms_paths, self)
|
|
||||||
self.mounted_extensions.append(extension)
|
|
||||||
return extension
|
|
||||||
except Exception as ex:
|
|
||||||
ASCIIColors.error(f"Couldn't load extension. Please verify your configuration file at {self.lollms_paths.personal_configuration_path} or use the next menu to select a valid personality")
|
|
||||||
trace_exception(ex)
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def mount_personality(self, id:int, callback=None):
|
def mount_personality(self, id:int, callback=None):
|
||||||
try:
|
try:
|
||||||
|
@ -468,16 +468,14 @@ class RTCom:
|
|||||||
voices = self.lc.tts.get_voices() # Assuming the response is in JSON format
|
voices = self.lc.tts.get_voices() # Assuming the response is in JSON format
|
||||||
return voices
|
return voices
|
||||||
return []
|
return []
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import os
|
|
||||||
import sounddevice as sd
|
import sounddevice as sd
|
||||||
import threading
|
import threading
|
||||||
import datetime
|
import datetime
|
||||||
import wave
|
import wave
|
||||||
|
|
||||||
class AudioNinja:
|
class AudioNinja:
|
||||||
def __init__(self, lc:LollmsApplication, logs_folder='logs', device=None):
|
def __init__(self, lc, logs_folder='logs', device=None):
|
||||||
"""
|
"""
|
||||||
Initialize the AudioNinja with a LollmsApplication object,
|
Initialize the AudioNinja with a LollmsApplication object,
|
||||||
a log folder, and an optional recording device.
|
a log folder, and an optional recording device.
|
||||||
@ -493,8 +491,11 @@ class AudioNinja:
|
|||||||
self.recording_thread = None
|
self.recording_thread = None
|
||||||
self.is_recording = False
|
self.is_recording = False
|
||||||
self.frames = []
|
self.frames = []
|
||||||
if not self.logs_folder.exists():
|
self.sample_rate = 44100 # Default sample rate
|
||||||
self.logs_folder.mkdir(parents=True, exist_ok=True)
|
self.channels = 1 # Default to mono recording
|
||||||
|
|
||||||
|
# Ensure the logs folder exists
|
||||||
|
self.logs_folder.mkdir(parents=True, exist_ok=True)
|
||||||
self.lc.info(f"AudioNinja is ready to strike from the shadows! Logging to '{self.logs_folder}' with device '{self.device}'")
|
self.lc.info(f"AudioNinja is ready to strike from the shadows! Logging to '{self.logs_folder}' with device '{self.device}'")
|
||||||
|
|
||||||
def _record_audio(self):
|
def _record_audio(self):
|
||||||
@ -505,7 +506,7 @@ class AudioNinja:
|
|||||||
if self.is_recording:
|
if self.is_recording:
|
||||||
self.frames.append(indata.copy())
|
self.frames.append(indata.copy())
|
||||||
|
|
||||||
with sd.InputStream(callback=callback, device=self.device):
|
with sd.InputStream(callback=callback, device=self.device, channels=self.channels, samplerate=self.sample_rate):
|
||||||
while self.is_recording:
|
while self.is_recording:
|
||||||
sd.sleep(1000)
|
sd.sleep(1000)
|
||||||
|
|
||||||
@ -538,9 +539,9 @@ class AudioNinja:
|
|||||||
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
filename = self.logs_folder / f"recording_{timestamp}.wav"
|
filename = self.logs_folder / f"recording_{timestamp}.wav"
|
||||||
with wave.open(filename, 'wb') as wf:
|
with wave.open(filename, 'wb') as wf:
|
||||||
wf.setnchannels(1)
|
wf.setnchannels(self.channels)
|
||||||
wf.setsampwidth(sd.default.dtype[0].itemsize)
|
wf.setsampwidth(sd.default.dtype[0].itemsize)
|
||||||
wf.setframerate(44100)
|
wf.setframerate(self.sample_rate)
|
||||||
wf.writeframes(b''.join(self.frames))
|
wf.writeframes(b''.join(self.frames))
|
||||||
self.lc.info(f"Ninja stored the audio file at '{filename}'! 🥷📂")
|
self.lc.info(f"Ninja stored the audio file at '{filename}'! 🥷📂")
|
||||||
return filename
|
return filename
|
||||||
|
@ -93,9 +93,10 @@ def get_all_personalities():
|
|||||||
personality_info['name'] = config_data.get('name',"No Name")
|
personality_info['name'] = config_data.get('name',"No Name")
|
||||||
personality_info['description'] = config_data.get('personality_description',"")
|
personality_info['description'] = config_data.get('personality_description',"")
|
||||||
personality_info['disclaimer'] = config_data.get('disclaimer',"")
|
personality_info['disclaimer'] = config_data.get('disclaimer',"")
|
||||||
|
|
||||||
personality_info['author'] = config_data.get('author', 'ParisNeo')
|
personality_info['author'] = config_data.get('author', 'ParisNeo')
|
||||||
personality_info['version'] = config_data.get('version', '1.0.0')
|
personality_info['version'] = config_data.get('version', '1.0.0')
|
||||||
|
personality_info['creation_date'] = config_data.get("creation_date",None)
|
||||||
|
personality_info['last_update_date'] = config_data.get("last_update_date",None)
|
||||||
personality_info['installed'] = (lollmsElfServer.lollms_paths.personal_configuration_path/f"personality_{personality_folder.stem}.yaml").exists() or personality_info['has_scripts']
|
personality_info['installed'] = (lollmsElfServer.lollms_paths.personal_configuration_path/f"personality_{personality_folder.stem}.yaml").exists() or personality_info['has_scripts']
|
||||||
personality_info['help'] = config_data.get('help', '')
|
personality_info['help'] = config_data.get('help', '')
|
||||||
personality_info['commands'] = config_data.get('commands', '')
|
personality_info['commands'] = config_data.get('commands', '')
|
||||||
|
Loading…
Reference in New Issue
Block a user