Skip to content
Snippets Groups Projects
Commit 060f9f1b authored by BerendF's avatar BerendF
Browse files

small improvements to frontend & training data

parent 41cacedd
No related branches found
No related tags found
No related merge requests found
models/ models/
.rasa/
.rasa/cache/
results/
templates/typewriter.js
No preview for this file type
No preview for this file type
...@@ -14,7 +14,7 @@ class ActionRecommendCuisine(Action): ...@@ -14,7 +14,7 @@ class ActionRecommendCuisine(Action):
tracker: Tracker, tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
cuisines = ["Italian", "Chinese", "Mexican", "Indian", "French", "Japanese", "Thai", "Spanish", "Greek", "Turkish", "Moroccan", "Brazilian", "American", "Korean", "Vietnamese", "Ethiopian", "Russian", "Argentinian", "Lebanese", "German"] cuisines = ["Italian", "Chinese", "Mexican", "Indian", "French", "Japanese", "Thai", "Spanish", "Greek", "Turkish", "Moroccan", "American", "Korean", "Vietnamese", "Ethiopian", "Argentinian", "Lebanese", "German"]
recommended_cuisine = random.choice(cuisines) recommended_cuisine = random.choice(cuisines)
dispatcher.utter_message(text=f"I recommend you try {recommended_cuisine} cuisine!") dispatcher.utter_message(text=f"I recommend you try {recommended_cuisine} cuisine!")
...@@ -40,7 +40,10 @@ class ActionRecommendDish(Action): ...@@ -40,7 +40,10 @@ class ActionRecommendDish(Action):
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
if data['results']: if data['results']:
dishes = random.sample(data['results'], 2) filtered_dishes = [dish for dish in data['results'] if len(dish['title'].split()) <= 3]
if len(filtered_dishes) >= 2:
dishes = random.sample(filtered_dishes, 2)
dish_names = [dish['title'] for dish in dishes] dish_names = [dish['title'] for dish in dishes]
dispatcher.utter_message(text=f"How about trying: {dish_names[0]} or {dish_names[1]}?") dispatcher.utter_message(text=f"How about trying: {dish_names[0]} or {dish_names[1]}?")
else: else:
...@@ -191,7 +194,7 @@ class ActionCostBreakdown(Action): ...@@ -191,7 +194,7 @@ class ActionCostBreakdown(Action):
if cost_response.status_code == 200: if cost_response.status_code == 200:
cost_data = cost_response.json() cost_data = cost_response.json()
cost_info = f"Total cost: {cost_data['totalCost']}, Cost per serving: {cost_data['costPerServing']}" cost_info = f"Total cost: {str(round(cost_data['totalCost']/100.0, 2))} $, Cost per serving: {str(round(cost_data['totalCostPerServing']/100.0, 2))} $"
dispatcher.utter_message(text=f"Here is the cost breakdown for {dish}: {cost_info}") dispatcher.utter_message(text=f"Here is the cost breakdown for {dish}: {cost_info}")
else: else:
dispatcher.utter_message(text="Sorry, I couldn't retrieve the cost breakdown at the moment.") dispatcher.utter_message(text="Sorry, I couldn't retrieve the cost breakdown at the moment.")
......
...@@ -10,32 +10,35 @@ assistant_id: 20240528-105235-obliging-death ...@@ -10,32 +10,35 @@ assistant_id: 20240528-105235-obliging-death
# https://rasa.com/docs/rasa/nlu/components/ # https://rasa.com/docs/rasa/nlu/components/
language: en language: en
pipeline: null pipeline:
# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model. # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# # If you'd like to customize it, uncomment and adjust the pipeline. # If you'd like to customize it, uncomment and adjust the pipeline.
# # See https://rasa.com/docs/rasa/tuning-your-model for more information. # See https://rasa.com/docs/rasa/tuning-your-model for more information.
# - name: WhitespaceTokenizer - name: WhitespaceTokenizer
# - name: RegexFeaturizer - name: RegexFeaturizer
# - name: LexicalSyntacticFeaturizer use_lookup_tables: True
# - name: CountVectorsFeaturizer use_regexes: True
# - name: CountVectorsFeaturizer # - name: RegexEntityExtractor
# analyzer: char_wb # case_sensitive: False
# min_ngram: 1 - name: LexicalSyntacticFeaturizer
# max_ngram: 4 - name: CountVectorsFeaturizer
# - name: DIETClassifier - name: CountVectorsFeaturizer
# epochs: 100 analyzer: char_wb
# constrain_similarities: true min_ngram: 1
# - name: EntitySynonymMapper max_ngram: 4
# - name: ResponseSelector - name: DIETClassifier
# epochs: 100 epochs: 100
# constrain_similarities: true constrain_similarities: true
# - name: FallbackClassifier - name: EntitySynonymMapper
# threshold: 0.3 - name: ResponseSelector
# ambiguity_threshold: 0.1 epochs: 100
- name: FallbackClassifier
threshold: 0.3
ambiguity_threshold: 0.1
# Configuration for Rasa Core. # Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/ # https://rasa.com/docs/rasa/core/policies/
policies: null policies:
# # No configuration for policies was provided. The following default policies were used to train your model. # # No configuration for policies was provided. The following default policies were used to train your model.
# # If you'd like to customize them, uncomment and adjust the policies. # # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information. # # See https://rasa.com/docs/rasa/policies for more information.
......
...@@ -7,6 +7,44 @@ nlu: ...@@ -7,6 +7,44 @@ nlu:
- Hey - Hey
- Hi there - Hi there
- Hello there - Hello there
- Hey there
- Good morning
- Good afternoon
- Good evening
- Hiya
- What's up?
- Greetings
- Howdy
- Yo
- intent: insult
examples: |
- idiot
- fuck you
- moron
- go to hell
- jerk
- dumbass
- loser
- shut up
- worthless
- you suck
- fool
- intent: ask_capability
examples: |
- What can you do?
- what are your capabilities?
- What are you able to do?
- Can you tell me your features?
- What skills do you have?
- What services do you offer?
- Can you list your functionalities?
- How can you assist me?
- What help can you provide?
- What kind of support do you give?
- What tasks can you perform?
- What can you assist with?
- intent: ask_cuisine_recommendation - intent: ask_cuisine_recommendation
examples: | examples: |
...@@ -14,6 +52,18 @@ nlu: ...@@ -14,6 +52,18 @@ nlu:
- What cuisine should I cook today? - What cuisine should I cook today?
- Suggest a cuisine for dinner - Suggest a cuisine for dinner
- Recommend something - Recommend something
- Suggest something
- Can you suggest a type of cuisine?
- I need a cuisine recommendation
- What's a good cuisine to try?
- Which cuisine should I go for today?
- Help me choose a cuisine
- Any cuisine suggestions?
- Recommend a type of food
- What cuisine is good for dinner?
- What's a good cuisine for lunch?
- Can you suggest something to eat?
- intent: ask_dish_recommendation - intent: ask_dish_recommendation
examples: | examples: |
...@@ -46,6 +96,14 @@ nlu: ...@@ -46,6 +96,14 @@ nlu:
- Suggest a dish from [Thai](cuisine_type) cuisine - Suggest a dish from [Thai](cuisine_type) cuisine
- Suggest a dish from [Vietnamese](cuisine_type) cuisine - Suggest a dish from [Vietnamese](cuisine_type) cuisine
- What are some [Southern](cuisine_type) dishes - What are some [Southern](cuisine_type) dishes
- Suggest a dish from [Indian](cuisine_type) cuisine
- What should I cook from [Japanese](cuisine_type) cuisine?
- Recommend a dish from [Thai](cuisine_type) cuisine
- What's a traditional dish from [Mexican](cuisine_type) cuisine?
- Suggest a popular dish from [French](cuisine_type) cuisine
- What should I make from [Greek](cuisine_type) cuisine?
- Name a dish from [Spanish](cuisine_type) cuisine
- Suggest something from [Mediterranean](cuisine_type) cuisine
- intent: ask_recipe_steps - intent: ask_recipe_steps
examples: | examples: |
...@@ -63,6 +121,16 @@ nlu: ...@@ -63,6 +121,16 @@ nlu:
- What are the steps to make [Layered Greek Salad](dish_name)? - What are the steps to make [Layered Greek Salad](dish_name)?
- I want to cook [Beef Wellington](dish_name) - I want to cook [Beef Wellington](dish_name)
- How to make [Eggs Benedict](dish_name)? - How to make [Eggs Benedict](dish_name)?
- Can you walk me through making [Pizza](dish_name)?
- What's the recipe for [Lasagna](dish_name)?
- How do I cook [Ramen](dish_name)?
- Give me the steps to make [Paella](dish_name)
- I need the recipe for [Tacos](dish_name)
- How do I prepare [Goulash](dish_name)?
- What are the instructions to make [Chili](dish_name)?
- Can you tell me how to cook [Biryani](dish_name)?
- What are the steps for [Enchiladas](dish_name)?
- How to make [Risotto](dish_name)?
- intent: ask_nutrition_analysis - intent: ask_nutrition_analysis
examples: | examples: |
...@@ -70,6 +138,16 @@ nlu: ...@@ -70,6 +138,16 @@ nlu:
- Can you give me the nutrition facts for [Sushi](dish_name)? - Can you give me the nutrition facts for [Sushi](dish_name)?
- I need the nutrition information for [Pho](dish_name) - I need the nutrition information for [Pho](dish_name)
- What are the calories in [Biryani](dish_name)? - What are the calories in [Biryani](dish_name)?
- What's the calorie count for [Pizza](dish_name)?
- Can you tell me the nutritional content of [Sushi](dish_name)?
- I need the nutrition facts for [Pho](dish_name)
- What are the carbs in [Biryani](dish_name)?
- How many calories are in [Pad Thai](dish_name)?
- What's the fat content of [Burger](dish_name)?
- Can you provide the protein information for [Salad](dish_name)?
- What's the fiber content in [Soup](dish_name)?
- How many sugars are in [Pasta](dish_name)?
- Give me the nutrition breakdown for [Steak](dish_name)
- intent: ask_cost_breakdown - intent: ask_cost_breakdown
examples: | examples: |
...@@ -77,6 +155,17 @@ nlu: ...@@ -77,6 +155,17 @@ nlu:
- Can you give me the cost analysis for [Sushi](dish_name)? - Can you give me the cost analysis for [Sushi](dish_name)?
- I need the cost information for [Pho](dish_name) - I need the cost information for [Pho](dish_name)
- What are the costs for [Biryani](dish_name)? - What are the costs for [Biryani](dish_name)?
- How much does this cost?
- How much will [Pizza](dish_name) cost to make?
- What's the price breakdown for [Sushi](dish_name)?
- Can you tell me the cost of making [Pho](dish_name)?
- What are the expenses for [Biryani](dish_name)?
- How much does it cost to cook [Pad Thai](dish_name)?
- What's the cost analysis for [Burger](dish_name)?
- How much will it be to prepare [Salad](dish_name)?
- Can you give me the cost details for [Soup](dish_name)?
- What's the price estimate for [Pasta](dish_name)?
- What's the financial breakdown for [Steak](dish_name)?
- intent: ask_cooking_tips - intent: ask_cooking_tips
examples: | examples: |
...@@ -84,6 +173,18 @@ nlu: ...@@ -84,6 +173,18 @@ nlu:
- Do you have any cooking tips for [Sushi](dish_name)? - Do you have any cooking tips for [Sushi](dish_name)?
- I need some cooking tips for [Pho](dish_name) - I need some cooking tips for [Pho](dish_name)
- What are the best tips for cooking [Biryani](dish_name)? - What are the best tips for cooking [Biryani](dish_name)?
- Any Tips for [Pad Thai](dish_name)?
- Any advice for cooking [Pizza](dish_name)?
- Can you share cooking tips for [Sushi](dish_name)?
- I need some advice for making [Pho](dish_name)
- What are some tips for cooking [Biryani](dish_name)?
- Do you have any tricks for [Pad Thai](dish_name)?
- What's the best way to cook [Burger](dish_name)?
- Any special tips for preparing [Salad](dish_name)?
- How can I improve my [Soup](dish_name)?
- What are the best methods for making [Pasta](dish_name)?
- Do you have any suggestions for [Steak](dish_name)?
- intent: ask_related_recipes - intent: ask_related_recipes
examples: | examples: |
...@@ -91,12 +192,35 @@ nlu: ...@@ -91,12 +192,35 @@ nlu:
- Can you give me some recipes similar to [Sushi](dish_name)? - Can you give me some recipes similar to [Sushi](dish_name)?
- I need some related recipes for [Pho](dish_name) - I need some related recipes for [Pho](dish_name)
- What are some recipes similar to [Biryani](dish_name)? - What are some recipes similar to [Biryani](dish_name)?
- What are some similar recipes to this one?
- What other recipes are similar to [Pizza](dish_name)?
- Can you suggest some recipes like [Sushi](dish_name)?
- I need more recipes like [Pho](dish_name)
- What are some dishes similar to [Biryani](dish_name)?
- What other recipes are like [Pad Thai](dish_name)?
- Can you provide related recipes to [Burger](dish_name)?
- I want similar recipes to [Salad](dish_name)
- What dishes are related to [Soup](dish_name)?
- Suggest recipes that are like [Pasta](dish_name)
- What recipes are similar to [Steak](dish_name)?
- intent: ask_show_picture - intent: ask_show_picture
examples: | examples: |
- Can you show me pictures? - Can you show me pictures?
- I want to see pictures of the dish - I want to see pictures of the dish
- Show me pictures of [Pizza](dish_name) - Show me pictures of [Pizza](dish_name)
- pics for [](dish_name)
- What does [](dish_name) look like?
- Can you show me a picture of [Pizza](dish_name)?
- I'd like to see a photo of [Sushi](dish_name)
- Show me an image of [Pho](dish_name)
- Do you have pictures of [Biryani](dish_name)?
- Can you display pictures of [Pad Thai](dish_name)?
- What does [Burger](dish_name) look like?
- Show me a picture of [Salad](dish_name)
- I want to see [Soup](dish_name)
- Can I see photos of [Pasta](dish_name)?
- Do you have images of [Steak](dish_name)?
- intent: goodbye - intent: goodbye
examples: | examples: |
...@@ -104,6 +228,16 @@ nlu: ...@@ -104,6 +228,16 @@ nlu:
- Bye - Bye
- See you later - See you later
- Bye bye - Bye bye
- See you
- Take care
- Farewell
- Have a good day
- Catch you later
- Peace out
- Later
- Bye for now
- Talk to you later
- See you soon
- intent: thanks - intent: thanks
examples: | examples: |
...@@ -111,6 +245,14 @@ nlu: ...@@ -111,6 +245,14 @@ nlu:
- Thank you - Thank you
- Thanks a lot - Thanks a lot
- I appreciate it - I appreciate it
- I appreciate your help
- Much appreciated
- You're the best
- Thanks a million
- Thanks a bunch
- Many thanks
- I owe you one
- Grateful for your help
- intent: affirm - intent: affirm
examples: | examples: |
...@@ -118,18 +260,59 @@ nlu: ...@@ -118,18 +260,59 @@ nlu:
- Sure - Sure
- Absolutely - Absolutely
- Of course - Of course
- Definitely
- Without a doubt
- For sure
- Yup
- Totally
- Absolutely right
- I agree
- That's correct
- Sure thing
- Indeed
- intent: deny - intent: deny
examples: | examples: |
- No - No
- No thanks - No thanks
- Not really - Not really
- ew
- Ew
- Not at all
- No way
- Not interested
- Nah
- Nope
- Not happening
- I disagree
- Not for me
- No chance
- Certainly not
- intent: smalltalk - intent: smalltalk
examples: | examples: |
- How are you? - How are you?
- How are you doing?
- What are you doing? - What are you doing?
- Tell me something about yourself - Tell me something about yourself
- Do you have any hobbies?
- How was your day? - How was your day?
- What's your favorite food? - What's your favorite food?
- Do you enjoy cooking?
- What's up?
- How's everything?
- How's it going?
- What's new?
- How's life?
- How are you feeling?
- What's the latest?
- What's going on?
- What have you been up to?
- Any plans for today?
- lookup: dish_name
examples: |
- Salmon Quinoa Risotto
- Chipotle Chili
- Vegetable Minestrone Soup
- vegetable minestrone soup
- Italian Tuna Pasta
version: "3.1" version: "3.1"
rules: rules:
- rule:
steps:
- intent: insult
- action: utter_capability
...@@ -5,6 +5,12 @@ stories: ...@@ -5,6 +5,12 @@ stories:
- intent: greet - intent: greet
- action: utter_greet - action: utter_greet
- story: capabilities
steps:
- intent: ask_capability
- action: utter_capability
- action: utter_capability
- story: recommend cuisine - story: recommend cuisine
steps: steps:
- intent: ask_cuisine_recommendation - intent: ask_cuisine_recommendation
...@@ -21,7 +27,7 @@ stories: ...@@ -21,7 +27,7 @@ stories:
steps: steps:
- intent: ask_recipe_steps - intent: ask_recipe_steps
- slot_was_set: - slot_was_set:
- dish_name: "Green Curry" - dish_name: "Pizza"
- action: action_provide_recipe_steps - action: action_provide_recipe_steps
- story: show picture - story: show picture
......
...@@ -15,6 +15,7 @@ intents: ...@@ -15,6 +15,7 @@ intents:
- affirm - affirm
- deny - deny
- smalltalk - smalltalk
- ask_capability
entities: entities:
- cuisine_type - cuisine_type
...@@ -68,23 +69,13 @@ responses: ...@@ -68,23 +69,13 @@ responses:
- text: "Okay. I'm here if you have any other questions." - text: "Okay. I'm here if you have any other questions."
- text: "Understood. If you need more help, just let me know." - text: "Understood. If you need more help, just let me know."
utter_default:
- text: "I'm sorry, I didn't understand that. Can you please rephrase?"
utter_smalltalk: utter_smalltalk:
- text: "That sounds interesting! Tell me more." - text: "That sounds interesting! Tell me more."
- text: "Oh, that's nice to hear!" - text: "Oh, that's nice to hear!"
- text: "Sounds good! What else do you have planned?" - text: "Sounds good! What else do you have planned?"
utter_ask_cuisine_recommendation: utter_capability:
- text: "I recommend you try {cuisine_type} cuisine. Have you ever tried {dish_name}? It's delicious!" - text: I can give you cuisine recommendations.
- text: "How about {cuisine_type} cuisine? {dish_name} is an excellent dish you should try." - text: I know some recipes if you need any guidance!
- text: "Why not try {cuisine_type} cuisine? Especially {dish_name}, which is highly recommended." - text: I could tell you any info that you might need on recipes from Spooncular.
utter_ask_dish_recommendation:
- text: "How about trying {dish_name1} or {dish_name2}?"
- text: "I suggest you try {dish_name1} or {dish_name2}."
- text: "Have you tried {dish_name1} or {dish_name2}? Both are very tasty."
\ No newline at end of file
utter_show_picture:
- text: "Here are pictures of {dish_name}."
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
</head> </head>
<body> <body>
<div id="content-container"> <div id="content-container">
<div id="header">About Rasa Chatbot</div> <div id="header">About My Rasa Chatbot</div>
<p>Welcome to the Rasa Chatbot! This bot is designed to assist you with various tasks and answer your questions. It uses natural language processing to understand and respond to your queries in real-time.</p> <p>Welcome to my Rasa Chatbot! This bot is designed to provide you with various recipes and suggest cuisines. It can give you detailed information on these recipes and can also give you cost breakdowns as well as show pictures of the recipes.</p>
<div id="footer"> <div id="footer">
<a href="/">Home</a> <a href="/">Home</a>
<a href="/about">About</a> <a href="/about">About</a>
......
...@@ -51,10 +51,10 @@ ...@@ -51,10 +51,10 @@
</head> </head>
<body> <body>
<div id="content-container"> <div id="content-container">
<div id="header">Contact Rasa Chatbot</div> <div id="header">Recipe Chatbot based on RASA</div>
<p>If you have any questions or need further assistance, please feel free to reach out to us.</p> <p>Made By Berend Fuchs</p>
<p>Email: support@rasabot.com</p> <p>Email: berend.fuchs@student.reutlingen-university.de</p>
<p>Phone: +1 234 567 890</p> <p>814080</p>
<div id="footer"> <div id="footer">
<a href="/">Home</a> <a href="/">Home</a>
<a href="/about">About</a> <a href="/about">About</a>
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</style> </style>
</head><body> </head><body>
<div id="chat-container"> <div id="chat-container">
<div id="header">Rasa Chatbot</div> <div id="header">Chatbot</div>
<div id="chat-box"></div> <div id="chat-box"></div>
<div id="input-box"> <div id="input-box">
<input type="text" id="user-input" placeholder="Type your message here..."> <input type="text" id="user-input" placeholder="Type your message here...">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment