Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Conversation

@ceciliaavila
Copy link
Collaborator

Description

This PR fixes the issue where Composer fails to connect to multiple PVA skills due to a validation error saying "The skill is already part of the Bot Project". This validation happened because a single manifest was saved in the skills folder, and adding another PVA bot would replace it.
Therefore, changing the folder structure to where the bot's manifest is saved solved the issue.
Other issues related to PVA skills were addressed:

  • The Manifest URL didn't redirect to valid content, since the bot was loaded from a .zip file and no endpoint was available.
    • Instead of redirecting to the manifest.json file, it shows its content in a modal.
  • Switching between PVA skill pages, the information didn't get refreshed.
    • Adding the projectId to the useMemo function solved the issue.
  • When a PVA skill is added and the visual focus is on another bot that is not the root, it will throw an error as it didn't locate .lg and .lu files, failing to add the skill action trigger to the root bot.
    • Changing the current opened bot project id to use the root's id, solved the issue.

Task Item

Fixes #9528

Screenshots

The following images show the validation when adding an existing PVA skill and the folder structure, and the bots working as expected.
image
image

@coveralls
Copy link

coveralls commented Apr 3, 2023

Coverage Status

Coverage: 54.547% (-0.003%) from 54.551% when pulling 0e22f61 on southworks/fix/multiple-pva-skills into 39f01c2 on main.

// convert zip folder name to skill name
export const convertFolderNameToSkillName = (path, skillName) => {
return path.replace(/(\w+)\//, `${skillName}/`);
const hasFolder = path.match(/(\w+)\//);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this doesn't allow hyphens or dashes in folder name

};

// convert zip folder name to skill name
export const convertFolderNameToSkillName = (path, skillName) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion use path module to operate with paths. Not tested but something like this should work:

export const convertFolderNameToSkillName = (pathStr, skillName) => {
  const folderName = path.parse(pathStr).dir;
  const relativePath = path.relative(folderName, pathStr);
  
  return path.join(skillName, relativePath);
};

import { addSkillFiles, deleteSkillFiles } from './utils/skills';

const urlRegex = /^http[s]?:\/\/\w+/;
const isExternalLink = (url: string): boolean => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

const isExternalLink = (url: string): boolean => {
    const { origin } = location;
    const parsedUrl = new URL(url, origin);
    return parsedUrl.origin !== origin;
};

Note that in case the URL provided is invalid, this will throw.

My only concern is about protocols limiting to http(s).

Also noted the implementation does not support relative protocol //. Though this is not supported in the code suggested as well, and I don't think it should be. Just raising the point in case there are known use-cases.

const helpLink =
'https://docs.microsoft.com/en-us/azure/bot-service/skills-write-manifest-2-1?view=azure-bot-service-4.0';

const isExternalLink = (url: string): boolean => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: put the function to utilities and reuse here and in Composer/packages/client/src/recoilModel/dispatchers/botProjectFile.ts

@ceciliaavila
Copy link
Collaborator Author

Hi @OEvgeny, all feedback applied. Thanks!

describe('Convert zip folder name to skill name', () => {
it('should return path with skillName folder', () => {
const path = 'manifest/empty-manifest.json';
const path = 'manifest-folder/empty-manifest.json';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cwhitten cwhitten merged commit c018e9b into main Apr 27, 2023
@cwhitten cwhitten deleted the southworks/fix/multiple-pva-skills branch April 27, 2023 15:41
@cwhitten cwhitten mentioned this pull request Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to add two PVA bot skills through bot framework composer with the option connect to a skill

6 participants