azure-bot-service 相关问题

标记用于与Azure Bot服务相关的问题:https://azure.microsoft.com/en-us/services/bot-service/

如何从SharePoint文档库获取图像到bot框架的消息传递扩展的缩略图卡中

我有一个包含一些图标的SharePoint文档库。我有一个Azure Web应用程序bot,用于使用bot框架进行消息传递扩展。在消息传递扩展预览缩略图卡中...

回答 1 投票 0

带电报频道按钮的缩略图卡产生InternalServerError

将缩略图卡发送到电报频道会产生以下异常。这在模拟器中工作正常。操作返回了无效的状态代码'InternalServerError'这是卡的代码:...

回答 2 投票 0


与Teams频道集成的Web App Bot(Azure)。在一对一聊天中工作正常,但在群聊中表现不佳[关闭]

我已经使用Bot框架创建了一个聊天Bot,该Bot框架处理用户发送的消息并借助luis识别意图。加入团队后,该机器人可以在一对一对话中正常工作。 ...

回答 1 投票 0

MS Teams机器人在用户时区显示时间

我正在使用他们的REST API构建Microsoft Teams机器人。机器人需要发送事件状态,例如从1:43 PM开始或在5:30 PM结束。该信息将被发送到频道,频道将...

回答 2 投票 0

[创建Web App Bot时如何选择模板?

我正在尝试使用Azure门户创建机器人,并尝试遵循文档中的一些教程。具体来说,这些是:Microsoft Docs https://docs.microsoft.com/zh-cn/azure/bot-service/abs -...

回答 1 投票 0

Microsoft bot框架v4语音服务

我已经开发了Microsoft bot框架节点js bot,并已连接到Facebook。当我尝试使用Facebook mic向Bot添加语音服务时,出现以下错误。我已经通过链接...

回答 1 投票 0

生成直线令牌的问题

[当我尝试根据Microsoft文档获得直接令牌时。 Postman中显示的错误。 {“ error”:{“ code”:“ BadArgument”,“ message”:“缺少令牌或机密”}} ...

回答 1 投票 0

Azure 机器人服务的 Directline 没有响应并被 CORS 策略阻止

我使用了 Microsoft Sample for Bot Services 中的 Bot Services 示例。 我调试后,网页没有显示任何东西。 这里有我的源代码: 我使用了 Microsoft Sample for Bot Services 中的 Bot Services 示例。 我调试后,网页没有显示任何东西。 这里有我的源代码: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Web Chat: Minimal bundle with Markdown</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat-minimal.js"></script> <style> html, body { height: 100%; } body { margin: 0; } #webchat { height: 100%; width: 100%; } </style> </head> <body> <div id="webchat" role="main"></div> <script> (async function() { const res = await fetch('https://csharpbotdw.azurewebsites.net/directline/token', { method: 'POST' }); const { token } = await res.json(); const markdownIt = window.markdownit(); window.WebChat.renderWebChat( { directLine: window.WebChat.createDirectLine({ token }) }, document.getElementById('webchat') ); document.querySelector('#webchat > *').focus(); })().catch(err => console.error(err)); </script> </body> </html> 我只看到错误提及 Access to fetch at 'https://csharpbotdw.azurewebsites.net/directline/token' from origin 'http://localhost:63191' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. [http://localhost:63191/Test13122019] 显然,您的 Azure 应用服务没有在托管代码的 Azure 应用服务的 CORS 设置中正确配置 CORS。我在这里用详细的步骤解决了类似的问题,请尝试看看它是否对您有帮助。 似乎 URL 有问题:https://csharpbotdw.azurewebsites.net/directline/token 你得到了 directLine 令牌。每次调用此 URL 时都会出现 404 错误,似乎那里没有这样的 API。 如果您尚未在代码中实现此类 API,请在您的 .net Framework 项目中尝试以下代码: using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using System.Web; using System.Web.Http; using Newtonsoft.Json; namespace CoreBot.Controllers { [Route("api/token")] public class TokenController : ApiController { public async Task<IHttpActionResult> token() { var secret = "<your bot channel directline secret>"; HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage( HttpMethod.Post, $"https://directline.botframework.com/v3/directline/tokens/generate"); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", secret); var userId = $"dl_{Guid.NewGuid()}"; request.Content = new StringContent( Newtonsoft.Json.JsonConvert.SerializeObject( new { User = new { Id = userId } }), Encoding.UTF8, "application/json"); var response = await client.SendAsync(request); string token = String.Empty; if (response.IsSuccessStatusCode) { var body = await response.Content.ReadAsStringAsync(); token = JsonConvert.DeserializeObject<DirectLineToken>(body).token; } var config = new ChatConfig() { token = token, userId = userId }; return Ok(config); } } public class DirectLineToken { public string conversationId { get; set; } public string token { get; set; } public int expires_in { get; set; } } public class ChatConfig { public string token { get; set; } public string userId { get; set; } } } 您可以在这里获取机器人频道直线秘密: 要将其集成到您的项目中,请在项目的控制器文件夹下创建一个TokenController.cs文件并将上面的代码粘贴到其中: 并且在您将项目发布到 Azure 后,您将能够通过 URL :https://csharpbotdw.azurewebsites.net/api/token 通过 post 方法获取令牌。 本地测试结果: 启用 CORS 并将代码发布到 Azure 后,您可以使用 HTML 代码连接到您的机器人: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Web Chat: Minimal bundle with Markdown</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat-minimal.js"></script> <style> html, body { height: 100%; } body { margin: 0; } #webchat { height: 100%; width: 100%; } </style> </head> <body> <div id="webchat" role="main"></div> <script> (async function() { const res = await fetch('https://csharpbotdw.azurewebsites.net/api/token', { method: 'POST' }); const { token } = await res.json(); window.WebChat.renderWebChat( { directLine: window.WebChat.createDirectLine({ token }) }, document.getElementById('webchat') ); document.querySelector('#webchat > *').focus(); })().catch(err => console.error(err)); </script> </body> </html> 您必须在运行 csharpbotdw 服务的应用程序服务的 CORS 菜单中的已批准来源列表中添加调用域。 如果 DirectLine 或 WebChat 被创建为“Bot Channel Registration”,下面的代码将起作用。 (async()=>{ const styleOptions = { bubbleBackground: 'rgba(0, 0, 255, .1)', bubbleFromUserBackground: 'rgba(0, 255, 0, .1)', rootHeight: '100%', rootWidth: '50%', botAvatarInitials: 'WC', userAvatarInitials: 'WW', }; var response = {}; const body = { "user": { "id": "George", "name": "George" }, "trustedOrigins": [ "http://localhost:5500" ] } const res = await fetch('https://directline.botframework.com/v3/directline/tokens/generate', { method: 'POST' , headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', Authorization: "Bearer <<YOUR_SECRET>>", }, body:JSON.stringify(body) }).then((response) => response.json()) .then((data) => response = data); const tokenString = response.token; console.log("Token " , tokenString ); window.WebChat.renderWebChat( { directLine: window.WebChat.createDirectLine({ token: tokenString }), username: 'George', locale: 'en-US', styleOptions }, document.getElementById('webchat') ); })();

回答 3 投票 0

Microsoft机器人框架,使用空白屏幕加载聊天机器人

我的聊天机器人正在加载空白屏幕。当我关闭聊天并再次打开它时,它可以完美加载并正常工作。我不确定这可能是什么原因。我正在使用Microsoft机器人框架...

回答 1 投票 0

ChatBot在Web模拟器中不起作用,但在Local Bot Framework模拟器中则很好]]

