AI Zone Admin Forum Add your forum
Harry’s Topic example

Hi, this is my first post for ChatScript.

Now I’d like to make a ChatBot which can make a response for undefinded keyword.
And I find a nice example topic “” in Harry’s folder.
It seems to Harry can make a response using by JSON even I didn’t add a specific rule for this.

But I am not able to receive a response that I expected.
Is there any work need for running this topic?

Thank you in advance!!


  [ # 1 ]

I don’t know if it’s just me, but I don’t understand your problem yet.
Maybe you can post your code example, say what it does and what you expect it to do?


  [ # 2 ]

Thank you for asking Tobias La.

I made below code refered by Harry’s topic.
It’s almost same with Harry’s

u: (jsontest) keep()
  $$url = ^”\“;=&explaintext;=&format=json&titles=apple\”“
  $$user_agent = ^“User-Agent: MSIE/11.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)”
  $$tmp = ^jsonopen(GET $$url “” $$user_agent)
  ^jsonpath(  “.query .pages .56333 .extract” $$tmp)
  @0 = query(direct_v ? extract ? 1)

According to above code, I expect my chatbot make a response when I entered “jsontest”.
and a response should be a information about ‘apple’ that searched from wikipedia.

However it’s faild to make a response that I expected.
When I checked log usging by :trace all, I can find that there is a problem with JSON connect.
(It says “Json connect failed”)

Do you have any idea about this situation?


  [ # 3 ]

I have no experiences with json connect, but I just copied the example from harry and replaced the variable with apple, and it worked.

It seems you have some semicolons in your url and are missing an email in your user_agent.
Changing those two things made your example work for me.

Comment out your jsonpath and see what jsontree is returning, your jsonpath doesn’t exist and has to be adjusted.


  login or register to react