Jarvis
Jarvis copied to clipboard
Personal Configuration
I think will be nice if every person can configure Jarvis with some personal information. Like when you open the Jarvis he starts saying: "Hi $username, What can I can do for you?
Or create personal variables Jarvis do I need an umbrella to go to work? And Jarvis knowing the city where he works can say the weather.
Or more thinks that we can implement to the usability of Jarvis can be better for each people. Labels: help wanted and new_feature
I was working around this topic with the code that I show you below:
from plugin import plugin
import csv
@plugin("myinfo")
def myinfo(jarvis, s):
mydict = {}
name_parameter = input("Write down your name: ")
age_parameter = input("Write down your age: ")
city_parameter = input("Write down your city's name: ")
mydict['name_parameter'] = name_parameter
mydict['age_parameter'] = age_parameter
mydict['city_parameter'] = city_parameter
if bool(mydict):
print('New inputs are: ' + str(mydict))
try:
with open('myinfo.csv', 'w') as csv_file:
writer = csv.writer(csv_file)
for key, value in mydict.items():
writer.writerow([key, value])
except IOError:
print("I/O error")
else:
print('Nothing in myinfo')
But I don't know why, when I execute Jarvis and write "help", the new plugin doesn't appear at the list. The idea is to create a CSV file where you can save your personal info, and then, when you will need that this info works with another plugin, you only will need to call the variable that you are interested on.
Hi @JonanOribe , nice code. So first about the file. I think will be better if we use a JSON file to save the information. About the plugin, maybe we need 2 ones, one for create and others to edit the params. In this plugin need to have a function that others plugin can use to get the information from the JSON file. After this plugin has done would be nice if when the Jarvis start he loads if exist the personal information.
Hi @JonanOribe , nice code. So first about the file. I think will be better if we use a JSON file to save the information. About the plugin, maybe we need 2 ones, one for create and others to edit the params. In this plugin need to have a function that others plugin can use to get the information from the JSON file. After this plugin has done would be nice if when the Jarvis start he loads if exist the personal information.
I just upload a new plugin that works as personal configuration configurator. It works with CSV, but because i'm waiting for a "green light" for a database implementation on Jarvis, that finally is better that work around CSV,JSON or something like this
@JonanOribe I like where you're headed with the myinfo
plugin. Rather than using a CSV to save the info though, Jarvis already implements a memory system that stores local settings in a JSON. You can save new settings to it through jarvis.update_data()
, and other plugins could then access those settings through jarvis.get_data()
. And like rogervieiraa mentioned, there should be some code added to Jarvis to recall those settings and greet the user with their name when it's initialized.
Let me know if you're not interested in continuing this issue. It seems like a good feature to have, so I might pick it up where you left off.
Hi, guys,
@aazuspan Where would this data be stored? I've searched and not have found this JSON. Shouldn't we use the path "Jarvis/jarviscli/data/" to write a JSON or a CSV? I This would be my proposal for addition in the code of @JonanOribe .
Also, I'm interested in continuing the development in case any of you are not interested. It could be a reference for future plugins to use "myInfo" data.
Hi @Martins6 , at this moment I have not too much time for continuing with this feature, so if you want too take it feel free about this. On the other hand, if you have any question about the code just tell me.
Hi @Martins6,
In the packages
folder, memory.py
handles that JSON file. It's created on the user's local drive when something is saved to memory, which is probably why you couldn't find it.
I definitely don't mind if you tackle this. I think it'd be a good addition.