几周前,我感到沮丧,目前,我已经开发了与SharePoint On Premise集成的ChatBot。当我在模拟器中调试ChatBot时,它的工作正常。但是当我在Web上调试时...

回答 1 投票 1

Bot Framework提供遥测ArgumentNullException telemetryClient错误

在稳定了具有多个对话框的4.5.3机器人之后,现在我决定实现遥测。遵循文档和示例核心bot,我相信我已经掌握了所有内容,但出现此错误...

回答 1 投票 0


MS Bot Framework错误:'QnAMaker'不包含'CallTrainAsync'的定义,并且没有可访问的扩展方法'CallTrainAsync'

我正在尝试使用Microsoft Bot Framework将“主动学习”应用于我的聊天机器人,但是当我尝试从主动学习所需的QnAMaker类中调用方法时遇到一个问题:...

回答 1 投票 0

针对多个客户和多个租户的Microsoft Bot身份验证

我需要身份验证服务。我需要多个客户和租户使用相同的代码。另外,有什么方法可以在登录多个客户时在Azure中注册一个应用程序/ ...

回答 1 投票 0

无效的URI:HeroCard中的Uri字符串太长

在我从XML文档检索数据并显示在Hero Card中之后。错误显示为“ Uri字符串太长。”这里有我的错误截图和源代码。尝试{...

回答 1 投票 1

Bot在模拟器中运行完美,但在Webchat中的测试中部署后失败发送重试失败错误

我有一个根据Azure文档在Visual Studio中开发的C#回显机器人,该机器人已在桌面上的机器人模拟器上成功运行。此漫游器已部署到Azure,将无法在网络聊天中或在...

回答 2 投票 1

使用联合组织从SharePoint中获取数据

我有一个问题,我们如何才能从本地列表中的SharePoint获取数据并在Bot中实施?有样品吗?而且我正在使用C#开发ChatBot。这里带有ChatBot的错误...

回答 1 投票 0

[从本地获取SharePoint的数据

我有一个问题,我们如何才能从本地列表中的SharePoint获取数据并在Bot中实施?有样品吗?谢谢。

回答 1 投票 0

如何在不使用turncontext的情况下获取特定用户标识和连接名的令牌

我正在后台任务中做一些工作,并且有我可用的用户ID(是从activity.from.id中提取的)和连接名。如何从机器人服务获取用户令牌? -turncontext ...

回答 1 投票 -1

© www.soinside.com 2019 - 2024. All rights reserved.