Sara Rush
Sara Rush

Reputation: 11

Is there a way to manually connect a Skill to a Microsoft Virtual Assistant? Without running botskills connect

I am following along with the Microsoft Virtual Assistant documentation and have created a skill and VA in typescript that each run correctly independently. I am trying to connect the skill to the VA.

When I run botskills connect, a rabbit hole of errors arise that seem to be caused because I set up the Azure resources for the skill and VA manually instead of deploy.ps1. Due to governance and policy at my firm, I'm unable to run deploy.ps1 and instead create my Azure resources through firm ARM templates or through the Azure Portal.

To get around this, what does botskills connect do specifically? Can I execute those steps myself? I haven't been able to find documentation on how to connect a skill to a VA without running botskills connect.

Upvotes: 1

Views: 78

Answers (1)

JJ_Wailes
JJ_Wailes

Reputation: 2227

Unfortunately, without the actual errors listed, I can't help solve those, but I can direct you to the purpose of botskills connect.

Under the hood, the botskills connect runs a series of validations on your skill manifest and cognitive models. Once those are resolved, it creates a new ConnectSkills object and calls '.connectSkills' on that. 1

That function runs a couple more validations, and then runs .connectSkillsManifest 2

This new functions updates Dispatch to cover the new cognitive models in your skill, and finally, creates a 'skillmanifest' in your VA bot, and adds your new skill there: 3

private async connectSkillManifest(cognitiveModelsFile: ICognitiveModel, skillManifest: IManifest): Promise<void> {
        try {
            // Take VA Skills configurations
            const assistantSkillsFile: IAppSetting = JSON.parse(readFileSync(this.configuration.appSettingsFile, 'UTF8'));
            const assistantSkills: ISkill[] = assistantSkillsFile.botFrameworkSkills !== undefined ? assistantSkillsFile.botFrameworkSkills : [];

            // Check if the skill is already connected to the assistant
            if (assistantSkills.find((assistantSkill: ISkill): boolean => assistantSkill.id === skillManifest.id)) {
                this.logger.warning(`The skill with ID '${ skillManifest.id }' is already registered.`);
                return;
            }

            // Validate cultures
            await this.validateCultures(cognitiveModelsFile, skillManifest.luisDictionary);
            // Updating Dispatch
            this.logger.message('Updating Dispatch');
            await this.updateModel(skillManifest.luisDictionary, skillManifest.id);
            // Adding the skill manifest to the assistant skills array
            this.logger.message(`Appending '${ skillManifest.name }' manifest to your assistant's skills configuration file.`);
            // Updating the assistant skills file's skills property with the assistant skills array
            // Writing (and overriding) the assistant skills file
            //writeFileSync(this.configuration.skillsFile, JSON.stringify(assistantSkillsFile, undefined, 4));
            await this.AddSkill(assistantSkillsFile, assistantSkills, skillManifest);
            this.logger.success(`Successfully appended '${ skillManifest.name }' manifest to your assistant's skills configuration file!`);
            // Configuring bot auth settings
            //this.logger.message('Configuring bot auth settings');
            //await this.authenticationUtils.authenticate(this.configuration, skillManifest, this.logger);
        } catch (err) {
            this.logger.error(`There was an error while connecting the Skill to the Assistant:\n${ err }`);
        }
    }

My typescript skills are a bit rusty, but this is all in TS, and you might have an easier time parsing it now that you know where it's all hiding.

Upvotes: 2

Related Questions