如何通过 API 访问机器人技能?

How to access Bot Skills via API?

Microsoft 是否将 Bot Skills 作为 API 发布以供使用。我需要以编程方式调用 botskills 命令,以便将其发布到我的 VA。我该怎么做?

botskills 是一个命令行工具,所以不,没有直接的 API。

也就是说,大多数编程语言都允许您执行 shell 命令。根据您的 post 历史记录,您似乎正在使用 Node。所以,你可以做一些事情 like this:

const { exec } = require("child_process");

exec("botskills connect --localManifest "./skills/customSkill/customSkillManifest.json" --skillsFile "./skills.json" --cs --verbose", (error, stdout, stderr) => {
    if (error) {
        console.log(`error: ${error.message}`);
        return;
    }
    if (stderr) {
        console.log(`stderr: ${stderr}`);
        return;
    }
    console.log(`stdout: ${stdout}`);
});

如果 botskills 托管在某个地方并且您需要使用它 就像 和 API,您可以随时向您的机器人添加端点:

server.post('/api/botskills', (req, res) => {
  // 1. Do some kind of conditional check on the request to make sure it is allowed to do this
  // 2. Execute the command in the previous code block
  // 3. Return a response
}

如果您的问题不是关于botskills package/CLI and is actually about "Bot Skills"的问题,您就可以像机器人一样与技能互动。它们基本上是相同的东西,您会使用相同的 REST API.