我有这个代码:
if (activity.Type == ActivityTypes.Message)
{
var audioAttachment = activity.Attachments?.FirstOrDefault(a => a.ContentType.Equals("audio/wav") || a.ContentType.Equals("application/octet-stream"));
if (audioAttachment != null)
{
var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
var stream = await GetAudioStream(connector, audioAttachment);
var text = await this.speechService.GetTextFromAudioAsync(stream);
Activity reply = activity.CreateReply(text);
await connector.Conversations.ReplyToActivityAsync(reply);
}
else
{
await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
}
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
当我输入某些内容时,它会检查是音频文件还是文本,如果是音频,它会发送到 Bing Speech 以便从音频文件中获取文本。
我在 Bot Framework 模拟器上对其进行了测试并且正在工作,但是当我尝试从网络聊天中上传文件时,它说无法发送我也收到此错误 - 将此消息发送到您的机器人时出错:HTTP 状态代码 GatewayTimeout
我想在 Skype 上部署这个机器人并上传音频文件或使用 microfon 并从中获取文本。