使用DirectLine和网络聊天(Node.js)在bot-framework v4中发送打字指示器

Rob*_*bie 1 node.js botframework direct-line-botframework

Microsoft bot-framework SDK v4的官方文档未演示如何发送打字指示符(而v3具有这些说明)。我正在使用DirectLine和botframework-webchat。

我该怎么做呢?谢谢!

Mic*_*ick 6

看来v4文档和示例中缺少此功能。您可以通过发送带有该typing类型的活动来发送打字指示器。

节点: context.sendActivity({ type: 'typing'});

打字稿: context.sendActivity({ type: ActivityTypes.Typing});

showTypingMiddleware可用于自动发送输入指示器。如果您需要更多示例代码,此代码段还将显示如何发送打字指示符。


Han*_*Han 5

我相信你应该做这样的事情

await context.sendActivities([
    { type: 'typing' },
    { type: 'delay', value: 2000 },
    { type: 'message', text: 'Your message here' }
]);
Run Code Online (Sandbox Code Playgroud)