gpt4 book ai didi

c# - Cortana RequestDisambiguationAsync 错误

转载 作者:太空宇宙 更新时间:2023-11-03 21:19:10 25 4
gpt4 key购买 nike

我正在尝试通过为我的应用程序工作的 Cortana 让用户与后台应用程序进行交互。

每当我执行 RequestDisambiguationAsync(response) 时,Cortana 都会说它遇到了错误。但是,它不会在 Visual Studio 中的任何地方中断。

关于可能导致它的原因有什么想法吗?下面是我正在使用的代码:

var userPrompt = new VoiceCommandUserMessage();
string home1 = data.Structures[0].Name;
string home2 = data.Structures[1].Name;
userPrompt.DisplayMessage = "Which one did you want to set to home?";
userPrompt.SpokenMessage = String.Format("Which one did you want to set to home? {0} or {1}?", home1, home2);

var userReprompt = new VoiceCommandUserMessage();
userReprompt.DisplayMessage = "Which one did you want to set to home?";
userReprompt.SpokenMessage = "Which one did you want to set to home?";

var structuresContentTiles = new List<VoiceCommandContentTile>();

var structureTile = new VoiceCommandContentTile();
structureTile.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;
structureTile.Title = home1;
structureTile.AppContext = data.Structures[0].Structure_id;
structuresContentTiles.Add(structureTile);

var structureTile2 = new VoiceCommandContentTile();
structureTile2.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;
structureTile2.Title = home2;
structureTile.AppContext = data.Structures[1].Structure_id;
structuresContentTiles.Add(structureTile2);

var response = VoiceCommandResponse.CreateResponseForPrompt(userPrompt, userReprompt, structuresContentTiles);

var voiceCommandDisambiguationResult = await voiceServiceConnection.RequestDisambiguationAsync(response);

最佳答案

在某些情况下,当您使用时可能会发生此行为

structureTile.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;

但不提供图像。将其更改为 VoiceCommandContentTileType.TitleOnly,或者如果您提供的是 Line1,请使用 VoiceCommandContentTileType.TitleWithText,或提供图像,这应该会阻止失败的发生。

关于c# - Cortana RequestDisambiguationAsync 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31954679/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com