From ea7995d3460119f37cd64f4b699f95df2af7ca4e Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sat, 13 Jan 2024 05:39:00 +0000 Subject: [PATCH] refactor/adjust scores (#21) * 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 --- __init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index 959c0a9..3ff3cf4 100644 --- a/__init__.py +++ b/__init__.py @@ -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 @@ -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): @@ -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"],