fix: stop thread
Build / Flatpak (x86_64) (push) Failing after 49m32s Details

This commit is contained in:
0xMRTT 2023-08-20 12:00:57 +02:00
parent b769d3e910
commit 2410fd3fd4
3 changed files with 8 additions and 4 deletions

View File

@ -234,7 +234,11 @@ class BavarderApplication(Adw.Application):
if not self.setup_chat(): # NO MODELS:
return _("Please download a model from Preferences by clicking on the Dot Menu at the top!")
else:
with self.model.chat_session():
for p in ["Hi", "Hello"]:
if p.lower() in prompt.lower():
return _("Hello, I am Bavarder, a Chit-Chat AI")
system_template = """A chat between a curious user and an artificial intelligence assistant."""
with self.model.chat_session(system_template):
self.model.current_chat_session = chat["content"].copy()
response = self.model.generate(prompt=prompt, top_k=1)
else:

View File

@ -25,7 +25,7 @@ class KillableThread(threading.Thread):
def localtrace(self, frame, event, arg):
if self.killed:
if event == 'line':
raise SystemExit()
raise Exception("Killed")
return self.localtrace
def kill(self):

View File

@ -374,8 +374,8 @@ class BavarderWindow(Adw.ApplicationWindow):
del self.t
self.toast.dismiss()
except AttributeError: # nothing to stop
print("Nothing to stop")
except SystemExit:
pass
except Exception:
self.t.join()
del self.t
self.toast.dismiss()