timstableford / P-BrainAndroid

P-Brain Android Client
MIT License
8 stars 10 forks source link

Training hotword throws error #8

Closed patrickjquinn closed 7 years ago

patrickjquinn commented 7 years ago

When in the training screen, upon pressing the train button the network request (whilst uploading the samples) fails.

The error is {"name":["This field may not be blank."]} and it seems to be stemming from obj.put("name", name); with name being null, in TrainActivity.java

I've tried hardcoding name to be an arbitrary static value to no effect, is it being passed into the query when it needs to be in the headers or vice versa?

timstableford commented 7 years ago

This works on Android 6.0 and 4.4. Does the first message on the training screen say your assistants name or does it say 'null'?

patrickjquinn commented 7 years ago

While holding the microphone say " so yep looks like its null!

timstableford commented 7 years ago

This definitely isn't a null name issue. It seems to be that the name is a 0 length string. Is your server sending a name through the set_name socket command?

timstableford commented 7 years ago

(or is the name right in config/name.json)

patrickjquinn commented 7 years ago

AH! Name is name:"" in the name.json file. My bad!

timstableford commented 7 years ago

Hmm, we should probably add server side checks for that and possibly client side too.

patrickjquinn commented 7 years ago

Yep if the value is empty then prompt the client to enter a name value perhaps?

timstableford commented 7 years ago

Theoretically it should never be empty in the first place. There's a default of 'Brain' after all. If it was set to a zero length string then something went wrong parsing the query. I suspect it picked up a "your name is" with no name. So I'm not going to go that far with client side fixes, I'll just present a warning if it's detected.