P-Brain.ai-RasPi icon indicating copy to clipboard operation
P-Brain.ai-RasPi copied to clipboard

Can't get it to work on my RaspberryPi

Open gunnarvingren opened this issue 8 years ago • 12 comments

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!

gunnarvingren avatar Mar 30 '17 02:03 gunnarvingren

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

gunnarvingren avatar Mar 30 '17 03:03 gunnarvingren

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

[email protected] 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?

ghostseven avatar Apr 27 '17 08:04 ghostseven

@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!

gunnarvingren avatar May 01 '17 03:05 gunnarvingren

Same here. Same problem.

tfontoura avatar Jul 08 '17 00:07 tfontoura

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 [email protected], 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.

patrickjquinn avatar Jul 08 '17 10:07 patrickjquinn

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.

tfontoura avatar Jul 10 '17 18:07 tfontoura

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 [email protected], 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.

patrickjquinn avatar Jul 10 '17 18:07 patrickjquinn

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

tfontoura avatar Jul 10 '17 19:07 tfontoura

No, both need to be run, (the client talks to the server)

On 10 Jul 2017, 20:55 +0100, tfontoura [email protected], 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.

patrickjquinn avatar Jul 10 '17 20:07 patrickjquinn

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.

tfontoura avatar Jul 10 '17 20:07 tfontoura

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='

tfontoura avatar Jul 10 '17 20:07 tfontoura

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 [email protected], 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.

patrickjquinn avatar Jul 10 '17 20:07 patrickjquinn