Skip to content

Commit

Permalink
fromage image skill fixed (#603)
Browse files Browse the repository at this point in the history
* fromage image skill fixed

* codestyle fixed for pr
  • Loading branch information
moon-strider committed Dec 14, 2023
1 parent 442bb26 commit b6f6726
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
42 changes: 21 additions & 21 deletions 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"))
4 changes: 2 additions & 2 deletions skills/dff_fromage_image_skill/scenario/response.py
Expand Up @@ -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."

0 comments on commit b6f6726

Please sign in to comment.