如何修复节点红色中的“文本语音错误:响应状态-“ statusCode”:401“错误?

时间:2019-06-25 08:20:28

标签: telegram-bot speech-to-text node-red azure-cognitive-services

我正在尝试将电报中的音频消息与节点红色的Microsoft Azure认知服务(语音到文本)连接起来。当我感到困惑时,我需要将我的输入放入缓冲区以将其发送到STT节点。但是每次都会发生错误。

我尝试从电报中提取音频消息的file_id,URL和提取file_path并将其发送到STT节点,但无法避免此错误。

这是我要获取音频的节点:

[
{
    "id": "54b25485.a6858c",
    "type": "function",
    "z": "ae6b7b40.667bc8",
    "name": "Extract file_id",
    "func": "msg.file_id = msg.payload.content;\nmsg.token = \"Mytoken\";\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 220,
    "y": 336,
    "wires": [
        [
            "3e8f9e95.d449a2"
        ]
    ]
},
{
    "id": "3e8f9e95.d449a2",
    "type": "http request",
    "z": "ae6b7b40.667bc8",
    "name": "getUrl",
    "method": "GET",
    "ret": "obj",
    "url": "https://api.telegram.org/bot{{{token}}}/getFile?file_id={{{file_id}}}",
    "tls": "",
    "x": 390,
    "y": 376,
    "wires": [
        [
            "41502461.315fac"
        ]
    ]
},
{
    "id": "41502461.315fac",
    "type": "function",
    "z": "ae6b7b40.667bc8",
    "name": "Extract file_path",
    "func": "msg.payload = \"https://api.telegram.org/file/bot\" + msg.token + \"/\" + msg.payload.result.file_path;\nvar buf1 = new Buffer(msg.payload, 'hex');\nmsg.payload = buf1;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 563,
    "y": 411,
    "wires": [
        [
            "f6118500.b165c8"
        ]
    ]
}

]

STT节点错误:

Error with speech to text : response status - {"statusCode":401,"body":"","headers":{"x-frame-options":"DENY","x-xss-protection":"1; mode=block","x-content-type-options":"nosniff","referrer-policy":"strict-origin-when-cross-origin","content-security-policy":"object-src 'none'; form-action 'self'; frame-ancestors 'none'","x-msedge-ref":"Ref A: 4BCEE776864B476B9452A20DBBB93064 Ref B: LON04EDGE0419 Ref C: 2019-06-25T07:56:54Z","date":"Tue, 25 Jun 2019 07:56:53 GMT","connection":"close","content-length":"0"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"speech.platform.bing.com","port":443,"hostname":"speech.platform.bing.com","hash":null,"search":"?version=3.0&format=json&scenarios=ulm&locale=ru-RU&device.os=Windows%20OS&appid=D4D52672-91D7-4C74-8AD8-42B1D98141A5&requestid=579c3d13-4a74-46eb-9366-7cd5dfe8590a&instanceid=6835be6d-c09e-4728-8a29-bca894fa05fa","query":"version=3.0&format=json&scenarios=ulm&locale=ru-RU&device.os=Windows%20OS&appid=D4D52672-91D7-4C7...

我希望STT节点能够正常工作并接受音频输入。

0 个答案:

没有答案