Comments/Feedback analyser middleware using mindsdb+mongodb+nodejs

Comments/Feedback analyser middleware using mindsdb+mongodb+nodejs

SmartMw is a Smart MiddleWare made using MindsDb for all your projects where you find a need to get insights on feedback/comments made by your customer/audience. We use AI to provide you those insight so project/buisness handlers can make better decision and stay productive.

Pros:-

  • Handle your customer/audience responses from multiple Buisnessess and Projects all at one place

  • Use the power of AI to get usefull insights like response sentiment, Translation, Safe/Unsafe etc.

  • (upcoming) Use Chatgpt to answer those feedbacks and comments with a single click

Upcoming:-

  • Handle feedback and comments from playstore & appstore, email etc.

  • Assign them to multiple staff

  • Various handling integration so that staff can use their preferred apps to reply to those feedbacks

Link to the Github Repo

https://github.com/captain0jay/SmartMw

How I actually made it?

So the project starts with a landing page which is rendered if it doesn't get the access token I stored as a cookie, I know I know storing access token as a cookie is a risky job, but it gets the job done to demonstrate the use of Mindsdb.

Coming back to the project , Landing page has github OAuth with it to you know authenticate user using github and store the access token to know if the user is logged in or not, if user is logged in then they are displayed 'Dashboard'.

Dashboard contains Clusters , each of those cluster can take project name and database URI and then i store them in MongoDB using mongoose along with user credentials and blah blah blah........

You know how this goes, same old MERN Lore.

We are here to talk about Mindsdb, so after user gives the website its data a separate script runs in the background where Mindsdb is connected and The Machine Learning models that were trained are used and the sentiment analysis is done. Thats it......

Nah just kidding i am gonna explain exactly how its done.

  1. Head over to Mindsdb and make a account

Now remember the password coz I ain't coming to remember that for you

  1. Now don't do nothing there

Trust me you don't wanna use the web version of Mindsdb , its good but a bit complex and not so beginner friendly

Now head over to MongoDB compass , you don't have that then download it.

After downloading Mongodb compass make a connection string and use this tutorial to make a connection.

Follow the steps given bellow , trust me i would have written all of that or copy pasted the model making procedure but god damn the documentation is so beginner friendly, just just look at it yourself.....

After you are done making model head over to your project........

const MindsDB = require('mindsdb-js-sdk');
const { Database, Model, ModelPrediction, Project, Table, View } = require('mindsdb-js-sdk');
require('dotenv').config();
//sentiment analysis
async function emotions(prompt){

//connection string
await MindsDB.default.connect({
  user: prcoess.env.MINDDB_MAIL,
  password: prcoess.env.MINDDB_P
});

//models connection parameters

const currentdb = await MindsDB.default.Databases.getDatabase('newestdb');
console.log(currentdb);
let newprompt = "message =" + "'" + `${prompt}` + "'";
console.log(newprompt)
sentimentModel = await MindsDB.default.Models.getModel('sentiment_classifier', 'mindsdb');
const queryt = {
  where : [
    newprompt
  ]
};
const queryResult = await sentimentModel.query(queryt);
console.log(queryResult.value);
return queryResult.value;
}

Now after making the model i am gonna use mongodb-js-sdk , there is official mindsdb library which is preferred and i didn't used it because i am noob and didn't researched it well and thought this was better although this is official too you get the point right......

So i use getModel() along with inputted query of the prompt i wanna feed the model, and it gives me sentimental out put , sorry didn't had any other name i could describe it with.

So this is how you can use Mindsdb in your project to make predictions, this may or may not have helped you. My point was i successfully integrated Mindsdb with my website. I am gonna add Lots of new features later , i would have added it earlier but i just saw its hackathon announcement like 3 days ago when it was ending(University Exams sad emoji) don't know if they gonna consider it or not but i had fun using Mindsdb in my project and definitely will use it again in upcoming projects.

Link to project

Upcoming features if you are interested

//flags as in safe or not
//status as in open or closed
//ai answer given or not
//industry its relying on 
//translation of comment if not in english (later feature)
//summary of comment provided too
//emotions('best product ever');

Did you find this article valuable?

Support Captain Jay Vijaykumar by becoming a sponsor. Any amount is appreciated!