Skip to content

Commit

Permalink
refactor/adjust scores (#21)
Browse files Browse the repository at this point in the history
* refactor/performance

reuse solver object, avoid reinit of translate plugin

switch to spoken answers api, more natural and faster

skip translation if request lang is english

session support

* adjust scores
  • Loading branch information
JarbasAl authored Jan 13, 2024
1 parent 8dbe967 commit ea7995d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from ovos_utils.gui import can_use_gui
from ovos_utils.process_utils import RuntimeRequirements
from ovos_workshop.decorators import intent_handler
from ovos_workshop.intents import IntentBuilder
from ovos_workshop.skills.common_query_skill import CommonQuerySkill, CQSMatchLevel


Expand Down Expand Up @@ -257,11 +256,11 @@ def CQS_match_query_phrase(self, phrase: str):
"image": None,
"spoken_answer": None}

response = self.ask_the_wolf(phrase)
response = self.ask_the_wolf(phrase, sess.lang)
if response:
self.session_results[sess.session_id]["spoken_answer"] = response
self.log.debug(f"WolframAlpha response: {response}")
return (phrase, CQSMatchLevel.GENERAL, response,
return (phrase, CQSMatchLevel.EXACT, response,
{'query': phrase, 'answer': response})

def CQS_action(self, phrase: str, data: dict):
Expand Down Expand Up @@ -289,7 +288,7 @@ def display_wolfie(self):
# only after skill was selected for speed
sess = SessionManager.get()
res = self.session_results.get(sess.session_id)
if not res or not res["spoken_answer"]:
if not res or not res["spoken_response"]:
return

image = res.get("image") or self.wolfie.visual_answer(res["phrase"],
Expand Down

0 comments on commit ea7995d

Please sign in to comment.