From b6f67268567c84b4b9e6ba3bdd7cd9632bd85166 Mon Sep 17 00:00:00 2001 From: Ilia Dikanskiy <92857699+moon-strider@users.noreply.github.com> Date: Thu, 14 Dec 2023 17:22:46 +0300 Subject: [PATCH] fromage image skill fixed (#603) * fromage image skill fixed * codestyle fixed for pr --- .../dff_fromage_image_skill/scenario/main.py | 42 +++++++++---------- .../scenario/response.py | 4 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/skills/dff_fromage_image_skill/scenario/main.py b/skills/dff_fromage_image_skill/scenario/main.py index 371b758243..39909636d1 100644 --- a/skills/dff_fromage_image_skill/scenario/main.py +++ b/skills/dff_fromage_image_skill/scenario/main.py @@ -1,40 +1,40 @@ import logging -from df_engine.core.keywords import ( - TRANSITIONS, - RESPONSE, -) +from df_engine.core.keywords import TRANSITIONS, RESPONSE, PROCESSING, GLOBAL, LOCAL from df_engine.core import Actor + +import common.dff.integration.processing as int_prs + from . import condition as loc_cnd from . import response as loc_rsp logger = logging.getLogger(__name__) flows = { - "global_flow": { - "start": { - RESPONSE: "", - TRANSITIONS: { - ("fromage_caption_response", "general_node"): loc_cnd.caption_condition, + GLOBAL: { + TRANSITIONS: {("response", "caption"): loc_cnd.caption_condition}, + }, + "response": { + LOCAL: { + PROCESSING: { + "set_confidence": int_prs.set_confidence(1.0), + "set_can_continue": int_prs.set_can_continue(), }, }, - "fallback": { - RESPONSE: "", + "caption": { + RESPONSE: loc_rsp.generic_response, + PROCESSING: {}, TRANSITIONS: {}, }, }, - "fromage_caption_response": { - "general_node": { - RESPONSE: loc_rsp.generic_response, + "global_flow": { + "start": { + TRANSITIONS: {}, + }, + "fallback": { TRANSITIONS: {}, }, }, } -actor = Actor( - flows, - start_label=("global_flow", "start"), - fallback_label=("global_flow", "fallback"), -) - -logger.info("Actor created successfully") +actor = Actor(flows, start_label=("global_flow", "start"), fallback_label=("global_flow", "fallback")) diff --git a/skills/dff_fromage_image_skill/scenario/response.py b/skills/dff_fromage_image_skill/scenario/response.py index 14bb7b16f7..494d185716 100644 --- a/skills/dff_fromage_image_skill/scenario/response.py +++ b/skills/dff_fromage_image_skill/scenario/response.py @@ -10,5 +10,5 @@ def generic_response(ctx: Context, actor: Actor, excluded_skills=None, *args, **kwargs) -> str: caption = int_ctx.get_last_human_utterance(ctx, actor).get("annotations", {}).get("fromage", None) if caption: - int_ctx.set_confidence(ctx, actor, SUPER_CONFIDENCE) - return caption + return caption + return "An error occured while trying to read image caption annotation from service payload."