【问题标题】:Alexa Service Simulator Parse ErrorAlexa 服务模拟器解析错误
【发布时间】:2017-12-15 12:40:53
【问题描述】:

我正在尝试使用 VS2015 和 Alexa.Net nuget 包向 Alexa Echo Dot 添加自定义技能。 我能够将 lambda 函数上传到 Amazon Webservice。我能够看到技能。 但是,当我尝试使用服务模拟器测试 lambda 函数时,出现以下错误

“无法调用远程端点,或者它返回的响应无效。”
“第 1 行的解析错误: 远程端点 ^ 期待 'STRING', NUMBER', NULL ... "

我不确定这里真正缺少什么。这是详细信息

Lambda 请求

{
  "session": {
    "sessionId": "SessionId.23409e06-265b-4704-a288-8d5329a68a68",
    "application": {
      "applicationId": "amzn1.ask.skill.55a9cca9-02dc-4780-a55c-c1d0dee6b8c6"
    },
    "attributes": {},
    "user": {
      "userId": "amzn1.ask.account.AHPIWHCHA22Z3WAJGS2ABA3MQ3PTKB4HOMJIBBDILIBPWTSAAOELN45D4PIV3U75IOBDHNGJQ36OSUYK43VQKYSQFIM2OHHOORSDWM2HMLWKINLCLKU7R3SNONWM7YPWSMR5XGN6XKVZGBG4NFHDQXACZLVK57MXUOIYYV6RLLVACBMMSFPVDINMO3QKQUZVZMVR73KTCEYTCRY"
    },
    "new": true
  },
  "request": {
    "type": "IntentRequest",
    "requestId": "EdwRequestId.082b6e56-29d4-4eed-a353-e24890cfbefa",
    "locale": "en-US",
    "timestamp": "2017-07-11T12:19:27Z",
    "intent": {
      "name": "CountryInfoIntent",
      "slots": {
        "Country": {
          "name": "Country",
          "value": "France"
        }
      }
    }
  },
  "version": "1.0"
}

函数处理程序

public SkillResponse FunctionHandler(SkillRequest input, ILambdaContext context)
{
    var requestType = input.GetRequestType();

    if (requestType == typeof(IntentRequest))
    {
        return MakeSkillResponse(
            $"Hello Infotec! This is the first response from your Alexa skill using c sharp.",
            true);
    }
    else
    {
        return MakeSkillResponse(
            $"I don't know how to handle this intent. Please say something like Alexa, ask {INVOCATION_NAME} about Canada.",
            true);
    }
}

private SkillResponse MakeSkillResponse(string outputSpeech, bool shouldEndSession, string repromptText = "Just say, tell me about Canada to learn more. To exit, say, exit.")
{
    var response = new ResponseBody
    {
        ShouldEndSession = shouldEndSession,
        OutputSpeech = new PlainTextOutputSpeech { Text = outputSpeech }
    };

    if (repromptText != null)
    {
        response.Reprompt = new Reprompt() { OutputSpeech = new PlainTextOutputSpeech() { Text = repromptText } };
    }

    var skillResponse = new SkillResponse
    {
        Response = response,
        Version = "1.0"
    };
    return skillResponse;
}

【问题讨论】:

    标签: c# aws-lambda alexa alexa-skills-kit alexa-voice-service


    【解决方案1】:

    这是 Alexa.Net nuget 包中的一个错误。这已在最新的软件包中得到修复。

    https://github.com/timheuer/alexa-skills-dotnet/commit/5c6dc0d2c0e3e16ca055d8938b1d0f24ad9670ed

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多