Skip to content

Commit 7d35a08

Browse files
authored
Merge pull request #265 from FrancescoCaracciolo/master
2 parents 5874e9e + 20536de commit 7d35a08

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

src/handlers/tts/kokoro_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from os import walk
1+
import os
22
import subprocess
33
from .tts import TTSHandler
44
from ...utility.pip import install_module, find_module

src/handlers/websearch/duckduckgo_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class DDGSeachHandler(WebSearchHandler):
77

88
@staticmethod
99
def get_extra_requirements() -> list:
10-
return ["duckduckgo_search"]
10+
return ["ddgs"]
1111

1212
def get_extra_settings(self) -> list:
1313
return [

src/ui/settings.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020

2121

2222
class Settings(Adw.PreferencesWindow):
23-
def __init__(self,app, controller: NewelleController,headless=False, startup_page=None, *args, **kwargs):
23+
def __init__(self,app, controller: NewelleController,headless=False, startup_page=None, popup=False, *args, **kwargs):
2424
super().__init__(*args, **kwargs)
2525
self.app = app
2626
self.controller = controller
2727
self.settings = controller.settings
2828
self.headless = headless
29+
self.popup = popup
2930
if not headless:
3031
self.set_transient_for(app.win)
3132
self.set_modal(True)
@@ -583,7 +584,7 @@ def choose_row(self, button, constants : dict, secondary=False):
583584
else:
584585
return
585586
self.settings.set_string(setting_name, button.get_name())
586-
if constants == AVAILABLE_LLMS and self.headless:
587+
if constants == AVAILABLE_LLMS and self.popup:
587588
self.app.win.update_available_models()
588589
if constants == AVAILABLE_RAGS or constants == AVAILABLE_EMBEDDINGS:
589590
self.app.win.update_settings()
@@ -1064,4 +1065,4 @@ def delete_pip_path(self):
10641065
dialog.set_close_response("close")
10651066
dialog.set_response_appearance("close", Adw.ResponseAppearance.DESTRUCTIVE)
10661067
dialog.connect('response', lambda dialog, response_id: dialog.destroy())
1067-
dialog.present()
1068+
dialog.present()

src/utility/media.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
import mimetypes
66

77
def encode_image_base64(file_path):
8+
if file_path.startswith("http"):
9+
import requests
10+
response = requests.get(file_path)
11+
file_path = "/tmp/" + file_path.split("/")[-1]
12+
with open(file_path, "wb") as f:
13+
f.write(response.content)
14+
815
mime_types = {
916
'.jpg': 'image/jpeg',
1017
'.jpeg': 'image/jpeg',

src/window.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,8 @@ def load_handlers_async():
766766
"stop", lambda: GLib.idle_add(self.mute_tts_button.set_visible, False)
767767
)
768768
if ReloadType.LLM in reloads:
769-
self.reload_buttons()
769+
self.reload_buttons()
770+
self.update_model_popup()
770771

771772
def reload_buttons(self):
772773
"""Reload offers and buttons on LLM change"""
@@ -817,7 +818,7 @@ def build_model_popup(self):
817818
scroll = Gtk.ScrolledWindow()
818819
scroll.set_vexpand(True)
819820
scroll.set_hexpand(True)
820-
settings = Settings(self.app, self.controller, headless=True)
821+
settings = Settings(self.app, self.controller, headless=True, popup=True)
821822
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
822823
stack = Adw.ViewStack()
823824
self.model_popup_settings = settings

0 commit comments

Comments
 (0)