-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2510640
commit 4609397
Showing
3 changed files
with
221 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/chatbot.ipynb. | ||
|
||
# %% auto 0 | ||
__all__ = ['ChatBot'] | ||
|
||
# %% ../nbs/chatbot.ipynb 1 | ||
import ipywidgets as widgets | ||
from ipywidgets import Textarea, Text, Layout, HBox | ||
|
||
# %% ../nbs/chatbot.ipynb 2 | ||
class ChatBot(widgets.VBox): | ||
|
||
def __init__(self): | ||
# If you forget to call the superconstructor on an extended widget | ||
# you will get an AttributeError: object has no attribute '_model_id' | ||
super().__init__() | ||
|
||
example_convo = ''' | ||
User: Hello, bot! | ||
Bot: Hi there! How can I assist you today? | ||
User: I need help setting up my email account. Can you guide me through the process? | ||
Bot: Of course! Could you please provide me with the email service provider you're using? | ||
User: I use Gmail. | ||
Bot: Great! First, go to the Gmail website and click on the "Create account" button. | ||
User: Okay, I'm there. What's next? | ||
Bot: Enter your personal information such as your name, desired email address, password, and recovery information. | ||
User: Done! What's next? | ||
Bot: Follow the prompts to verify your phone number and agree to the terms of service. | ||
User: All set! Thank you for your help, bot! | ||
Bot: You're welcome! If you have any more questions, feel free to ask. | ||
''' | ||
self.chat = Textarea( | ||
disabled = True, | ||
value = example_convo, | ||
layout=Layout(width='90%', height='400px') | ||
) | ||
self.user_input_and_submit = HBox() | ||
self.user_input = widgets.Text( | ||
placeholder='Message AI chatbot...', | ||
#layout=Layout(width='100%') | ||
) | ||
self.submit = widgets.ToggleButton( | ||
value=False, | ||
disabled=False, | ||
button_style='success', | ||
icon='arrow-circle-right' | ||
) | ||
self.user_input_and_submit.children = (self.user_input, self.submit) | ||
|
||
self.suggestion_buttons = HBox() | ||
self.step_by_step = widgets.Button( | ||
description='Step-by-Step', | ||
button_style='info', | ||
tooltip='Description', | ||
) | ||
self.metaphor = widgets.Button( | ||
description='Metaphor', | ||
button_style='info', | ||
tooltip='Description', | ||
) | ||
self.hints = widgets.Button( | ||
description='Hints', | ||
button_style='info', | ||
tooltip='Description', | ||
) | ||
self.guided_questions = widgets.Button( | ||
description='AI Guided Questions', | ||
button_style='info', | ||
tooltip='Description', | ||
) | ||
self.suggestion_buttons.children = (self.step_by_step, self.metaphor, self.hints, self.guided_questions) | ||
self.children = (self.chat, self.suggestion_buttons, self.user_input_and_submit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "8e116d25-0170-4b10-ba20-9524e85ea507", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#| default_exp chatbot" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a5b60d64-4066-4398-b6b2-bcc0431a565d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#| export\n", | ||
"import ipywidgets as widgets\n", | ||
"from ipywidgets import Textarea, Text, Layout, HBox" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "db5c215f-b20b-4df4-9f5f-ad1bfdb9c64b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#| export\n", | ||
"\n", | ||
"class ChatBot(widgets.VBox):\n", | ||
" \n", | ||
" def __init__(self):\n", | ||
" # If you forget to call the superconstructor on an extended widget\n", | ||
" # you will get an AttributeError: object has no attribute '_model_id'\n", | ||
" super().__init__()\n", | ||
"\n", | ||
" example_convo = '''\n", | ||
"User: Hello, bot!\n", | ||
"\n", | ||
"Bot: Hi there! How can I assist you today?\n", | ||
"\n", | ||
"User: I need help setting up my email account. Can you guide me through the process?\n", | ||
"\n", | ||
"Bot: Of course! Could you please provide me with the email service provider you're using?\n", | ||
"\n", | ||
"User: I use Gmail.\n", | ||
"\n", | ||
"Bot: Great! First, go to the Gmail website and click on the \"Create account\" button.\n", | ||
"\n", | ||
"User: Okay, I'm there. What's next?\n", | ||
"\n", | ||
"Bot: Enter your personal information such as your name, desired email address, password, and recovery information.\n", | ||
"\n", | ||
"User: Done! What's next?\n", | ||
"\n", | ||
"Bot: Follow the prompts to verify your phone number and agree to the terms of service.\n", | ||
"\n", | ||
"User: All set! Thank you for your help, bot!\n", | ||
"\n", | ||
"Bot: You're welcome! If you have any more questions, feel free to ask.\n", | ||
"'''\n", | ||
" self.chat = Textarea(\n", | ||
" disabled = True,\n", | ||
" value = example_convo,\n", | ||
" layout=Layout(width='90%', height='400px')\n", | ||
" )\n", | ||
" self.user_input_and_submit = HBox()\n", | ||
" self.user_input = widgets.Text(\n", | ||
" placeholder='Message AI chatbot...',\n", | ||
" #layout=Layout(width='100%')\n", | ||
" )\n", | ||
" self.submit = widgets.ToggleButton(\n", | ||
" value=False,\n", | ||
" disabled=False,\n", | ||
" button_style='success',\n", | ||
" icon='arrow-circle-right' \n", | ||
" )\n", | ||
" self.user_input_and_submit.children = (self.user_input, self.submit)\n", | ||
"\n", | ||
" self.suggestion_buttons = HBox()\n", | ||
" self.step_by_step = widgets.Button(\n", | ||
" description='Step-by-Step',\n", | ||
" button_style='info',\n", | ||
" tooltip='Description',\n", | ||
" )\n", | ||
" self.metaphor = widgets.Button(\n", | ||
" description='Metaphor',\n", | ||
" button_style='info',\n", | ||
" tooltip='Description',\n", | ||
" )\n", | ||
" self.hints = widgets.Button(\n", | ||
" description='Hints',\n", | ||
" button_style='info',\n", | ||
" tooltip='Description',\n", | ||
" )\n", | ||
" self.guided_questions = widgets.Button(\n", | ||
" description='AI Guided Questions',\n", | ||
" button_style='info',\n", | ||
" tooltip='Description', \n", | ||
" )\n", | ||
" self.suggestion_buttons.children = (self.step_by_step, self.metaphor, self.hints, self.guided_questions)\n", | ||
" self.children = (self.chat, self.suggestion_buttons, self.user_input_and_submit) " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4403118f-7766-43b2-bea5-7ebaa8021806", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"chatbot = ChatBot()\n", | ||
"chatbot" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "acf72e11-5e48-40cf-a1fc-89f2f201aaac", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "python3", | ||
"language": "python", | ||
"name": "python3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file was deleted.
Oops, something went wrong.