fossasia / susi_server

SUSI.AI server backend - the Artificial Intelligence server for personal assistants https://susi.ai
GNU Lesser General Public License v2.1
2.5k stars 1.08k forks source link

What is the time asks Wolfram: Expected - Only use Wolfram Alpha when Really Needed #1419

Open mariobehling opened 4 years ago

mariobehling commented 4 years ago

Currently susi_server tries to contact wolfram first before trying something else. A simple "what is the time" request takes seconds to complete:

2019-12-16 08:02:22.613 INFO root  - JSON data from API cannot be parsed: https://www.wolframcloud.com/objects/9611ca1b-5214-4887-863e-6ef6e4d44941
2019-12-16 08:02:22.613 INFO root  - Susi is thinking about: {"data":[],"metadata":{"hits":0,"count":0}}
2019-12-16 08:02:22.616 INFO root  - === Wasted 11393 milliseconds with intent {"id":-966673264,"depth":0,"score":9275070245451,"skill_source":"/susi_skill_data/models/general/Utilities/en/time.txt","skill_link":"https://github.com/fossasia/susi_skill_data/blob/master/models/general/Utilities/en/time.txt","skill_line":9,"keys":["time"],"phrases":[{"type":"minor","expression":"current time","line":9},{"type":"minor","expression":"what time is it","line":9},{"type":"minor","expression":"what time it is","line":9},{"type":"minor","expression":"what is the time","line":9},{"type":"minor","expression":"tell me the time","line":9},{"type":"minor","expression":"can you tell me the time","line":9},{"type":"minor","expression":"tell the time","line":9},{"type":"minor","expression":"what is the time","line":9},{"type":"minor","expression":"time now","line":9},{"type":"minor","expression":"could you tell me the time","line":9},{"type":"minor","expression":"i don't know what time it is","line":9},{"type":"minor","expression":"please tell the time","line":9}],"process":[{"type":"console","definition":{"url":"https://www.wolframcloud.com/objects/9611ca1b-5214-4887-863e-6ef6e4d44941","path":"$.queryresult.pods[1].subpods"}}],"actions":[{"type":"answer","select":"random","phrases":["It is $plaintext$"],"language":"en","line":17}],"cues":[],"example":"What time is it","expect":"it is 2 minutes past 17"}

Is there a way to disable wolfram or make it be contacted after local skills are nt found?

Related to: https://github.com/fossasia/susi_server/issues/1417

norbusan commented 4 years ago

There are more problems here: Asking "what is the time" again queries Wolfram due to susi_skill_data/models/general/Utilities/en/time.txt, but the answer is broken, because the link given there responds with rubbish:

2020-01-12 16:42:39.843 INFO root  - JSON data from API cannot be parsed: https://www.wolframcloud.com/objects/9611ca1b-5214-4887-863e-6ef6e4d44941

At least the question about "what is the time in vienna" works, that is the second skill in the above file, and this API seems still to work.

norbusan commented 4 years ago

I suggest to remove the first one, as it is completely irrelevant and done by internal os skill

Here is the skill

::name Time
::author Saurabh Jain
::author_url https://github.com/saurabhjn76
::description A skill to tell current time
::dynamic_content Yes
::developer_privacy_policy
::image images/time.png
::terms_of_use

current time | What time is it | What time it is|What is the time|tell me the time |can you tell me the time|tell the time|What's the time|time now|Could you tell me the time| I don't know what time it is| Please tell the time
!example:What time is it
!expect:it is 2 minutes past 17
!console:It is $plaintext$ 
{
"url":"https://www.wolframcloud.com/objects/9611ca1b-5214-4887-863e-6ef6e4d44941",
"path":"$.queryresult.pods[1].subpods"
}
eol

current time in * | What time is it in * ?| What time it is in * ?|What is the time in * ?|tell me the time in *| can you tell me the time in *| please tell the time in *| What's the time in *| time in *| Could you tell me the time in *| Could you please tell me the time in *
!example:current time in london
!console:In $1$ it is $plaintext$ 
{
"url":"https://api.wolframalpha.com/v2/query?input=what+time+is+it+in+$1$&format=plaintext&output=JSON&appid=9WA6XR-26EWTGEVTE",
"path":"$.queryresult.pods[1].subpods"
}
eol
norbusan commented 4 years ago

@Orbiter any comment concerning this?

norbusan commented 4 years ago

Ok, I digged through the Java code, and in the case of "What is the time", two ideas are candidates:

So I see there are two problems that need to be tackled

Do we want to query wolfram on any question concerning "what is ..."? First of all, the appId/key needs to be configurable, and then, these queries take time.

norbusan commented 4 years ago

I removed the wrong first entry from susi_skill_data/models/general/Utilities/en/time.txt since the URL gives errors. Now the susi server responds immediately with the time. Problem of timezone ignoring is still present, though.