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

SUSI Server ignores time zone information #1435

Open norbusan opened 4 years ago

norbusan commented 4 years ago

Actual Behaviour

Asking the time of susi server returns the time in GMT instead of local time, ignoring various information.

Example code:

import susi_python as susi
import requests
susi.ask("what is the time")
{'planned_actions': [], 'answer': 'it is 12 minutes past 8'}
# actual time is 16:08
# send request with parameters is
# https://api.susi.ai/susi/chat.json
# {'q': 'what is the time', 'timezoneOffset': -540, 'device_type': 'Smart Speaker'}

# now try to set location and send additional geo data, too
res = requests.get('http://ip-api.com/json').json()
susi.update_location(longitude=res['lon'], latitude=res['lat'],country_name=res['country'], country_code=res['countryCode'])
{'planned_actions': [], 'answer': 'it is 12 minutes past 8'}
# actual time is 16:08
# send request with parameters is
# https://api.susi.ai/susi/chat.json
# {'q': 'what is the time', 'timezoneOffset': -540, 'device_type': 'Smart Speaker', 'latitude': 36.4002, 'longitude': 136.4757, 'country_name': 'Japan', 'country_code': 'JP'}

Thus, susi server ignores

Expected Behaviour

I expect SUSI server to answer in local time.

norbusan commented 4 years ago

Digging through the source code, I see that the timezoneOffset and other infos are added to the recall, but never evaluated for normal answers. The only place where the timezoneOffset plays a role is in the planned action section, but for things like "what is the time" it is not used.

parikshitgupta1 commented 4 years ago

Why does Susi server ignores country_name and country_code

issue

norbusan commented 4 years ago

Where should this play a role? But yes, the country etc should be evaluated under certain skills, I agree.

parikshitgupta1 commented 4 years ago

I see