Open gunnarvingren opened 7 years ago
pi@raspberrypi:~ $ cd P-Brain.ai-RasPi/ pi@raspberrypi:~/P-Brain.ai-RasPi $ yarn start yarn start v0.21.3 $ node client.js P-Brain Says: Say 'Hey Brain','Brain' or 'Okay Brain' followed by your command! P-Brain Says: You can also type your command into the terminal! What time is it? SyntaxError: Unexpected token U in JSON at position 0 at Object.parse (native) at Object.get_response [as get] (/home/pi/P-Brain.ai-RasPi/api/index.js:8:17) at next (native) at onFulfilled (/home/pi/P-Brain.ai-RasPi/node_modules/co/index.js:65:19) at process._tickCallback (internal/process/next_tick.js:109:7) (node:1411) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token U in JSON at position 0
Getting exactly the same issues running it on MacOS :( I wonder if the client is out of sync with the server branch?
To add further detail to this, the server is working perfectly and I can send requests directly vi web browser, for example http://localhost:4567/api/ask?q=what%20is%20the%20weather and it will return the JSON as expected.
However the client is producing exactly the same error message as above when using it to query via voice, here is my output.
Gauss:P-Brain.ai-RasPi blake$ npm start
P-Brain.ai-Client@0.5.3 start /Users/blake/ai/P-Brain.ai-RasPi node client.js
P-Brain Says: Say 'Hey Brain','Brain' or 'Okay Brain' followed by your command! P-Brain Says: You can also type your command into the terminal! P-Brain Says: I'm Listening? SyntaxError: Unexpected token U in JSON at position 0 at Object.parse (native) at Object.get_response [as get] (/Users/blake/ai/P-Brain.ai-RasPi/api/index.js:8:17) at next (native) at onFulfilled (/Users/blake/ai/P-Brain.ai-RasPi/node_modules/co/index.js:65:19) at process._tickCallback (internal/process/next_tick.js:109:7) P-Brain Says: I'm Listening?
@patrickjquinn Hey man.. I know you are a busy dude... But can you find a spare time to help us out with this? I know I've been bothering for a while already. But it would be pretty cool if we could get the Raspi stuff updated and working... Thank you!
Same here. Same problem.
This shouldnt be a difficult issue to fix but i dont have the time at the moment (i also dont currently have a mic to test), if someone else can debug the issue and submit a PR to get the ball rolling that would be a big help.
On 8 Jul 2017, 01:30 +0100, tfontoura notifications@github.com, wrote:
Same here. Same problem. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I have the same blinking in the browser as show in @gunnarvingren video. The div id skitt-ui changes from "listening" class to "no-listening" class, back and forth every second or so. If I disconnect the USB mic, the round microphone icon stays there, but no place to type any command. As said before, if a query is entered in the url, it returns a correct json.
This client is on the terminal only as it requires official Chrome and not Chromium (which does not support the Raspberry Pi). So you can’t run it that way on the Raspberry Pi.
On 10 Jul 2017, 19:38 +0100, tfontoura notifications@github.com, wrote:
I have the same blinking in the browser as show in @gunnarvingren video. The div id skitt-ui changes from "listening" class to "no-listening" class, back and forth every second or so. If I remove the mic, he round microphone icon stays there, but no place to type any command. As said before, if a query is entered in the url, it returns a correct json. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
This client is on the terminal only as it requires official Chrome and not Chromium (which does not support the Raspberry Pi). So you can’t run it that way on the Raspberry Pi.
Oh ok. No need to run server.js, just client.js. Fine. So we are back to the original issue posted by @gunnarvingren
No, both need to be run, (the client talks to the server)
On 10 Jul 2017, 20:55 +0100, tfontoura notifications@github.com, wrote:
This client is on the terminal only as it requires official Chrome and not Chromium (which does not support the Raspberry Pi). So you can’t run it that way on the Raspberry Pi. Oh ok. No need to run server.js, just client.js. Fine. So we are back to the original issue posted by @gunnarvingren — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
No, both need to be run, (the client talks to the server)
Ok, I realized that now. It seems it is an authorization issue. /api/index.js tries to connect to the server page, but it gets a 401 unauthorized response, so an empty json.
Bingo!
It works if I enter the basic authorization manually in the /api/index.js line as
const url = 'http://pi:password@localhost:4567/api/ask?q='
Great news! The auth change was done a good while back on the server, ill see it i can add a non auth url for the Raspberry Pi client to talk to.
On 10 Jul 2017, 21:22 +0100, tfontoura notifications@github.com, wrote:
Bingo! It works if I enter the basic authorization manually in the /api/inde.js line as const url = 'http://pi:password@localhost:4567/api/ask?q=' — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
https://youtu.be/kkiWajhlbEI
I followed every step on your Readme file. I had to install many (node_modules) manually using "npm install". After all the nodes_modules were installed I was able to initiate server.js and client.js, But it doesn't do anything...(I also tried using Yarn instead of npm). I posted a video of my end result. Thank you!