Giter Club home page Giter Club logo

Comments (5)

cgreening avatar cgreening commented on August 13, 2024 1

Hi Xu,

I need to plug mine back together - it got taken apart for a new project and I need to re-assemble it.

I'll have a look this weekend as it sounds like a simple fix.

Best
Chris

from diy-alexa.

yanxuceo avatar yanxuceo commented on August 13, 2024

I see, it's because now(with an update in October 2021) the /speech endpoint returns partial transcripts, which is mentioned in this issue:
wit-ai/wit#2206

from diy-alexa.

cgreening avatar cgreening commented on August 13, 2024

That's annoying. I guess we can apply the fix mentioned in that issue. I wonder why they changed it?

from diy-alexa.

yanxuceo avatar yanxuceo commented on August 13, 2024

Hi Chris,

thanks for the quick reply. I am new to the web stuff, but I will try to fix it. But do you have some idea, why this update has no effect on your wit.ai app(everything works well with your acess_key)? Does this API update only apply to newly created app?

Or actually your code already handles it correctly, I might make something wrong with my configuration...

I really appreciate your help.

Best regards,
Xu

from diy-alexa.

yanxuceo avatar yanxuceo commented on August 13, 2024

Hi Chris, I just learned and fixed something. This is what I get on Terminal when I run:

$ curl -XPOST 'https://api.wit.ai/speech?v=20211231' -i -L -H "Authorization: Bearer my_access_key" -H "Content-Type: audio/wav" --data-binary "@apple.wav"

JSON return:
HTTP/1.1 100 Continue
Date: Sat, 01 Jan 2022 12:29:54 GMT

HTTP/1.1 200 OK
Content-Type: application/json
Date: Sat, 01 Jan 2022 12:29:54 GMT
Transfer-Encoding: chunked
Connection: keep-alive

{
"text": "Hey"
}
{
"text": "Hey Facebook"
}
{
"text": "This is Apple."
}
{
"entities": {
"fruit_type:fruit_type": [
{
//ignored
}
]
},
"intents": [
{
//ignored
}
],
"text": "This is Apple.",
"traits": {}

For this chunked return, there is no "Content-Length" in the header part. Then in the code, I added these lines in if(status == 200), which I learned from Arduino community:

    String chunk = "";
    int limit = 1;
    String response="";

    Serial.println(response);
    do {
         if (m_wifi_client->connected()) {
            m_wifi_client->setTimeout(4000);
            chunk = m_wifi_client->readStringUntil('\n');
            response += chunk;
            Serial.println(chunk);
        }
    } while (chunk.length() > 0 && ++limit < 1000);

Then, I see exact the same JSON return as it is with above curl command. So happy to see this work! I will continue to work on the deserializeJson() part. Looking forward to your fix. Thank you.

Best regards,
Xu

from diy-alexa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.