def _add_skill_dialogs(
        self,
        conversation_state: ConversationState,
        conversation_id_factory: ConversationIdFactoryBase,
        skill_client: SkillHttpClient,
        skills_config: SkillsConfiguration,
        bot_id: str,
    ):
        """
        Helper method that creates and adds SkillDialog instances for the configured skills.
        """

        for skill_info in self._skills_config.SKILLS.values():
            # Create the dialog options.
            skill_dialog_options = SkillDialogOptions(
                bot_id=bot_id,
                conversation_id_factory=conversation_id_factory,
                skill_client=skill_client,
                skill_host_endpoint=skills_config.SKILL_HOST_ENDPOINT,
                conversation_state=conversation_state,
                skill=skill_info,
            )

            # Add a SkillDialog for the selected skill.
            self.add_dialog(SkillDialog(skill_dialog_options, skill_info.id))
示例#2
0
    def _add_skill_dialogs(
        self,
        conversation_state: ConversationState,
        conversation_id_factory: ConversationIdFactoryBase,
        skill_client: SkillHttpClient,
        skills_config: SkillConfiguration,
        bot_id: str,
    ):
        for _, skill_info in skills_config.SKILLS.items():
            # Create the dialog options.
            skill_dialog_options = SkillDialogOptions(
                bot_id=bot_id,
                conversation_id_factory=conversation_id_factory,
                skill_client=skill_client,
                skill_host_endpoint=skills_config.SKILL_HOST_ENDPOINT,
                conversation_state=conversation_state,
                skill=skill_info,
            )

            # Add a SkillDialog for the selected skill.
            self.add_dialog(SkillDialog(skill_dialog_options, skill_info.id))
    def create_echo_skill_dialog(
        self,
        configuration: DefaultConfig,
        conversation_state: ConversationState,
        conversation_id_factory: SkillConversationIdFactory,
        skill_client: SkillHttpClient,
    ) -> SkillDialog:
        if configuration.SKILL_HOST_ENDPOINT is None:
            raise Exception("SkillHostEndpoint is not in configuration")

        if configuration.ECHO_SKILL_INFO is None:
            raise Exception("EchoSkillInfo is not set in configuration")

        options = SkillDialogOptions(
            bot_id=configuration.APP_ID,
            conversation_id_factory=conversation_id_factory,
            skill_client=skill_client,
            skill_host_endpoint=configuration.SKILL_HOST_ENDPOINT,
            conversation_state=conversation_state,
            skill=configuration.ECHO_SKILL_INFO,
        )

        return SkillDialog(options, ECHO_SKILL)