Quick fix for 0.2.1

This commit is contained in:
jeffser 2024-05-13 13:53:58 -06:00
parent 5866c5d4fc
commit c7303cd278
5 changed files with 20 additions and 10 deletions

View File

@ -65,7 +65,7 @@
{
"type" : "git",
"url" : "https://github.com/Jeffser/Alpaca.git",
"tag": "0.2.0"
"tag": "0.2.1"
}
]
}

View File

@ -51,6 +51,16 @@
<url type="homepage">https://github.com/Jeffser/Alpaca</url>
<url type="donation">https://github.com/sponsors/Jeffser</url>
<releases>
<release version="0.2.1" date="2024-05-14">
<url type="details">https://github.com/Jeffser/Alpaca/releases/tag/0.2.1</url>
<description>
<p>0.2.1 Data saving fix</p>
<p>The app didn't save the config files and chat history to the right directory, this is now fixed</p>
<p>
Please report any errors to the issues page, thank you.
</p>
</description>
</release>
<release version="0.2.0" date="2024-05-14">
<url type="details">https://github.com/Jeffser/Alpaca/releases/tag/0.2.0</url>
<description>

View File

@ -1,5 +1,5 @@
project('Alpaca',
version: '0.2.0',
version: '0.2.1',
meson_version: '>= 0.62.0',
default_options: [ 'warning_level=2', 'werror=false', ],
)

View File

@ -48,7 +48,7 @@ class AlpacaApplication(Adw.Application):
application_name='Alpaca',
application_icon='com.jeffser.Alpaca',
developer_name='Jeffry Samuel Eduarte Rojas',
version='0.2.0',
version='0.2.1',
developers=['Jeffser https://jeffser.com'],
designers=['Jeffser https://jeffser.com'],
copyright='© 2024 Jeffser',

View File

@ -27,8 +27,8 @@ from .available_models import available_models
@Gtk.Template(resource_path='/com/jeffser/Alpaca/window.ui')
class AlpacaWindow(Adw.ApplicationWindow):
config_dir = os.path.join(os.getenv("XDG_CONFIG_HOME"), "/", os.path.expanduser("~/.var/app/com.jeffser.Alpaca/config"))
__gtype_name__ = 'AlpacaWindow'
#Variables
ollama_url = None
local_models = []
@ -106,7 +106,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
response = simple_get(self.ollama_url)
if response['status'] == 'ok':
if "Ollama is running" in response['text']:
with open("server.conf", "w+") as f: f.write(self.ollama_url)
with open(os.path.join(self.config_dir, "server.conf"), "w+") as f: f.write(self.ollama_url)
self.message_entry.grab_focus_without_selecting()
self.update_list_local_models()
return True
@ -320,14 +320,14 @@ class AlpacaWindow(Adw.ApplicationWindow):
)
def save_history(self):
with open("chats.json", "w+") as f:
with open(os.path.join(self.config_dir, "chats.json"), "w+") as f:
json.dump(self.chats, f, indent=4)
def load_history(self):
if os.path.exists("chats.json"):
if os.path.exists(os.path.join(self.config_dir, "chats.json")):
self.clear_conversation()
try:
with open("chats.json", "r") as f:
with open(os.path.join(self.config_dir, "chats.json"), "r") as f:
self.chats = json.load(f)
except Exception as e:
self.chats = {"chats": {"0": {"messages": []}}}
@ -350,8 +350,8 @@ class AlpacaWindow(Adw.ApplicationWindow):
self.connection_url_entry.connect("changed", lambda entry: entry.set_css_classes([]))
self.connection_dialog.connect("close-attempt", lambda dialog: self.destroy())
self.load_history()
if os.path.exists("server.conf"):
with open("server.conf", "r") as f:
if os.path.exists(os.path.join(self.config_dir, "server.conf")):
with open(os.path.join(self.config_dir, "server.conf"), "r") as f:
self.ollama_url = f.read()
if self.verify_connection() is False: self.show_connection_dialog()
else: self.connection_dialog.present(self)