Closed sprinteroz closed 6 years ago
Y-Bot only has limited support for searching google, but the grammar is <pattern>google *</pattern>
which means google needs something to google
>>> google aiml
<a target="_new" href="http://www.google.com/search?q=<personf/>"> Google Search
</a>
>>>
search
and web search
don't have grammars in Y-Bot, but Alice2 and Rose have some support
Full google/search engine support is on my list of things to add to Y-Bot but it takes some time as I write full suite of tests for each grammar
K
Hi @keiffster and All, Ok thanks mine did not return a answer from the search. Is there any way I can teach the bot quicker?
Do you have the latest version of Program-y ?, I just ran the grammar on the latest version to create the output above
In terms of teaching the bot, this is always done via creating new grammars, but I would start with ensuring you have the latest version which supports 'search *'
Hi @keiffster and All, Yeah I have the latest repo of the files I have gone into the firewall and given it trusted access to the internet but just not getting a reply back yet
Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> google aiml
<a target="_new" href="http://www.google.com/search?q=<personf/>"> Google Search
</a>
>>>
A-ha, I see the problem, it doesn't actually search google, just provides the link for you to click on. Google has removed most of their APIs that allow you call them programatically. The only solutions which seem to exist are via scraping the results of an HTTP request.
However I have discovered a bug in the link code, the parser is not replacing
Sad that Google is shutting down all the free API area making it harder for people to search with there projects, but Great news you may have found a bug in the code that you can find a way around.
Hi @keiffster and All, Had a search online and found all the free search engine API's below and some python code to go with them.
My comment below will explain a idea for the the API links:
https://earthdatascience.org/tutorials/intro-google-earth-engine-python-api/
http://www.faroo.com/hp/api/api.html
https://marcobonzanini.com/2015/01/12/searching-pubmed-with-python/
https://awesome-python.com/#restful-api
https://shodan.readthedocs.io/en/latest/
https://www.algolia.com/doc/api-client/python/getting-started/
https://au.mathworks.com/help/matlab/matlab-engine-for-python.html?requestedDomain=de.mathworks.com
http://redisearch.io/python_client/
https://inspirehep.net/help/hacking/search-engine-api
https://code.google.com/archive/p/pybing/ https://www.bing.com/partners/developers
https://aws.amazon.com/documentation/apigateway/
https://tryolabs.com/blog/2015/02/17/python-elasticsearch-first-steps/
Web pages with a list of usefull API's
http://www.pythonforbeginners.com/api/list-of-python-apis
https://www.reubano.xyz/tagged/python/
https://freshcode.club/search?q=python
I found these links very interesting they might be handy
http://pysnmp.sourceforge.net/docs/api-reference.html
In the youtube clip they talk about calling in files from many API's and adding them to a SQL or .xltx – Excel template
Youtube clip link: https://youtu.be/xBBAD407zzU
Just thinking might be able to collect from more then one API if other API's where set to search at the same time, then octoparse saves there answer to .xltx or SQL then take that data and change it into aiml code with there tags in place for a offline response, just in case the question is asked again later and the API is down, the bot will give a different answer from the API's first search it got that was changed into aiml code to create the offline reply... Just a thought
Latest release to master has a fix for xml tags, the aiml tags contained inside the xml are now rendered and replaced with values
A downside of having the bot act as a proxy for Google or other general search engines means that a user doing inappropriate searches will cause search traffic to originate from your server IP address. If you are running a public bot this probably isn't a good idea. Even in work environments its surprising what we see in proxy logs, even though we tell users that their usage of work Internet is monitored...
For me, providing a link to search Google using their own browser (and IP) is more than fine... it's like if someone asks you something you don't know, you might say "have you tried Googling that?"
Very true is one of the reason I've not pursued that area of work in detail.
For data sources like met office, google maps and news feeds you can control what is asked for and what is displayed.
program-y does have an interface to Wikipedia which is useful for looking up data but I am now favouring rdf to control even that data
A downside of having the bot act as a proxy for Google or other general search engines means that a user doing inappropriate searches will cause search traffic to originate from your server IP address. If you are running a public bot this probably isn't a good idea. Even in work environments its surprising what we see in proxy logs, even though we tell users that their usage of work Internet is monitored...
Yeah I see your point, it would make it hard to monitor unless you had some way to scan the saved results and remove inappropriate code.
But I would like to use it for desktop use as my father keeps telling me when he get mad at the computer "You should be able to tell the thing what to do!" So that is what my aim is, to learning python and aiml2 plus see this project throw and maybe help build a desktop version with talk-y.
I have found nothing like this set of repositories on AI there has been a lot of work done here @keiffster you should be proud. I just wish I could find a way to help out more.
Just wondering if the problem was able to be fixed at all, as I still get the same reading as my earlier post.
Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> google aiml
<a target="_new" href="http://www.google.com/search?q=<personf/>"> Google Search
</a>
>>>
Thanks for your time.
Pull the latest version from master it now works
Loading, please wait... No bot root argument set, defaulting to [.] Y-Bot version 0.0.1, initiated March 14, 2017 Hi, how can I help you today?
google aiml Google Search
The person tag is now replaced with the actual content of the ask
The system will not actually google for aims, it just provides you with a link to clock, which in console is not feasible
However run ./y-bot-webchat.sh and try asking the same question again in the HTML Chat window and you’ll get a url link you can click
K
On 22 Sep 2017, 14:55 +0100, sprinteroz notifications@github.com, wrote:
Just wondering if the problem was able to be fixed at all, as I still get the same reading as my earlier post. Loading, please wait... No bot root argument set, defaulting to [.] Y-Bot version 0.0.1, initiated March 14, 2017 Hi, how can I help you today?
google aiml Google Search
Thanks for your time. — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
I have been trying to find out the right way to build and run the .sh file run ./y-bot-webchat.sh but have had no luck, can you tell me the right code to launch the file, I have tried pip, bash, and a lot of different codes.
PS C:\Users\XXX\Documents\GitHub\program-y\bots\y-bot>
A .sh file is a bash shell script for Linux and Mac. You need a .cmd for windows.
I’ll write you one and post it shortly
K
Keith Sterling E: keith@keithsterling.com M: +44 (0) 7771 597 630
On 25 Sep 2017, 15:24 +0100, sprinteroz notifications@github.com, wrote:
I have been trying to find out the right way to build and run the .sh file run ./y-bot-webchat.sh but have had no luck, can you tell me the right code to launch the file, I have tried pip, bash, and a lot of different codes. PS C:\Users\XXX\Documents\GitHub\program-y\bots\y-bot> — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Use the following script
@echo off
CLS
SET PYTHONPATH=....\src;....\libs\MetOffer-1.3.2;.
python ....\src\programy\clients\webchat/chatsrv.py --config .\config.windows.yaml --cformat yaml --logging .\logging.windows.yaml
I’m adding .cmd equivalents for all Y-Bot .sh scripts in time for 1.0 release, but this should work for you until then
On 25 Sep 2017, 15:24 +0100, sprinteroz notifications@github.com, wrote:
I have been trying to find out the right way to build and run the .sh file run ./y-bot-webchat.sh but have had no luck, can you tell me the right code to launch the file, I have tried pip, bash, and a lot of different codes. PS C:\Users\XXX\Documents\GitHub\program-y\bots\y-bot> — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks for the reply I got the webclient to run:
SET PYTHONPATH=..\..\src;..\..\libs\MetOffer-1.3.2;.
python ..\..\src\programy\clients\webchat/chatsrv.py --config .\config.windows.yaml --cformat yaml --logging .\logging.windows.yaml
Loading, please wait...
No bot root argument set, defaulting to [.]
Initiating Webchat Client...
WebChat Client running on 0.0.0.0:5000
It will not load past that point, then I ran y-bot.cmd. I did not get a link got the same reply as before:
Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> google aiml2
<a target="_new" href="http://www.google.com/search?q=aiml2">Google Search</a>
>>>
I then tried the web browser http://0.0.0.0:5000/ no luck
Im running This site can’t be reached
Just realised earlier today there was a new release program-y-0.99.3, as github dose not e-mail me about any new releases. github keiffster program-y releases
Webchat does not have a console, it only has a web based chat window available on http://127.0.0.1:5000, so once you see the client running with the message "WebChat Client running on 0.0.0.0:5000”, stick the url in your browser and you should see a very plain text window
And yes, grab 0.99.2 or 0.99.3 as I updated the HTTP handling and it will now show a clickable link
K
On 26 Sep 2017, 11:57 +0100, sprinteroz notifications@github.com, wrote:
Thanks for the reply I got the webclient to run: SET PYTHONPATH=....\src;....\libs\MetOffer-1.3.2;. python ....\src\programy\clients\webchat/chatsrv.py --config .\config.windows.yaml --cformat yaml --logging .\logging.windows.yaml Loading, please wait... No bot root argument set, defaulting to [.] Initiating Webchat Client... WebChat Client running on 0.0.0.0:5000 It will not load past that point, then I ran y-bot.cmd. I did not get a link got the same reply as before: Loading, please wait... No bot root argument set, defaulting to [.] Y-Bot version 0.0.1, initiated March 14, 2017 Hi, how can I help you today?
google aiml2 Google Search
I then tried the web browser http://0.0.0.0:5000/ no luck Im running This site can’t be reached Just realised earlier today there was a new release program-y-0.99.3, as github dose not e-mail me about any new releases. github keiffster program-y releases — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Cheers that worked :star2:
Also like to know, if I hooked another computer on my network, would y-bot webpage load from its browser by just typing in http://127.0.0.1:5000 because I'm hosting the webclient locally on this computer?
Not quite, the configuration option for the host as 0.0.0.0 really means accepted all connections from all networks. If you specify it as 127.0.0.1 then it would only accept connections from the same machine webchat: host: 0.0.0.0 port: 5000 debug: false
If you have the chat client running on another machine, then you need the ip or hostname of the machine its running on. Keep the host as 0.0.0.0, but you would open the browser on the second machine and then enter http://xx.xx.xx.xx:5000 which xx.xx.xx.xx is the ip address of the machine running the webclient
On windows you can get this by running ipconfig
K
On 26 Sep 2017, 12:26 +0100, sprinteroz notifications@github.com, wrote:
Cheers that worked 🌟 Also like to know, if I hooked another computer on my network, would that y-bot webpage load from its browser by just typing in http://127.0.0.1:5000 because I'm hosting the webclient locally on this computer? — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Sweet I got it going,
Thanks again for that help with the code, now my girlfriend can use y-bot. I also worked out that http://localhost:5000/ works as well to call the the y-bot webchat page
Can I add a subnet mask to this config file or is there no code to support that function?
Code I changed to get it going:
rest:
host: 127.0.0.1
#Subnet Mask: 255.255.255.0
port: 5000
debug: false
webchat:
host: 192.168.0.3
#Subnet Mask: 255.255.255.0
port: 5000
debug: false
# 127.0.0.1
# 0.0.0.0
#http://localhost:5000/
You would not put a subnet mask at this level. The config items are basically used to state what host to run on and what port to
Using 127.0.0.1 or the IP address of the machine its running on means only accept connections from that same machine Using 0.0.0.0 means accept connections from any server
If you are trying to limit connections from certain machines you are better off with a firewall K
On 27 Sep 2017, 14:43 +0100, sprinteroz notifications@github.com, wrote:
Sweet I got it going and my girlfriend can now use y-bot. I also worked out that http://localhost:5000/ works as well to call the the y-bot webchat page Can I add a subnet mask to this config file or is there no code to support that function? Code I changed to get it going: rest: host: 127.0.0.1
Subnet Mask: 255.255.255.0
port: 5000 debug: false
webchat: host: 192.168.0.3
Subnet Mask: 255.255.255.0
port: 5000 debug: false
127.0.0.1
0.0.0.0
http://localhost:5000/
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
OK Thanks for that bit of info, I just have trusted users on my network at the moment.
I noticed that 0.99.4 release was out so download it changed the file and I'm afraid I get many errors.
First the address in the address bar changers from http://127.0.0.1:5000/ to http://127.0.0.1:5000/?usermsg=hello&submitmsg=Send when you type in a message
In the CMD Python shell or wapper "I think it would be called" gives this error:
SET PYTHONPATH=..\..\src;..\..\libs\MetOffer-1.3.2;.
python ..\..\src\programy\clients\webchat/chatsrv.py --config .\config.windows.yaml --cformat yaml --logging .\logging.windows.yaml
Loading, please wait...
No bot root argument set, defaulting to [.]
Initiating Webchat Client...
WebChat Client running on 0.0.0.0:5000
[2017-09-28 00:24:48,833] ERROR in app: Exception on /api/v1.0/ask [GET]
Traceback (most recent call last):
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\_compat.py", line 33, in reraise
raise value
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "..\..\src\programy\clients\webchat/chatsrv.py", line 44, in ask
if WEBCHAT_CLIENT.configuration.client_configuration.use_API_KEYS is True:
AttributeError: 'WebChatConfiguration' object has no attribute 'use_API_KEYS'
[2017-09-28 00:31:09,266] ERROR in app: Exception on /api/v1.0/ask [GET]
Traceback (most recent call last):
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\_compat.py", line 33, in reraise
raise value
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "..\..\src\programy\clients\webchat/chatsrv.py", line 44, in ask
if WEBCHAT_CLIENT.configuration.client_configuration.use_API_KEYS is True:
AttributeError: 'WebChatConfiguration' object has no attribute 'use_API_KEYS'
Now tied in 0.9.4.1 just released.
Typo in webchat server caused a problem, all sorted now
K
On 27 Sep 2017, 15:42 +0100, sprinteroz notifications@github.com, wrote:
OK Thanks for that bit of info just trusted users at the moment. I noticed that 0.99.4 release was out so download it changed the file and no go I get many errors. First the address in the address bar changers from http://127.0.0.1:5000/ to http://127.0.0.1:5000/?usermsg=hello&submitmsg=Send when you type in a message In the CMD Python shell or wapper "I think it would be called" gives this error: SET PYTHONPATH=....\src;....\libs\MetOffer-1.3.2;. python ....\src\programy\clients\webchat/chatsrv.py --config .\config.windows.yaml --cformat yaml --logging .\logging.windows.yaml Loading, please wait... No bot root argument set, defaulting to [.] Initiating Webchat Client... WebChat Client running on 0.0.0.0:5000 [2017-09-28 00:24:48,833] ERROR in app: Exception on /api/v1.0/ask [GET] Traceback (most recent call last): File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask_compat.py", line 33, in reraise raise value File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "....\src\programy\clients\webchat/chatsrv.py", line 44, in ask if WEBCHAT_CLIENT.configuration.client_configuration.use_API_KEYS is True: AttributeError: 'WebChatConfiguration' object has no attribute 'use_API_KEYS' [2017-09-28 00:31:09,266] ERROR in app: Exception on /api/v1.0/ask [GET] Traceback (most recent call last): File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask_compat.py", line 33, in reraise raise value File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "....\src\programy\clients\webchat/chatsrv.py", line 44, in ask if WEBCHAT_CLIENT.configuration.client_configuration.use_API_KEYS is True: AttributeError: 'WebChatConfiguration' object has no attribute 'use_API_KEYS' — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Cool all working again :+1:
Hi @keiffster and All, I have been able to get y-bot going, and thinking I'm asking the right function questions but keep getting a stranded reply