Compare commits

...

2 Commits

Author SHA1 Message Date
cd2c71751a
fix: remove usless stuff
Some checks failed
Build / Flatpak (x86_64) (push) Failing after 37s
2023-09-23 08:02:55 +02:00
d869e11eb6
fix: hugginface 2023-09-23 08:01:21 +02:00
3 changed files with 4 additions and 15 deletions

View File

@ -137,8 +137,6 @@ class BavarderApplication(Adw.Application):
def save(self):
with open(self.data_path, "w", encoding="utf-8") as f:
for name, d in self.data["providers"].items():
print(d)
self.data = json.dump(self.data, f)
self.settings.set_boolean("local-mode", self.local_mode)
self.settings.set_string("current-provider", self.current_provider)
@ -254,7 +252,6 @@ class BavarderApplication(Adw.Application):
def on_ask(self, widget, _):
try:
print("ASK-APP")
self.win.on_ask()
except AttributeError:
pass
@ -342,10 +339,6 @@ class BavarderApplication(Adw.Application):
self.data["chats"] = []
self.win.load_threads()
def load_bot_and_user_name(self):
print(self.bot_name)
print(self.user_name)
def main(version):
"""The application's entry point."""
app = BavarderApplication()

View File

@ -37,9 +37,7 @@ class AIHordeProvider(BaseProvider):
if r.status_code == 202:
rid = r.json()["id"]
else:
print(r.json())
print(r.status_code)
return _("I'm sorry, I don't know what to say!")
return _(f"I'm sorry, I don't know what to say! ({r.status_code}, {r.json()['message']})")
# do the request every seconds and check if it's finished
@ -56,7 +54,6 @@ class AIHordeProvider(BaseProvider):
rj = r.json()
if r.status_code == 200:
print(rj)
if rj["done"]:
return r.json()["generations"][0]["text"]
return None
@ -75,7 +72,6 @@ class AIHordeProvider(BaseProvider):
r = requests.get("https://stablehorde.net/api/v2/status/models?type=text")
if r.status_code != 200:
print(r.json())
return self.rows
else:
rj = r.json()

View File

@ -32,8 +32,9 @@ class BaseHFChatProvider(BaseProvider):
},
})
else:
prompt = self.make_prompt(prompt, chat)
output = query({
"inputs": self.make_prompt(prompt, chat),
"inputs": prompt,
})
if 'generated_text' in output:
@ -46,8 +47,7 @@ class BaseHFChatProvider(BaseProvider):
if 'generated_text' in output[0]:
return output[0]['generated_text']
else:
print(output)
return _("Sorry, I don't know what to say!")
return _("Sorry, I don't know what to say! (Error: {output})")
def get_settings_rows(self):
self.rows = []