Fixed model tweaks loading

This commit is contained in:
jeffser 2024-05-30 09:53:17 -06:00
parent a13ffd22f1
commit c994307954
3 changed files with 80 additions and 99 deletions

View File

@ -71,31 +71,6 @@
} }
] ]
}, },
{
"name": "ollama",
"buildsystem": "simple",
"build-commands": [
"install -Dm0755 ollama* ${FLATPAK_DEST}/bin/ollama"
],
"sources": [
{
"type": "file",
"url": "https://github.com/ollama/ollama/releases/download/v0.1.38/ollama-linux-amd64",
"sha256": "c3360812503a9756a507ebb9d78667e2b21800a760b45046bc48a8f3b81972f4",
"only-arches": [
"x86_64"
]
},
{
"type": "file",
"url": "https://github.com/ollama/ollama/releases/download/v0.1.38/ollama-linux-arm64",
"sha256": "f2d091afe665b2d5ba8b68e2473d36cdfaf80c61c7d2844a0a8f533c4e62f547",
"only-arches": [
"aarch64"
]
}
]
},
{ {
"name" : "alpaca", "name" : "alpaca",
"builddir" : true, "builddir" : true,

View File

@ -42,7 +42,7 @@ class SearchProvider:
return Gio.DBusNodeInfo.new_for_xml(xml).interfaces[0] return Gio.DBusNodeInfo.new_for_xml(xml).interfaces[0]
def handle_method_call(self, connection, sender, object_path, interface_name, method_name, parameters, invocation): def handle_method_call(self, connection, sender, object_path, interface_name, method_name, parameters, invocation):
print("ALPACA handle_method_call") print(f"ALPACA handle_method_call: {method_name}")
if method_name == "GetInitialResultSet": if method_name == "GetInitialResultSet":
self.handle_get_initial_result_set(invocation, parameters) self.handle_get_initial_result_set(invocation, parameters)
elif method_name == "GetSubsearchResultSet": elif method_name == "GetSubsearchResultSet":
@ -56,27 +56,33 @@ class SearchProvider:
print("ALPACA handle_get_initial_result_set") print("ALPACA handle_get_initial_result_set")
terms = parameters.unpack()[0] terms = parameters.unpack()[0]
print(f"Initial search terms: {terms}") print(f"Initial search terms: {terms}")
results = ["result1", "result2"] results = []
if "Alpaca" in terms:
results.append("placeholder_result")
print(f"Returning results: {results}")
invocation.return_value(GLib.Variant("(as)", [results])) invocation.return_value(GLib.Variant("(as)", [results]))
def handle_get_subsearch_result_set(self, invocation, parameters): def handle_get_subsearch_result_set(self, invocation, parameters):
print("ALPACA handle_get_subsearch_result_set") print("ALPACA handle_get_subsearch_result_set")
previous_results, terms = parameters.unpack() previous_results, terms = parameters.unpack()
print(f"Subsearch terms: {terms}, previous results: {previous_results}") print(f"Subsearch terms: {terms}, previous results: {previous_results}")
results = ["result3", "result4"] results = []
if "Alpaca" in terms:
results.append("sub_placeholder_result")
print(f"Returning subsearch results: {results}")
invocation.return_value(GLib.Variant("(as)", [results])) invocation.return_value(GLib.Variant("(as)", [results]))
def handle_get_result_metas(self, invocation, parameters): def handle_get_result_metas(self, invocation, parameters):
print("ALPACA handle_get_result_metas") print("ALPACA handle_get_result_metas")
identifiers = parameters.unpack()[0] #LINE 66 identifiers = parameters.unpack()[0]
print(f"Result metas for identifiers: {identifiers}") print(f"Result metas for identifiers: {identifiers}")
metas = [] metas = []
for identifier in identifiers: for identifier in identifiers:
meta = {"name": GLib.Variant("s", identifier)} meta = {"name": GLib.Variant("s", "Placeholder result for " + identifier)}
metas.append(GLib.Variant("a{sv}", meta)) metas.append(GLib.Variant("a{sv}", meta))
print(f"Returning metas: {metas}")
invocation.return_value(GLib.Variant("(a{sv})", [metas])) invocation.return_value(GLib.Variant("(a{sv})", [metas]))
def handle_activate_result(self, invocation, parameters): def handle_activate_result(self, invocation, parameters):
print("ALPACA handle_activate_result") print("ALPACA handle_activate_result")
identifier, terms, timestamp = parameters.unpack() identifier, terms, timestamp = parameters.unpack()

View File

@ -920,9 +920,9 @@ class AlpacaWindow(Adw.ApplicationWindow):
self.run_on_background = data['run_on_background'] self.run_on_background = data['run_on_background']
#Model Tweaks #Model Tweaks
if "model_tweaks" in data: self.model_tweaks = data['model_tweaks'] if "model_tweaks" in data: self.model_tweaks = data['model_tweaks']
self.temperature_spin.set_value(self.model_tweaks['model_tweaks']['temperature']) self.temperature_spin.set_value(self.model_tweaks['temperature'])
self.seed_spin.set_value(self.model_tweaks['model_tweaks']['seed']) self.seed_spin.set_value(self.model_tweaks['seed'])
self.keep_alive_spin.set_value(self.model_tweaks['model_tweaks']['keep_alive']) self.keep_alive_spin.set_value(self.model_tweaks['keep_alive'])
self.background_switch.set_active(self.run_on_background) self.background_switch.set_active(self.run_on_background)
self.set_hide_on_close(self.run_on_background) self.set_hide_on_close(self.run_on_background)