Skip to content

Commit

Permalink
Merge pull request #31 from FrancescoCaracciolo/nyarch-sync-0.6.1
Browse files Browse the repository at this point in the history
Nyarch sync 0.6.1
  • Loading branch information
FrancescoCaracciolo authored Jan 16, 2025
2 parents 66a276e + 54a5a1f commit 73da546
Show file tree
Hide file tree
Showing 87 changed files with 5,157 additions and 3,782 deletions.
5 changes: 5 additions & 0 deletions data/moe.nyarchlinux.assistant.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
<url type="bugtracker">https://github.com/nyarchlinux/nyarchassistant/issues</url>
<content_rating type="oars-1.0" />
<releases>
<release version="0.6.0" date="2025-01-04">
<description>
<p>Added many new features and bug fixes</p>
</description>
</release>
<release version="0.5.0" date="2024-12-27">
<description>
<p>Added new features and bug fixes</p>
Expand Down
1 change: 0 additions & 1 deletion moe.nyarchlinux.assistant.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"modules/python3-requests.json",
"modules/python3-requests-toolbelt.json",
"modules/python3-expandvars.json",
"modules/python3-g4f.json",
"modules/python3-gpt4all.json",
"modules/python3-gtts.json",
"modules/portaudio.json",
Expand Down
15 changes: 9 additions & 6 deletions src/constants.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from .llm import BingHandler, ClaudeHandler, GPT4AllHandler, GroqHandler, NyarchApiHandler, OllamaHandler, OpenAIHandler, CustomLLMHandler, GPT3AnyHandler, GeminiHandler, MistralHandler, OpenRouterHandler
from .tts import VoiceVoxHanlder,ElevenLabs, gTTSHandler, EspeakHandler, CustomTTSHandler, VitsHandler, EdgeTTSHandler
from .stt import GroqSRHandler, OpenAISRHandler, SphinxHandler, GoogleSRHandler, WhisperHandler, WitAIHandler, VoskHandler, CustomSRHandler
from .handlers.llm import BingHandler, ClaudeHandler, GPT4AllHandler, GroqHandler, OllamaHandler, OpenAIHandler, CustomLLMHandler, GPT3AnyHandler, GeminiHandler, MistralHandler, OpenRouterHandler, NewelleAPIHandler
from .handlers.tts import ElevenLabs, gTTSHandler, EspeakHandler, CustomTTSHandler
from .handlers.stt import GroqSRHandler, OpenAISRHandler, SphinxHandler, GoogleSRHandler, WhisperHandler, WitAIHandler, VoskHandler, CustomSRHandler

from .avatar import Live2DHandler, LivePNGHandler
from .translator import CustomTranslatorHandler, GoogleTranslatorHandler, LibreTranslateHandler, LigvaTranslateHandler
from .smart_prompt import LogicalRegressionHandler, WordLlamaHandler
# Nyarch specific imports
from .handlers.tts import EdgeTTSHandler, VitsHandler, VoiceVoxHanlder
from .handlers.llm import NyarchApiHandler
from .handlers.avatar import Live2DHandler, LivePNGHandler
from .handlers.translator import CustomTranslatorHandler, GoogleTranslatorHandler, LibreTranslateHandler, LigvaTranslateHandler
from .handlers.smart_prompt import LogicalRegressionHandler, WordLlamaHandler

from .dataset import DATASET, WIKI_PROMPTS

Expand Down
2 changes: 1 addition & 1 deletion src/dataset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csv

from .extra import is_flatpak
from .utility.system import is_flatpak


def reconstruct_dataset_from_csv(filename):
Expand Down
42 changes: 25 additions & 17 deletions src/extensions.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import sys, importlib, os, json, shutil
from typing import Any

import importlib.util
import os
import json
import shutil
import sys
from gi.repository import Gtk

from .avatar import AvatarHandler
from .constants import AVAILABLE_AVATARS, AVAILABLE_SMART_PROMPTS, AVAILABLE_TRANSLATORS
from .smart_prompt import SmartPromptHandler
from .translator import TranslatorHandler

from .handler import Handler

from .llm import LLMHandler
from .stt import STTHandler
from .tts import TTSHandler

from .handlers import Handler
from .handlers.llm import LLMHandler
from .handlers.stt import STTHandler
from .handlers.tts import TTSHandler
from .handlers.avatar import AvatarHandler
from .handlers.smart_prompt import SmartPromptHandler
from .handlers.translator import TranslatorHandler

class NewelleExtension(Handler):
"""The base class for all extensions"""
Expand Down Expand Up @@ -256,7 +254,7 @@ def load_extensions(self):

sys.path.remove(self.project_dir)

def add_handlers(self, AVAILABLE_LLMS, AVAILABLE_TTS, AVAILABLE_STT):
def add_handlers(self, AVAILABLE_LLMS, AVAILABLE_TTS, AVAILABLE_STT, AVAILABLE_AVATARS, AVAILABLE_TRANSLATORS, AVAILABLE_SMART_PROMPTS):
"""Add the handlers of each extension to the available handlers
Args:
Expand Down Expand Up @@ -303,7 +301,7 @@ def add_prompts(self, PROMPTS, AVAILABLE_PROMPTS):
AVAILABLE_PROMPTS.append(prompt)
PROMPTS[prompt["key"]] = prompt["text"]

def remove_handlers(self, extension, AVAILABLE_LLMS, AVAILABLE_TTS, AVAILABLE_STT):
def remove_handlers(self, extension, AVAILABLE_LLMS, AVAILABLE_TTS, AVAILABLE_STT, AVAILABLE_AVATARS, AVAILABLE_TRANSLATORS, AVAILABLE_SMART_PROMPTS):
"""Remove handlers of an extension
Args:
Expand All @@ -320,6 +318,15 @@ def remove_handlers(self, extension, AVAILABLE_LLMS, AVAILABLE_TTS, AVAILABLE_ST
handlers = extension.get_stt_handlers()
for handler in handlers:
AVAILABLE_STT.pop(handler["key"])
handler = extension.get_translators_handlers()
for h in handler:
AVAILABLE_TRANSLATORS.pop(h["key"])
handler = extension.get_smart_prompts_handlers()
for h in handler:
AVAILABLE_SMART_PROMPTS.pop(h["key"])
handler = extension.get_avatar_handlers()
for h in handler:
AVAILABLE_AVATARS.pop(h["key"])

def remove_prompts(self, extension, PROMPTS, AVAILABLE_PROMPTS):
"""Remove prompts of an extension
Expand Down Expand Up @@ -400,7 +407,8 @@ def disable(self, extension : NewelleExtension | str):

def save_settings(self):
"""Save the extensions settings"""

if self.settings is None:
return
self.settings.set_string("extensions-settings", json.dumps(self.extensions_settings))

def check_validity(self, extension : NewelleExtension):
Expand Down
Loading

0 comments on commit 73da546

Please sign in to comment.