Introducing Steem Voice - a Google Assistant app for the Steem blockchain

in #utopian-io5 years ago

Steem Voice

Github repository 

Author 

What is the project about?

I've always liked Google Voice Assistant. I mean who doesn't? You can fulfill your needs just by speaking to your device.  What if we could implement that to Steem? That's why I've decided to develop a Google Voice Assistant app that interacts with the Steem blockchain. I call it Steem Voice.

Starting this project wasn't easy for me because I have never written a webhook before. Thankfully, I found a great framework called Flask-Assistant that made everything easier.

On the first day, I've encountered a huge problem. I couldn't install the Steem library because of a problem concerning Visual Studio. I kept getting this error: Cannot open include file: 'io.h': No such file or directory. After countless hours of installing visual studio again and again and surfing the internet for a solution, I was able to solve the issue by using Anaconda.

With everything all set, I started the first command which was calculating the reputation of a given user. Here's a video of me testing the first command:

While testing, I found the first major problem which is Usernames. The device couldn't pick up a lot of the usernames I tried unless I spelled them which was very annoying.

I moved on to the second command, calculating a user's upvote worth which was much more complex than I thought. It took me some time to get everything set up especially with all those different variables. 

This was my first time using dialog flow. To be honest, it was a bit confusing. If you look at my older commits, you'll notice that I used different entities for each command. It was completely unnecessary so I fixed it by using only one entity and creating different follow-up intents that should keep everything sorted.

Then It was time to move on into the third command which was calculating the steem power of a given user. I used the converter tool that comes with the steem library. My first method of converting vests into steem power was using the steem_per_mvest as shown below:

 def vests2sp(v):
       ratio = c.steem_per_mvests()
       sp = v * ratio / 1e6
       return str(round(sp, 1))

Then, I found sp_to_vests(sp) which does all of the above so I used it instead.

Finally, I added the last command which is used to read the title of a user's latest post. (I initially wanted this command to also return the link of the post but the link returned wasn't clickable. I will focus on this later)

This morning, I tried the command again but it didn't work which is when I found the second major issue:

Steem-python API isn't fast enough to keep up with Google assistant's 5-second limit which gave me a request timed out error. I wrote a small program to measure the process time of the fourth command:

The process took from 2 to 29 seconds thus confirming the issue.

Roadmap 

Is Steem Voice Ready?

As I explained above, my next goal is to find a solution for the two major problems. For now, I added a list of usernames to overcome the first issue as you might have noticed in the videos I don't have to provide the whole username that's because I added synonyms to the list, for instance, instead of saying @utopian-io I can only say utopian or utopian io. If I don't find a better solution, I'll add a feature when I release the app that enables a user to register his username then I'll manually go through each one adding synonyms to it.

For the second problem, I didn't find a good solution. For now, I'll be leaving it as it is.

There are lots and lots of commands to be added. All help is appreciated. 

Technology Stack 

  • Python 3.6

How to contribute? 

Everyone is welcome to aid. You can contribute to the development of this project by creating a pull request to my repository. You can also get in touch with me on Discord  at Fancybrothers#7429 or on Steem.chat at fancybrothers or simply leave your idea down below.

If you want to test this app on your own, contact me and I'll send you the whole Dialogflow agent or a temporarily link to test it out.

Ps: Sorry for the low quality video. I don't have any good recording equipment.

My Github account: https://github.com/Fancybrothers

Sort:  

Thank you very much for your creative work! This has blown my mind and I am sure this project is great use to many steemians.

  1. for your second problem, you can always set up a server to cache some results so it is quicker to query than the steem blockchain.
  2. I can see from your code there are some duplication e.g. 'what is your username' I am sure this can be refactored into a module.
  3. You might want to organize your source code files into different modules for example, utils, steem-utils etc.
  4. Unit tests are missing - which is good to add from the start of the project.
  5. You can add Vests directly in Steem/Python i.e. you don't need clean. Also you don't need rep_cal as it is already implemented here

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thanks a lot. I'll make sure to follow your advice in the next commit.

Thank you for your review, @justyy! Keep up the good work!

Whoa, great job man! Never knew you had those skills!
Sounds like a wonderful project!

Thanks, bud. I really appreciate your support.

Hi @fancybrothers!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Thanks a bunch

Hey, @fancybrothers!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.28
TRX 0.12
JST 0.033
BTC 61691.46
ETH 3047.50
USDT 1.00
SBD 3.88