def action():
    choice1 = CustomerSatisfactionChoice(
        kind="positive",
        target=StepTarget(step_id="a1" * 12, name="a step"),
        matching_intent_id="b1" * 12,
        label="yes",
    )
    choice1.matching_intent = MatchIntentConditionIntent(id="b1" * 12,
                                                         name="an intent")

    choice2 = CustomerSatisfactionChoice(
        kind="neutral",
        target=StepTarget(step_id="a2" * 12, name="a neutral step"),
        matching_intent_id="c2" * 12,
        label="neutral",
    )
    choice2.matching_intent = MatchIntentConditionIntent(id="c2" * 12,
                                                         name="neutral")

    choice3 = CustomerSatisfactionChoice(
        kind="negative",
        target=StepTarget(step_id="a2" * 12, name="a step"),
        matching_intent_id="b2" * 12,
        label="no",
    )
    choice3.matching_intent = MatchIntentConditionIntent(id="b2" * 12,
                                                         name="another intent")

    return CustomerSatisfactionAction(message="Are you satisfied ?",
                                      choices=[choice1, choice2, choice3])
def action():
    story_connection = FlowConnection(
        predicates=[
            ConnectionPredicate(condition=IsNotSetCondition(),
                                value_getter=MessageGetter())
        ],
        target=StoryTarget(story_id="a2" * 12, name="a story"),
    )
    step_target = StepTarget(step_id="a1" * 12, name="a step")
    return JumpToAction(default_target=step_target,
                        connections=[story_connection])
def action():
    target = StepTarget(step_id="a1" * 12, name="a step")
    return GoToAction(target=target, session_values={"aa": 1, "bb": 2})
示例#4
0
def connection():
    predicate = ConnectionPredicate(condition=IsSetCondition(),
                                    value_getter=MessageGetter())
    predicateTeam = ConnectionTeamPredicate(condition=IsOfflineCondition())
    return FlowConnection(predicates=[predicate, predicateTeam],
                          target=StepTarget(step_id="a1" * 12, name="a step"))
def action():
    target = StepTarget(step_id="a1" * 12, name="a step")
    go_to = GoToAction(target=target)
    return AskLocationAction(message="Where are you?", callback_action=go_to)
def callback():
    return CustomerSatisfactionCallbackAction(
        kind="positive", target=StepTarget(step_id="a1" * 12, name="a step")
    )
def target():
    return StepTarget(name="a step", step_id="a1" * 12)