diff --git a/.rasa/cache/cache.db b/.rasa/cache/cache.db index 6530a56..6e00244 100644 Binary files a/.rasa/cache/cache.db and b/.rasa/cache/cache.db differ diff --git a/__pycache__/database_connectivity.cpython-38.pyc b/__pycache__/database_connectivity.cpython-38.pyc new file mode 100644 index 0000000..e2a4e0f Binary files /dev/null and b/__pycache__/database_connectivity.cpython-38.pyc differ diff --git a/actions/__pycache__/__init__.cpython-38.pyc b/actions/__pycache__/__init__.cpython-38.pyc index 01404a8..9253db9 100644 Binary files a/actions/__pycache__/__init__.cpython-38.pyc and b/actions/__pycache__/__init__.cpython-38.pyc differ diff --git a/actions/__pycache__/actions.cpython-38.pyc b/actions/__pycache__/actions.cpython-38.pyc index 4a3d529..90681ee 100644 Binary files a/actions/__pycache__/actions.cpython-38.pyc and b/actions/__pycache__/actions.cpython-38.pyc differ diff --git a/actions/actions.py b/actions/actions.py index 8bf1f75..b5bae75 100644 --- a/actions/actions.py +++ b/actions/actions.py @@ -7,10 +7,12 @@ # This is a simple example for a custom action which utters "Hello World!" -# from typing import Any, Text, Dict, List -# -# from rasa_sdk import Action, Tracker -# from rasa_sdk.executor import CollectingDispatcher +from typing import Any, Text, Dict, List + +from rasa_sdk import Action, Tracker +from rasa_sdk.executor import CollectingDispatcher +from database_connectivity import DataUpdate +import datetime # # # class ActionHelloWorld(Action): @@ -25,3 +27,32 @@ # dispatcher.utter_message(text="Hello World!") # # return [] + +# class ActionHelloWorld(Action): + +# def name(self) -> Text: +# return "action_hello_world" + +# def run(self, dispatcher: CollectingDispatcher, +# tracker: Tracker, +# domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: + +# dispatcher.utter_message(text="Hello World!") + +# return [] + + + +#FOR DATABASE CONNECTIVITY AND UPDATION. +# class ActionSubmit(Action): +# def name(self) -> Text: +# return "action_submit" + +# def run(self, dispatcher: CollectingDispatcher, +# tracker: Tracker, +# domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: + +# current_time = str(datetime.datetime.now()) +# current_time = current_time.split(":") +# current_time = current_time[0] + ":" + current_time[1] +# DataUpdate(tracker.get_slot("name"),tracker.get_slot("email"), current_time, tracker.sender_id) \ No newline at end of file diff --git a/assets/bot widget.jpg b/assets/bot widget.jpg new file mode 100644 index 0000000..13172e9 Binary files /dev/null and b/assets/bot widget.jpg differ diff --git a/assets/bot_widget-removebg-preview.png b/assets/bot_widget-removebg-preview.png new file mode 100644 index 0000000..30e2797 Binary files /dev/null and b/assets/bot_widget-removebg-preview.png differ diff --git a/assets/demo.html b/assets/demo.html new file mode 100644 index 0000000..e69de29 diff --git a/assets/robo_small.gif b/assets/robo_small.gif new file mode 100644 index 0000000..5cba510 Binary files /dev/null and b/assets/robo_small.gif differ diff --git a/data/nlu.yml b/data/nlu.yml index c7fb9c5..0bdea9d 100644 --- a/data/nlu.yml +++ b/data/nlu.yml @@ -13,7 +13,7 @@ nlu: - tell me about the pm kusum scheme - pm kusum scheme details - PM-KUSUM scheme informatio - - What is pm kusum? + - What is pm kusum? - intent: component_A examples: | @@ -31,11 +31,14 @@ nlu: - eligible A - Who is eligible under Component A of PM-KUSUM Scheme? - component A eligibility - - who can apply for component A? + - who can apply for component A? + - who is eligible for component A? - intent: electricity examples: | - - Who will purchase the generated electricity? + - who will purchase the generated electricity? + - who will buy the electricity? + - the generated electricity will be bought by whom? - intent: lease examples: | @@ -131,50 +134,6 @@ nlu: - that sounds good - correct -- intent: deny - examples: | - - no - - n - - never - - I don't think so - - don't like that - - no way - - not really - -- intent: mood_great - examples: | - - perfect - - great - - amazing - - feeling like a king - - wonderful - - I am feeling very good - - I am great - - I am amazing - - I am going to save the world - - super stoked - - extremely good - - so so perfect - - so good - - so perfect - -- intent: mood_unhappy - examples: | - - my day was horrible - - I am sad - - I don't feel very well - - I am disappointed - - super sad - - I'm so sad - - sad - - very sad - - unhappy - - not good - - not very good - - extremly sad - - so saad - - so sad - - intent: bot_challenge examples: | - are you a bot? @@ -199,5 +158,38 @@ nlu: - thank you so much - thank you - thank u + +- intent: name + examples: | + - siddharth srivastava + - rahul + - yashvant + - prashant sathe + - aryan + - pradip + - rohan verma + - ayappa nagubandi + - vivek sharma + - sanket yadav + - piyush + - tejas varale + - sachin jadhav + - ajay + - santosh + - varun oberoi + - salman shaikh + - mohna + - nikita + +- intent: email + examples: | + - rahul@gmail.com + - siddharth45@gmail.com + - yashsathe@yahoo.in + - abhijeet33@gmail.com - +- intent: start + examples: | + - "hey" + - "Hi" + - "/start" diff --git a/data/stories.yml b/data/stories.yml index c79c11a..edbfdd3 100644 --- a/data/stories.yml +++ b/data/stories.yml @@ -70,4 +70,25 @@ stories: - story: Out of scope steps: - intent: out_of_scope - - action: utter_default \ No newline at end of file + - action: utter_default + +# - story: user_information +# steps: +# - intent: start +# - action: utter_name +# - or: +# - intent: name +# - intent: electricity +# - intent: scheme +# - intent: component_A +# - intent: component_B +# - intent: component_C +# - intent: affirm +# - slot_was_set: +# - name: siddharth +# - action: utter_email +# - intent: email +# - slot_was_set: +# - email: siddharth@gmail.com +# - action: action_submit +# - action: utter_greet \ No newline at end of file diff --git a/database_connectivity.py b/database_connectivity.py new file mode 100644 index 0000000..2f4b06d --- /dev/null +++ b/database_connectivity.py @@ -0,0 +1,23 @@ +import mysql.connector + +def DataUpdate(name, email, date, session_id): + mydb = mysql.connector.connect( + host = "localhost", + user = "root", + password = "1234", + database = "mydatabase" + ) + + mycursor = mydb.cursor() + + #sql = "CREATE TABLE user_information (Name VARCHAR(255), Email VARCHAR(255), Date VARCHAR(255), Session ID VARCHAR(255));" + sql = 'INSERT INTO user_data (Name, Email, Date, Session_ID) VALUES ("{}", "{}", "{}", "{}");'.format(name, email, date, session_id) + + mycursor.execute(sql) + + mydb.commit() + + print("Successful!") + +#if __name__ == "__main__": + #DataUpdate("siddharth", "siddharth@gmail.com") diff --git a/domain.yml b/domain.yml index 5771d9f..fc0c9b7 100644 --- a/domain.yml +++ b/domain.yml @@ -17,12 +17,24 @@ intents: - greet - goodbye - affirm - - deny - - mood_great - - mood_unhappy - bot_challenge - thanking - out_of_scope + - name + - email + - start + +# slots: +# name: +# type: text +# mappings: +# - type: from_text +# intent: name +# email: +# type: text +# mappings: +# - type: from_text +# intent: email responses: utter_eligible_A: @@ -35,7 +47,7 @@ responses: - title: "Know more about component B" payload: '/component_B' - title: "Know more about component C" - payload: '/component_C' + payload: '/component_C' utter_electricity: - text: "Power generated will be purchased by the local electricity distribution companies (Discoms)" @@ -156,7 +168,14 @@ responses: payload: '/component_C' utter_greet: - - text: "Hello there! What would you like to know about PM-KUSUM?" + - text: "Hii! Welcome to PM-KUSUM.\n \n Get started using our quick links or start conversation by entering your query." + buttons: + - title: "Information about component A" + payload: '/component_A' + - title: "Information about component B" + payload: '/component_B' + - title: "Who will purchase the generated electricity?" + payload: '/electricity' utter_goodbye: - text: "Have a nice day. Bye!" @@ -170,6 +189,15 @@ responses: utter_your_welcome: - text: "You're welcome!" + utter_name: + - text: "Enter your name: " + + utter_email: + - text: "Enter your email ID: " + +actions: + - action_submit + session_config: session_expiration_time: 60 - carry_over_slots_to_new_session: true \ No newline at end of file + carry_over_slots_to_new_session: False \ No newline at end of file diff --git a/endpoints.yml b/endpoints.yml index 1128e1d..d973280 100644 --- a/endpoints.yml +++ b/endpoints.yml @@ -10,8 +10,8 @@ # Server which runs your custom actions. # https://rasa.com/docs/rasa/custom-actions -#action_endpoint: -# url: "http://localhost:5055/webhook" +action_endpoint: + url: "http://localhost:5055/webhook" # Tracker store which is used to store the conversations. # By default the conversations are stored in memory. diff --git a/index.html b/index.html index 6535383..4b02a85 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,152 @@ +
+ + +