diff --git a/src/aichat/chatapp/Export.csv b/src/aichat/chatapp/Export.csv index af51106..0b76d22 100644 --- a/src/aichat/chatapp/Export.csv +++ b/src/aichat/chatapp/Export.csv @@ -1,4 +1,144 @@ trigger,response,source_state,dest_state +call ? Aira|agent ? ? ?,,,Call Agent +call * Aira|agent *,,,Call Agent +call ? agent,,,Call Agent +cancel|stop,,Call Agent, +*," Sorry, I didn't get that.",Call Agent, +reset first boot experience,,*,Tutorial Start +*,"Welcome Explorer! I'm Chloe, your Aira AI assistant. I have three tips to share with you to help you get started. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" Would you like me to repeat that or continue?",Tutorial Start,Tutorial Setup +,"Welcome Explorer! I'm Chloe, your Aira AI assistant. I have three tips to share with you to help you get started. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" Would you like me to repeat that or continue?",Tutorial Start,Tutorial Setup +* continue|next *,"To call an agent, make sure that you've used the braided tether cord to connect the Horizon glasses to the Horizon phone. Then, you can either double press on the call button to call an agent, or hold down on the call button and say, ""call an agent."" Would you like me to repeat that or continue to my last tip?",Tutorial Setup,Tutorial Last Tip +*,"Sorry, I didn't get that. Would you like me to repeat that or continue?",Tutorial Setup,Tutorial Setup +* repeat *,"Sure. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" Would you like me to repeat that or continue?",Tutorial Setup,Tutorial Setup +* again *,"Sure. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" Would you like me to repeat that or continue?",Tutorial Setup,Tutorial Setup +* one more time *,"Sure. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" Would you like me to repeat that or continue?",Tutorial Setup,Tutorial Setup +* continue|next *,"For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Last Tip,Tutorial Done +*,"Sorry, I didn't get that. Would you like me to repeat that or continue to my last tip?",Tutorial Last Tip,Tutorial Last Tip +* repeat *,"Sure. To call an agent, make sure that you've used the braided tether cord to connect the Horizon glasses to the Horizon phone. Then, you can either double press on the call button to call an agent, or hold down on the call button and say, ""call an agent."" Would you like me to repeat that or continue to my last tip?",Tutorial Last Tip,Tutorial Last Tip +* again *,"Sure. To call an agent, make sure that you've used the braided tether cord to connect the Horizon glasses to the Horizon phone. Then, you can either double press on the call button to call an agent, or hold down on the call button and say, ""call an agent."" Would you like me to repeat that or continue to my last tip?",Tutorial Last Tip,Tutorial Last Tip +* one more time *,"Sure. To call an agent, make sure that you've used the braided tether cord to connect the Horizon glasses to the Horizon phone. Then, you can either double press on the call button to call an agent, or hold down on the call button and say, ""call an agent."" Would you like me to repeat that or continue to my last tip?",Tutorial Last Tip,Tutorial Last Tip +* no|skip|nah|nope|naw|dont *,Wonderful! Thank you for taking the time to talk to me today and I can't wait to see what's on the horizon for you.,Tutorial Done, +* no thanks|thank *,Wonderful! Thank you for taking the time to talk to me today and I can't wait to see what's on the horizon for you.,Tutorial Done, +Im good,Wonderful! Thank you for taking the time to talk to me today and I can't wait to see what's on the horizon for you.,Tutorial Done, +* continue|next *,Wonderful! Thank you for taking the time to talk to me today and I can't wait to see what's on the horizon for you.,Tutorial Done, +*,"Sorry, I wish I could understand that. It was probably something really nice.",Tutorial Done, +Thanks,You got it,Tutorial Done, +Thank you,It was my pleasure,Tutorial Done, +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,"Sure. For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Done,Tutorial Done +* repeat *,"Sure. For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Done,Tutorial Done +* again *,"Sure. For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Done,Tutorial Done +* one more time *,"Sure. For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Done,Tutorial Done +cancel|stop|done|exit|leave|goodbye|bye|enough|stop,OK. You can always hold down on the call button and ask me how to use the Horizon phone.,Tutorial *, +give|tell me a joke,"I own the world's worst thesaurus. Not only is it awful, it's awful.",, +give|tell me a joke,"Hypochondriacs always take things, literally.",, +give|tell me a joke,"I was going to tell a time traveling joke, but you didn't like it.",, +give|tell me a joke,"If your parachute doesn't deploy, you have the rest of your life to fix it.",, +give|tell me a joke,I just invented a new word: plagiarism.,, +give|tell me a joke,"Rest in peace, boiling water. You will be mist.",, +give|tell me a joke,I wonder if the guy who came up with the term 'One Hit Wonder' came up with any other phrases.,, +give|tell me a joke,"With the rise of self-driving vehicles, it’s only a matter of time before we get a country song where a guy’s truck leaves him too.",, +are you there,"Yes, I'm here for you.",, +stop,,, +? read document ? high quality ? ?,,, +? read ? ? continuous ? ?,,, +? read ? document,,, +read this,,, +read this document,,, +? read this ?,,, +read now,,, +where ? ? ? pill|pills|bottle|bottles|medicine|meds,,, +? ? read ? ? pill|pills|bottle|bottles|medicine|meds|label ? ?,,, +what ? ? ? pill|pills|bottle|bottles|medicine|meds ?,,, +detect pill|bottle,,, +what time is it|now ?,"It is {{now ""pattern"" ""hh:mm, z""}}",, +what date|day is it|today ?,"Today is {{now ""full""}}",, +what is the time,"It is {{now ""pattern"" ""hh:mm, z""}}",, +what is the time ? now|today,"It is {{now ""pattern"" ""hh:mm, z""}}",, +what is the time of the day,"It is {{now ""pattern"" ""hh:mm, z""}}",, +what ? ? time ? ? ?,"It is {{now ""pattern"" ""hh:mm, z""}}",, +? tell me what|the ? ? time ? ?,"It is {{now ""pattern"" ""hh:mm, z""}}",, +time,"It is {{now ""pattern"" ""hh:mm, z""}}",, +do you have the time,"It is {{now ""pattern"" ""hh:mm, z""}}",, +what day is today,"Today is {{now ""full""}}",, +what ? ? day|date,"Today is {{now ""full""}}",, +what ? ? today,"Today is {{now ""full""}}",, +day|date,"Today is {{now ""full""}}",, +turn ? ? flashlight ? ? on,,, +turn ? ? on ? ? flashlight,,, +turn ? ? flashlight ? ? off,,, +turn ? ? off ? ? flashlight,,, +is ? ? flashlight ? ? on|off|power|powered|deactivated|activated,flashlight is {{onoff flashlight_state}},, +what is the flashlight status|state|power|powered,flashlight is {{onoff flashlight_state}},, +? ? plan|minutes ? ?,,, +? ? plan|minutes ? ?,,, +? ? agent ? plan|minutes|minute ? ?,,, +how many agent call minutes|minute|time|hours do I have this month,,, +how many ? call minutes|minute|time|hours do I have left ? ?,,, +how much time|minutes|minute|hour|agent|call|calls do I have left ? ?,,, +how many minutes do I have left on my account,,, +what is my account balance,,, +? account balance ?,,, +? account ? remaining ?,,, +how many minutes do I have left|remaining|month,,, +what minutes do I have left|remaining|month,,, +how ? ? ? minute|minutes ? ? ? ?,,, +how many minute|minutes ? ? ? ?,,, +what version are we on,My version is {{version}},, +what version are you,My version is {{version}},, +what version ? ?,My version is {{version}},, +version,My version is {{version}},, +chloe version,My version is {{version}},, +version number,My version is {{version}},, +chloe version number,My version is {{version}},, +? on airplane ?,,, +? off airplane ?,,, +turn on video correction,,, +turn off video correction,,, +turn on image correction,,, +turn off image correction,,, +switch to the phone camera,,, +switch to the horizon phone camera,,, +start reading,,, +stop reading,,, +start looking,,, +stop looking,,, +shut down ?,,, +power off ?,,, +give|tell me a quote,Take care of your body. It's the only place you have to live.,, +give|tell me a quote,Failure is success if we learn from it.,, +give|tell me a quote,Never let schooling interfere with your education.,, +give|tell me a quote,Take care of your body. It's the only place you have to live.,, +give|tell me a quote,"quote,, This too shall pass,, end quote,, This is an ancient poet adage reflecting on the ephemeral nature of the human condition.",, +remind me {{note}},OK. I'll remind you {{note}},, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,Some analog clocks and watches have tactile faces that can be read by touch.,, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Bump dots are tactile stickers that can be placed on touchscreen interfaces like a refrigerator or microwave, as long as the screen doesn't dynamically change the location of buttons.",, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Your pharmacist can place braille labels on any medication, or if you prefer you can give the pharmacist bump dots to put on your medicine bottles according to your own labeling system.",, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,Never take a medicine that you aren't 100% sure of it's origin and usage or dosage. When in doubt call an Aira agent. Many medicine bottle labels can only be read accurately by a human.,, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Your pharmacist can place braille labels on any medication, or if you prefer you can give the pharmacist bump dots to put on your medicine bottles according to your own labeling system.",, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"If you have strong mobility skills, taking the stairs rather than the elevator at every opportunity can improve your long term health. If you prefer exercise machines you can play an interesting podcast or have Chloe read you a book while you work out.",, +what|how is my|this|a|the ? wifi|data|network|connectivity|internet,{{active_network_status}},, +what|how is my|this|a|the ? wife i,{{active_network_status}},, +what|how is my|this|a|the ? wi fi,{{active_network_status}},, +what's my|this|a|the ? wifi|data|network|connectivity|internet,{{active_network_status}},, +what's my|this|a|the ? wife i,{{active_network_status}},, +what's my|this|a|the ? wi fi,{{active_network_status}},, +how's my|this|a|the ? wifi|data|network|connectivity|internet,{{active_network_status}},, +how's my|this|a|the ? wife i,{{active_network_status}},, +how's my|this|a|the ? wi fi,{{active_network_status}},, +what wifi|data|network|connectivity|internet ? am|is ? connected ?,{{active_network_status}},, +what wifi|data|network|connectivity|internet ? am|is ? using,{{active_network_status}},, +what wifi|data|network|connectivity|internet do ? have,{{active_network_status}},, +what wife i ? am|is ? connected ?,{{active_network_status}},, +what wife i ? am|is ? using,{{active_network_status}},, +what wife i do ? have,{{active_network_status}},, +am I connected to ? wifi|data|network|connectivity|internet,{{active_network_status}},, +am I connected to ? cellular network,{{active_network_status}},, +am I connected to ? wife i,{{active_network_status}},, +what cellular network ? am|is ? connected ?,{{active_network_status}},, +what cellular network ? am|is ? using,{{active_network_status}},, +what cellular network do ? have,{{active_network_status}},, +test signal strength,{{active_network_status}},, +Tell me a riddle,What's black and white and red all over?,,riddle 1 1 * newspaper *,Perfect! Great job!,riddle 1 1, * newspaper *,Excellent! You must've heard that one before.,riddle 1 1, * answer *,"It's a newspaper! See? The word red is spelled R, E, A, D!",riddle 1 1, @@ -34,3 +174,268 @@ Tell me a riddle,"What starts with an E, ends with an E, and has one letter in i * another,Ok. Sure. Here you go. What... is the air-speed velocity of an unladen swallow?,riddle 3 1,riddle 2 1 * another one|riddle,Ok. What's black and white and red all over?,riddle 3 1,riddle 1 1 * another one|riddle,Ok. Sure. Here you go. What... is the air-speed velocity of an unladen swallow?,riddle 3 1,riddle 2 1 +reset first boot experience,,*,Tutorial Start +*,"Welcome Explorer! I'm Chloe, your Aira assistant. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" + Would you like me to repeat that or continue?",Tutorial Start,Tutorial Setup +,"Welcome Explorer! I'm Chloe, your Aira assistant. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" + Would you like me to repeat that or continue?",Tutorial Start,Tutorial Setup +* continue|next *,"To call an agent, make sure that you've used the braided USB cord to connect the Horizon glasses to the Horizon phone. Then, you can either double press on the call button to call an agent, or hold down on the call button and say, ""call an agent."" Would you like me to repeat that or continue to my last tip?",Tutorial Setup,Tutorial Last Tip +*,"Sorry, I didn't get that. Would you like me to repeat that or continue?",Tutorial Setup,Tutorial Setup +* repeat *,"Sure. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" Would you like me to repeat that or continue?",Tutorial Setup,Tutorial Setup +* again *,"Sure. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" Would you like me to repeat that or continue?",Tutorial Setup,Tutorial Setup +* one more time *,"Sure. The screen on the phone you're holding is disabled to create a voice first experience. To talk to me, you can hold down on the call button located below the screen, and say things like, ""how do I use Horizon?"" or ""what can you do?"" Would you like me to repeat that or continue?",Tutorial Setup,Tutorial Setup +* continue|next *,"For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Last Tip,Tutorial Done +*,"Sorry, I didn't get that. Would you like me to repeat that or continue to my last tip?",Tutorial Last Tip,Tutorial Last Tip +* repeat *,"Sure. To call an agent, make sure that you've used the braided USB cord to connect the Horizon glasses to the Horizon phone. Then, you can either double press on the call button to call an agent, or hold down on the call button and say, ""call an agent."" Would you like me to repeat that or continue to my last tip?",Tutorial Last Tip,Tutorial Last Tip +* again *,"Sure. To call an agent, make sure that you've used the braided USB cord to connect the Horizon glasses to the Horizon phone. Then, you can either double press on the call button to call an agent, or hold down on the call button and say, ""call an agent."" Would you like me to repeat that or continue to my last tip?",Tutorial Last Tip,Tutorial Last Tip +* one more time *,"Sure. To call an agent, make sure that you've used the braided USB cord to connect the Horizon glasses to the Horizon phone. Then, you can either double press on the call button to call an agent, or hold down on the call button and say, ""call an agent."" Would you like me to repeat that or continue to my last tip?",Tutorial Last Tip,Tutorial Last Tip +* no|skip|nah|nope|naw|dont *,Wonderful! Thank you for taking the time to talk to me today and I can't wait to see what's on the horizon for you.,Tutorial Done, +* no thanks|thank *,Wonderful! Thank you for taking the time to talk to me today and I can't wait to see what's on the horizon for you.,Tutorial Done, +Im good,Wonderful! Thank you for taking the time to talk to me today and I can't wait to see what's on the horizon for you.,Tutorial Done, +* continue|next *,Wonderful! Thank you for taking the time to talk to me today and I can't wait to see what's on the horizon for you.,Tutorial Done, +*,"Sorry, I wish I could understand that. It was probably something really nice.",Tutorial Done, +Thanks,You got it,Tutorial Done, +Thank you,It was my pleasure,Tutorial Done, +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,"Sure. For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Done,Tutorial Done +* repeat *,"Sure. For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Done,Tutorial Done +* again *,"Sure. For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Done,Tutorial Done +* one more time *,"Sure. For more details about Horizon, please read the Quick Start Guide in your welcome email, it includes tips such as turning on privacy mode during a call by pressing on the call button once. Would you like me to repeat that?",Tutorial Done,Tutorial Done +cancel|stop|done|exit|leave|goodbye|bye|enough,OK. You can always hold down on the call button and ask me how to use the Horizon phone.,Tutorial *, +what's new,Chloe now supports enabling or disabling Wi-Fi on the fly.,, +what is new,Chloe now supports enabling or disabling Wi-Fi on the fly.,, +what's new in this release|update,Chloe now supports enabling or disabling Wi-Fi on the fly.,, +what is new in this release|update,Chloe now supports enabling or disabling Wi-Fi on the fly.,, +read ? ? release notes,Chloe now supports enabling or disabling Wi-Fi on the fly.,, +read ? ? release notes ? 27,"version 27 adds 1 feature and 4 bug fixes. Feature 1, MQTT remote agent call initiation. Bug fix 1, remove deprecated calls of `onSpeechError`. Bug fix 2 Gradle build script cleanup and library version correction. Bug fix 3, Open source Android Speech library compiled to AAR and removed from source tree. Bug fix 4, build documentation and notes added.",, +read ? ? release notes ? 34,version 34 adds Network connectivity bug fixes and templating language for Chloe utterance building.,, +read ? ? release notes ? 35,"You can now ask Chloe to record a note, but she isn't yet able to search or list those notes. Also, bluetooth connection dialog and agent dashboard connectivity is now more robust.",, +read ? ? release notes ? 36,More robust connection to the agent,, +read ? ? release notes ? 37,"on version 37 I can now share your signal strength status. You can say, How is my connectivity? or What network am I connected to? Additionally, Aira has made Horizon connectivity improvements in this release, and will continue to make progress on the bluetooth and document reading features. Thank you for tuning in today!",, +read ? ? release notes ? 38,Speaker mode and bluetooth improvements.,, +read ? ? release notes ? 39,"Improved robustness of the app, automatic restarting on unexpected errors.",, +read ? ? release notes ? 40,"Added Samsung KNOX support, text recognition with the phone's camera. Chloe now supports proximity-based reading.",, +read ? ? release notes ? 41,Chloe now supports enabling or disabling Wi-Fi on the fly.,, +*,"Sorry, I don't know that. You can ask me what I can do any time.",, +*,"Sorry, I haven't learned that yet. Thanks for being patient with me.",, +*,"Sorry, I don't know that.",, +*,"Sorry, I didn't get that.",, +,"Sorry, I didn't hear you.",, +,"Sorry, I didn't hear you. You can ask me what I can do any time.",, +Are you there?,"Yes, I'm here for you.",, +Are you there?,"Yes, I'm ready to help.",, +hi|hello|hey|howdy|yo|sup,Hello! It's good to hear from you.,, +hi|hello|hey|howdy|yo|sup,Hi! I'm listening.,, +hi|hello|hey|howdy|yo|sup,"Hi, how can I help you?",, +hi|hello|hey|howdy|yo|sup *,Hello! It's good to hear from you.,, +hi|hello|hey|howdy|yo|sup *,Hi! I'm listening.,, +hi|hello|hey|howdy|yo|sup *,"Hi, how can I help you?",, +help,"You can ask me to call an agent, or dial customer support at 858 876 2472",, +"Testing 1, 2, 3","4,5,6",, +"Testing 1, 2, 3",Ok. What now?,, +* nevermind,OK,, +battery level,"Battery {{#with battery}}{{numberFormat level ""integer""}} percent. {{#if charging}} Charging on {{chargeType}} {{/if}}{{/with}}",, +what|how is my|the|this battery ?,"Battery {{#with battery}}{{numberFormat level ""integer""}} percent. {{#if charging}} Charging on {{chargeType}} {{/if}}{{/with}}",, +what's my|the|this battery ?,"Battery {{#with battery}}{{numberFormat level ""integer""}} percent. {{#if charging}} Charging on {{chargeType}} {{/if}}{{/with}}",, +how's my|the|this battery ?,"Battery {{#with battery}}{{numberFormat level ""integer""}} percent. {{#if charging}} Charging on {{chargeType}} {{/if}}{{/with}}",, +how much battery do I have ?,"Battery {{#with battery}}{{numberFormat level ""integer""}} percent. {{#if charging}} Charging on {{chargeType}} {{/if}}{{/with}}",, +how much battery ? ?,"Battery {{#with battery}}{{numberFormat level ""integer""}} percent. {{#if charging}} Charging on {{chargeType}} {{/if}}{{/with}}",, +check my|the|this battery ? ,"Battery {{#with battery}}{{numberFormat level ""integer""}} percent. {{#if charging}} Charging on {{chargeType}} {{/if}}{{/with}}",, +connect|find|look ? ? device|devices|headset|headsets|earphone|earphones|earbud|earbuds,,,Bluetooth connecting headset +connect|find|look ? ? bluetooth|wireless device|devices|headset|headsets|earphone|earphones|earbud|earbuds,,,Bluetooth connecting headset +connect|find|look ? ? headset|headsets|earphone|earphones|earbud|earbuds|device|devices,,Bluetooth connecting ?,Bluetooth connecting headset +connect|find|look ? ? bluetooth|wireless headset|headsets|earphone|earphones|earbud|earbuds|device|devices,,Bluetooth connecting ?,Bluetooth connecting headset +connect|find|look ? ? headset|headsets|earphone|earphones|earbud|earbuds|device|devices,,Bluetooth ?,Bluetooth connecting headset +connect|find|look ? ? bluetooth|wireless headset|headsets|earphone|earphones|earbud|earbuds|device|devices,,Bluetooth ?,Bluetooth connecting headset +connect|find|look ? ? speaker|speakers|tv|tvs,,,Bluetooth connecting speaker +connect|find|look ? ? wireless|bluetooth ? speaker|speakers|tv|tvs,,,Bluetooth connecting speaker +connect|find|look ? ? speaker|speakers|tv|tvs,,Bluetooth connecting ?,Bluetooth connecting speaker +connect|find|look ? ? wireless|bluetooth ? speaker|speakers|tv|tvs,,Bluetooth connecting ?,Bluetooth connecting speaker +connect|find|look ? ? speaker|speakers|tv|tvs,,Bluetooth ?,Bluetooth connecting speaker +connect|find|look ? ? wireless|bluetooth ? speaker|speakers|tv|tvs,,Bluetooth ?,Bluetooth connecting speaker +connect|find|look ? ? pair|paired|current ? bluetooth|device|devices|headphone|headphones|headset|headsets|earbud|earbuds|earphone|earphones,,,Bluetooth connecting paired +what bluetooth|device|devices|headphone|headphones|headset|headsets|earbud|earbuds|earphone|earphones ? pair|paired|connected,,, +connect|find|look ? ? pair|paired|current bluetooth|device|devices|headphone|headphones|headset|headsets|earbud|earbuds|earphone|earphones,,Bluetooth *,Bluetooth connecting paired +connect|find|look ? ? pair|paired|current bluetooth|wireless bluetooth|device|devices|headphone|headphones|headset|headsets|earbud|earbuds|earphone|earphones,,Bluetooth *,Bluetooth connecting paired +what ? ? bluetooth|device|devices|headphone|headphones|headset|headsets|earbud|earbuds|earphone|earphones ? pair|paired|connected,,Bluetooth *, +disconnect ? ? ? device|devices|speaker|speakers|tv|tvs|bluetooth|headset|earphone|earphones|headphone|headphones|earbud|earbuds ? ?,,,Bluetooth disconnect +disconnect ? ? ? device|devices|speaker|speakers|tv|tvs|bluetooth|headset|earphone|earphones|headphone|headphones|earbud|earbuds ? ?,,Bluetooth *,Bluetooth disconnect +? ? turn on ? bluetooth,,, +? ? turn off ? bluetooth,,, +? ? turn on ? bluetooth,,Bluetooth *, +? ? turn off ? bluetooth,,Bluetooth *, +? ? turn ? bluetooth on,,, +? ? turn ? bluetooth off,,, +? ? turn ? bluetooth on,,Bluetooth *, +? ? turn ? bluetooth off,,Bluetooth *, +? ? enable ? bluetooth,,, +? ? disable ? bluetooth,,, +? ? enable ? bluetooth,,Bluetooth *, +? ? disable ? bluetooth,,Bluetooth *, +? ? bluetooth ? ? status,,, +? ? bluetooth ? ? status,,Bluetooth *, +? ? is ? bluetooth on|off|enabled|disabled ?,,, +? ? is ? bluetooth on|off|enabled|disabled ?,,Bluetooth *, +* no *,Ok. You can always connect to a device later,Bluetooth connecting speaker, +* one|first|1|yes *,,Bluetooth connecting speaker, +* two|second|2 *,,Bluetooth connecting speaker, +* three|third|3 *,,Bluetooth connecting speaker, +* four|fourth|4 *,,Bluetooth connecting speaker, +* five|fifth|5 *,,Bluetooth connecting speaker, +* six|sixth|6 *,,Bluetooth connecting speaker, +* seven|seventh|7 *,,Bluetooth connecting speaker, +* eight|eight|8 *,,Bluetooth connecting speaker, +* nine|ninth|9 *,,Bluetooth connecting speaker, +* ten|tenth|10 *,,Bluetooth connecting speaker, +* eleven|eleventh|11 *,,Bluetooth connecting speaker, +* twelve|twelfth|12 *,,Bluetooth connecting speaker, +* thirteen|thirteenth|13 *,,Bluetooth connecting speaker, +* fourteen|fourteenth|14 *,,Bluetooth connecting speaker, +* fifteen|fifteenth|15 *,,Bluetooth connecting speaker, +* sixteen|sixteenth|16 *,,Bluetooth connecting speaker, +* seventeen|seventeenth|17 *,,Bluetooth connecting speaker, +* eighteen|eighteenth|18 *,,Bluetooth connecting speaker, +* nineteen|nineteenth|19 *,,Bluetooth connecting speaker, +* twenty|twentieth|20 *,,Bluetooth connecting speaker, +* no *,Ok. You can always connect to a device later,Bluetooth connecting headset, +* one|first|1|yes *,,Bluetooth connecting headset, +* two|second|2 *,,Bluetooth connecting headset, +* three|third|3 *,,Bluetooth connecting headset, +* four|fourth|4 *,,Bluetooth connecting headset, +* five|fifth|5 *,,Bluetooth connecting headset, +* six|sixth|6 *,,Bluetooth connecting headset, +* seven|seventh|7 *,,Bluetooth connecting headset, +* eight|eight|8 *,,Bluetooth connecting headset, +* nine|ninth|9 *,,Bluetooth connecting headset, +* ten|tenth|10 *,,Bluetooth connecting headset, +* eleven|eleventh|11 *,,Bluetooth connecting headset, +* twelve|twelfth|12 *,,Bluetooth connecting headset, +* thirteen|thirteenth|13 *,,Bluetooth connecting headset, +* fourteen|fourteenth|14 *,,Bluetooth connecting headset, +* fifteen|fifteenth|15 *,,Bluetooth connecting headset, +* sixteen|sixteenth|16 *,,Bluetooth connecting headset, +* seventeen|seventeenth|17 *,,Bluetooth connecting headset, +* eighteen|eighteenth|18 *,,Bluetooth connecting headset, +* nineteen|nineteenth|19 *,,Bluetooth connecting headset, +* twenty|twentieth|20 *,,Bluetooth connecting headset, +* one|first|1|yes *,,Bluetooth disconnect, +* two|second|2 *,,Bluetooth disconnect, +* three|third|3 *,,Bluetooth disconnect, +* four|fourth|4 *,,Bluetooth disconnect, +* five|fifth|5 *,,Bluetooth disconnect, +* six|sixth|6 *,,Bluetooth disconnect, +* seven|seventh|7 *,,Bluetooth disconnect, +* eight|eight|8 *,,Bluetooth disconnect, +* nine|ninth|9 *,,Bluetooth disconnect, +* ten|tenth|10 *,,Bluetooth disconnect, +* eleven|eleventh|11 *,,Bluetooth disconnect, +* twelve|twelfth|12 *,,Bluetooth disconnect, +* thirteen|thirteenth|13 *,,Bluetooth disconnect, +* fourteen|fourteenth|14 *,,Bluetooth disconnect, +* fifteen|fifteenth|15 *,,Bluetooth disconnect, +* sixteen|sixteenth|16 *,,Bluetooth disconnect, +* seventeen|seventeenth|17 *,,Bluetooth disconnect, +* eighteen|eighteenth|18 *,,Bluetooth disconnect, +* nineteen|nineteenth|19 *,,Bluetooth disconnect, +* twenty|twentieth|20 *,,Bluetooth disconnect, +* no *,Ok. You can always connect to a device later,Bluetooth connecting paired, +* one|first|1|yes *,,Bluetooth connecting paired, +* two|second|2 *,,Bluetooth connecting paired, +* three|third|3 *,,Bluetooth connecting paired, +* four|fourth|4 *,,Bluetooth connecting paired, +* five|fifth|5 *,,Bluetooth connecting paired, +* six|sixth|6 *,,Bluetooth connecting paired, +* seven|seventh|7 *,,Bluetooth connecting paired, +* eight|eight|8 *,,Bluetooth connecting paired, +* nine|ninth|9 *,,Bluetooth connecting paired, +* ten|tenth|10 *,,Bluetooth connecting paired, +* eleven|eleventh|11 *,,Bluetooth connecting paired, +* twelve|twelfth|12 *,,Bluetooth connecting paired, +* thirteen|thirteenth|13 *,,Bluetooth connecting paired, +* fourteen|fourteenth|14 *,,Bluetooth connecting paired, +* fifteen|fifteenth|15 *,,Bluetooth connecting paired, +* sixteen|sixteenth|16 *,,Bluetooth connecting paired, +* seventeen|seventeenth|17 *,,Bluetooth connecting paired, +* eighteen|eighteenth|18 *,,Bluetooth connecting paired, +* nineteen|nineteenth|19 *,,Bluetooth connecting paired, +* twenty|twentieth|20 *,,Bluetooth connecting paired, +* stop|cancel|exit|nevermind *,Stopping ,Bluetooth *, +Tell me what you|I|Chloe can do,"I can show you how to use Horizon. You can say, ""how do I use Horizon?"" Would you like to learn more?",,Chloe Skill Quickstart +what can you|I|Chloe do,"I can show you how to use Horizon. You can say, ""how do I use Horizon?"" Would you like to learn more?",,Chloe Skill Quickstart +? ? what your features are,"I can show you how to use Horizon. You can say, ""how do I use Horizon?"" Would you like to learn more?",,Chloe Skill Quickstart +what are your features,"I can show you how to use Horizon. You can say, ""how do I use Horizon?"" Would you like to learn more?",,Chloe Skill Quickstart +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,"To call an agent, you can double press the call button, or say, ""Call an agent."" Would you like to learn more?",Chloe Skill Quickstart,Chloe Skill Call Agent +no|skip|nah|nope|naw,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Quickstart, +maybe later,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Quickstart, +*,"Sorry, I didn't get that. Would you like to know more about what I can do?",Chloe Skill Quickstart,Chloe Skill Quickstart +* repeat *,"Sure. I can show you how to use Horizon. You can say, ""how do I use Horizon?"" Would you like to learn more?",Chloe Skill Quickstart,Chloe Skill Quickstart +* again *,"Sure. I can show you how to use Horizon. You can say, ""how do I use Horizon?"" Would you like to learn more?",Chloe Skill Quickstart,Chloe Skill Quickstart +* one more time *,"Sure. I can show you how to use Horizon. You can say, ""how do I use Horizon?"" Would you like to learn more?",Chloe Skill Quickstart,Chloe Skill Quickstart +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,"I can tell you the status of your minutes and battery level. You can say, ""how many minutes do I have?"" or ""how much battery do I have?"" Would you like to learn more?",Chloe Skill Call Agent,Chloe Skill Privacy Mode +no|skip|nah|nope|naw,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Call Agent, +maybe later,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Call Agent, +*,"Sorry, I didn't get that. Would you like to know more about what I can do?",Chloe Skill Call Agent,Chloe Skill Call Agent +* repeat *,"Sure. To call an agent, you can double press the call button, or say, ""Call an agent."" Would you like to learn more?",Chloe Skill Call Agent,Chloe Skill Call Agent +* again *,"Sure. To call an agent, you can double press the call button, or say, ""Call an agent."" Would you like to learn more?",Chloe Skill Call Agent,Chloe Skill Call Agent +* one more time *,"Sure. To call an agent, you can double press the call button, or say, ""Call an agent."" Would you like to learn more?",Chloe Skill Call Agent,Chloe Skill Call Agent +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,"To turn privacy mode on and off during a call, you can press on the call button once. Privacy mode disables your audio and video so that the agent cannot hear or see anything on your end. Would you like to learn more?",Chloe Skill Privacy Mode,Chloe Skill Flashlight +no|skip|nah|nope|naw,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Privacy Mode, +maybe later,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Privacy Mode, +*,"Sorry, I didn't get that. Would you like to know more about what I can do?",Chloe Skill Privacy Mode,Chloe Skill Privacy Mode +* repeat *,"Sure. To call an agent, you can double press the call button, or say, ""Call an agent."" Would you like to learn more?",Chloe Skill Privacy Mode,Chloe Skill Privacy Mode +* again *,"Sure. To call an agent, you can double press the call button, or say, ""Call an agent."" Would you like to learn more?",Chloe Skill Privacy Mode,Chloe Skill Privacy Mode +* one more time *,"Sure. To call an agent, you can double press the call button, or say, ""Call an agent."" Would you like to learn more?",Chloe Skill Privacy Mode,Chloe Skill Privacy Mode +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,"I can turn the flashlight on the Horizon phone on and off for you. You can say ""turn on the flashlight"" or ""turn off the flashlight."" Would you like to learn more?",Chloe Skill Flashlight,Chloe Skill Time Date +no|skip|nah|nope|naw,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Flashlight, +maybe later,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Flashlight, +*,"Sorry, I didn't get that. Would you like to know more about what I can do?",Chloe Skill Flashlight,Chloe Skill Flashlight +* repeat *,"Sure. I can tell you the status of your minutes and battery level. You can say, ""how many minutes do I have?"" or ""how much battery do I have?"" Would you like to learn more?",Chloe Skill Flashlight,Chloe Skill Flashlight +* again *,"Sure. I can tell you the status of your minutes and battery level. You can say, ""how many minutes do I have?"" or ""how much battery do I have?"" Would you like to learn more?",Chloe Skill Flashlight,Chloe Skill Flashlight +* one more time *,"Sure. I can tell you the status of your minutes and battery level. You can say, ""how many minutes do I have?"" or ""how much battery do I have?"" Would you like to learn more?",Chloe Skill Flashlight,Chloe Skill Flashlight +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,"I can tell the time and day. You can say ""what time is it?"" or ""what day is it?"" Would you like to learn more?",Chloe Skill Time Date,Chloe Skill Jokes +no|skip|nah|nope|naw,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Time Date, +maybe later,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Time Date, +*,"Sorry, I didn't get that. Would you like to know more about what I can do?",Chloe Skill Time Date,Chloe Skill Time Date +* repeat *,"Sure. I can turn the flashlight on the Horizon phone on and off for you. You can say ""turn on the flashlight"" or ""turn off the flashlight."" Would you like to learn more?",Chloe Skill Time Date,Chloe Skill Time Date +* again *,"Sure. I can turn the flashlight on the Horizon phone on and off for you. You can say ""turn on the flashlight"" or ""turn off the flashlight."" Would you like to learn more?",Chloe Skill Time Date,Chloe Skill Time Date +* one more time *,"Sure. I can turn the flashlight on the Horizon phone on and off for you. You can say ""turn on the flashlight"" or ""turn off the flashlight."" Would you like to learn more?",Chloe Skill Time Date,Chloe Skill Time Date +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,"I can tell you jokes. You can say, ""tell me a joke."" Would you like to learn more?",Chloe Skill Jokes,Chloe Skill Jokes Repeat +no|skip|nah|nope|naw,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Jokes, +maybe later,No worries. You can always hold down on the call button and ask me what I can do.,Chloe Skill Jokes, +*,"Sorry, I didn't get that. Would you like to learn more about what I can do?",Chloe Skill Jokes,Chloe Skill Jokes +* repeat *,"Sure. I can tell the time and day. You can say ""what time is it?"" or ""what day is it?"" Would you like to learn more?",Chloe Skill Jokes,Chloe Skill Jokes +* again *,"Sure. I can tell the time and day. You can say ""what time is it?"" or ""what day is it?"" Would you like to learn more?",Chloe Skill Jokes,Chloe Skill Jokes +* one more time *,"Sure. I can tell the time and day. You can say ""what time is it?"" or ""what day is it?"" Would you like to learn more?",Chloe Skill Jokes,Chloe Skill Jokes +yes|yup|yep|yea|yeah|mhm|sure|okay|kay|k,That's all I know for now. I am excited to learn more skills and become more helpful to you.,Chloe Skill Jokes Repeat, +no|skip|nah|nope|naw,No worries. That's all I know for now. I am excited to learn more skills and become more helpful to you.,Chloe Skill Jokes Repeat, +maybe later,No worries. That's all I know for now. I am excited to learn more skills and become more helpful to you.,Chloe Skill Jokes Repeat, +*,"Sorry, I didn't get that. But that's all I know for now. I am excited to learn more skills and become more helpful to you.",Chloe Skill Jokes Repeat, +Thanks,No problem. Do check back for more skills soon!,Chloe Skill Jokes Repeat, +Thank you,You're welcome. I will learn more skills soon.,Chloe Skill Jokes Repeat, +* repeat *,"Sure. I can tell you jokes. You can say, ""tell me a joke."" Would you like to learn more?",Chloe Skill Jokes Repeat,Chloe Skill Jokes Repeat +* again *,"Sure. I can tell you jokes. You can say, ""tell me a joke."" Would you like to learn more?",Chloe Skill Jokes Repeat,Chloe Skill Jokes Repeat +* one more time *,"Sure. I can tell you jokes. You can say, ""tell me a joke."" Would you like to learn more?",Chloe Skill Jokes Repeat,Chloe Skill Jokes Repeat +cancel|stop|done|exit|leave|goodbye|bye|enough,OK,Chloe Skill *, +turn on ? wifi|wireless ?,,, +turn on ? wife i ?,,, +turn on ? wi fi ?,,, +enable ? wifi|wireless ?,,, +enable ? wife i ?,,, +enable ? wi fi ?,,, +wireless|wifi turned on,,, +wife i turned on,,, +wi fi turned on,,, +wireless|wifi enabled,,, +wife i enabled,,, +wi fi enabled,,, +turn off ? wifi|wireless ?,,, +turn off ? wife i ?,,, +turn off ? wi fi ?,,, +disable ? wifi|wireless ?,,, +disable ? wife i ?,,, +disable ? wi fi ?,,, +wireless|wifi turned off,,, +wife i turned off,,, +wi fi turned off,,, +wireless|wifi disabled,,, +wife i disabled,,, +wi fi disabled,,, diff --git a/src/aichat/chatapp/admin.py b/src/aichat/chatapp/admin.py index 724b82a..e24cd76 100644 --- a/src/aichat/chatapp/admin.py +++ b/src/aichat/chatapp/admin.py @@ -1,16 +1,24 @@ from django.contrib import admin -from .models import TriggerResponse, node, edge +from .models import TriggerResponse, Node, Edge class TriggerResponseAdmin(admin.ModelAdmin): list_display = ('source_state', 'dest_state', 'trigger', 'response') -class edgeAdmin(admin.ModelAdmin): +class NodeAdmin(admin.ModelAdmin): + list_display = ('name', 'x_loc', 'y_loc') + + +class EdgeAdmin(admin.ModelAdmin): list_display = ('trigger', 'response') +class TriggerResponseAdminFK(admin.ModelAdmin): + list_display = ('source_state', 'dest_state', 'trigger', 'response') + + admin.site.register(TriggerResponse, TriggerResponseAdmin) -admin.site.register(edge, edgeAdmin) -admin.site.register(node) +admin.site.register(Edge, EdgeAdmin) +admin.site.register(Node, NodeAdmin) diff --git a/src/aichat/chatapp/data/tips.csv b/src/aichat/chatapp/data/tips.csv index 112d14a..6e43688 100644 --- a/src/aichat/chatapp/data/tips.csv +++ b/src/aichat/chatapp/data/tips.csv @@ -1,6 +1,6 @@ -tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Some analog clocks and watches have tactile faces that can be read by touch." -tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Bump dots are tactile stickers that can be placed on touchscreen interfaces like a refrigerator or microwave, as long as the screen doesn't dynamically change the location of buttons." -tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Your pharmacist can place braille labels on any medication, or if you prefer you can give the pharmacist bump dots to put on your medicine bottles according to your own labeling system." -tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Never take a medicine that you aren't 100% sure of it's origin and usage or dosage. When in doubt call an Aira agent. Many medicine bottle labels can only be read accurately by a human." -tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Your pharmacist can place braille labels on any medication, or if you prefer you can give the pharmacist bump dots to put on your medicine bottles according to your own labeling system." -tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"If you have strong mobility skills, taking the stairs rather than the elevator at every opportunity can improve your long term health. If you prefer exercise machines you can play an interesting podcast or have Chloe read you a book while you work out." +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Some analog clocks and watches have tactile faces that can be read by touch.",, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Bump dots are tactile stickers that can be placed on touchscreen interfaces like a refrigerator or microwave, as long as the screen doesn't dynamically change the location of buttons.",, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Your pharmacist can place braille labels on any medication, or if you prefer you can give the pharmacist bump dots to put on your medicine bottles according to your own labeling system.",, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Never take a medicine that you aren't 100% sure of it's origin and usage or dosage. When in doubt call an Aira agent. Many medicine bottle labels can only be read accurately by a human.",, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"Your pharmacist can place braille labels on any medication, or if you prefer you can give the pharmacist bump dots to put on your medicine bottles according to your own labeling system.",, +tell me a life|bvi|low-vision|blind|health hack|tip|idea|motivation,"If you have strong mobility skills, taking the stairs rather than the elevator at every opportunity can improve your long term health. If you prefer exercise machines you can play an interesting podcast or have Chloe read you a book while you work out.",, diff --git a/src/aichat/chatapp/load.py b/src/aichat/chatapp/load.py index 7062b3b..ee7c0f0 100644 --- a/src/aichat/chatapp/load.py +++ b/src/aichat/chatapp/load.py @@ -1,6 +1,6 @@ import os -from pandas import read_csv +import pandas as pd from aichat.chatsite.settings import CSV_DEFAULT_PATH, CSV_COLUMNS from .models import TriggerResponse @@ -8,7 +8,11 @@ def load(path=CSV_DEFAULT_PATH, allow_dupes=True): numrecords = TriggerResponse.objects.count() - df = read_csv(path, header=None) + df = pd.read_csv(path, header=None) + columns = list(df.columns) + 'source dest'.split() + for i in range(len(df.columns), 4): + df[columns[i]] = pd.np.nan + df = df.fillna('root') # new df.columns = CSV_COLUMNS[:len(df.columns)] create = TriggerResponse.objects.create if allow_dupes else TriggerResponse.objects.get_or_create @@ -26,3 +30,18 @@ def load_all(path=os.path.dirname(CSV_DEFAULT_PATH), allow_dupes=True): if os.path.isfile(filepath) and filename.lower().endswith('.csv'): numadded[filename] = load(filepath, allow_dupes=allow_dupes) return numadded + + +def test_load(path=os.path.dirname(CSV_DEFAULT_PATH), allow_dupes=True): + numadded = {} + total = 0 + for filename in os.listdir(path): + filepath = os.path.join(path, filename) + if os.path.isfile(filepath) and filename.lower().endswith('.csv'): + + numadded[filename] = load(filepath, allow_dupes=allow_dupes) + df = pd.read_csv(filepath, header=None) + total += len(df) + print(filepath) + assert(total == TriggerResponse.objects.count()) + return numadded diff --git a/src/aichat/chatapp/load_df.py b/src/aichat/chatapp/load_df.py index b5c2c89..3b7573e 100644 --- a/src/aichat/chatapp/load_df.py +++ b/src/aichat/chatapp/load_df.py @@ -19,14 +19,14 @@ def load_df(path=DATA_DIR): CSV_COLUMNS = ('trigger', 'response', 'source_state', 'dest_state') df = pd.DataFrame(columns=CSV_COLUMNS) if os.path.isfile(path): - dfadd = pd.read_csv(path) + dfadd = pd.read_csv(path, header=None) dfadd.columns = CSV_COLUMNS[:len(dfadd.columns)] df = df.append(dfadd) else: for root, dirs, files in os.walk(path): for file in files: if file.endswith(".csv"): - dfadd = pd.read_csv(path + '/' + file) + dfadd = pd.read_csv(path + '/' + file, header=None) dfadd.columns = CSV_COLUMNS[:len(dfadd.columns)] df = df.append(dfadd) @@ -108,51 +108,53 @@ def gen_links(path=DATA_DIR, value=1, df=DF): """ returns links for the d3 structure # Case1 nopatt - >>> df = pd.DataFrame([['1 goto 2', 'okay', '1', '2']], columns=('trigger', 'response', 'source_state', 'dest_state')) + >>> df = pd.DataFrame([['1 goto 2', 'okay12', '1', '2']], columns=('trigger', 'response', 'source_state', 'dest_state')) >>> gen_links(path=DATA_DIR, value=1, df=df) - [{'source': 0, 'target': 1, 'command': '1 goto 2', 'response': 'okay', 'value': 1}] + [{'source': 0, 'target': 1, 'command': '1 goto 2', 'response': 'okay12', 'value': 1}] # Case3 destpatt - >>> df = pd.DataFrame([['1 goto 2', 'okay', '1', '2'], ['2 goto 3', 'okay', '2', '3'], ['3 goto 4', 'okay', '3', '4'], ['4 goto 1 or 2', 'okay', '4', '1|2']], columns=('trigger', 'response', 'source_state', 'dest_state')) # noqa + >>> df = pd.DataFrame([['1 goto 2', 'okay12', '1', '2'], ['2 goto 3', 'okay23', '2', '3'], ['3 goto 4', 'okay34', '3', '4'], ['4 goto 1 or 2', 'okay412', '4', '1|2']], columns=('trigger', 'response', 'source_state', 'dest_state')) # noqa >>> gen_links(path=DATA_DIR, value=1, df=df) - [{'source': 0, 'target': 1, 'command': '1 goto 2', 'response': 'okay', 'value': 1}, - {'source': 1, 'target': 2, 'command': '2 goto 3', 'response': 'okay', 'value': 1}, - {'source': 2, 'target': 3, 'command': '3 goto 4', 'response': 'okay', 'value': 1}, - {'source': 3, 'target': 1, 'command': '4 goto 1 or 2', 'response': 'okay', 'value': 1}] + [{'source': 0, 'target': 1, 'command': '1 goto 2', 'response': 'okay12', 'value': 1}, + {'source': 1, 'target': 2, 'command': '2 goto 3', 'response': 'okay23', 'value': 1}, + {'source': 2, 'target': 3, 'command': '3 goto 4', 'response': 'okay34', 'value': 1}, + {'source': 3, 'target': 1, 'command': '4 goto 1 or 2', 'response': 'okay412', 'value': 1}] # Case2 sourcepatt - >>> df = pd.DataFrame([['', '', '1', '2'], ['', '', '2', '3'], ['', '', '3', '4'], ['', '', '1|2', '5']], columns=('trigger', 'response', 'source_state', 'dest_state')) # noqa + >>> df = pd.DataFrame([['1 goto 2', 'okay12', '1', '2'], ['2 goto 3', 'okay23', '2', '3'], ['3 goto 4', 'okay34', '3', '4'], ['goto 5', 'going to 5', '1|2', '5']], columns=('trigger', 'response', 'source_state', 'dest_state')) # noqa >>> gen_links(path=DATA_DIR, value=1, df=df) - [{'source': 0, 'target': 1, 'command': '', 'response': '', 'value': 1}, - {'source': 1, 'target': 2, 'command': '', 'response': '', 'value': 1}, - {'source': 2, 'target': 3, 'command': '', 'response': '', 'value': 1}, - {'source': 0, 'target': 4, 'command': '', 'response': '', 'value': 1}, - {'source': 1, 'target': 4, 'command': '', 'response': '', 'value': 1}] + [{'source': 0, 'target': 1, 'command': '1 goto 2', 'response': 'okay12', 'value': 1}, + {'source': 1, 'target': 2, 'command': '2 goto 3', 'response': 'okay23', 'value': 1}, + {'source': 2, 'target': 3, 'command': '3 goto 4', 'response': 'okay34', 'value': 1}, + {'source': 0, 'target': 4, 'command': 'goto 5', 'response': 'going to 5', 'value': 1}, + {'source': 1, 'target': 4, 'command': 'goto 5', 'response': 'going to 5', 'value': 1}] # Case4 sourcepatt and destpatt - >>> df = pd.DataFrame([['', '', '1', '2'], ['', '', '2', '3'], ['', '', '3', '4'], ['', '', '2|3', '1|2']], columns=('trigger', 'response', 'source_state', 'dest_state')) # noqa + >>> df = pd.DataFrame([['1 goto 2', 'okay12', '1', '2'], ['2 goto 3', 'okay23', '2', '3'], ['3 goto 4', 'okay34', '3', '4'], ['2 or 3 goto 1 or 2', 'okay2312', '2|3', '1|2']], columns=('trigger', 'response', 'source_state', 'dest_state')) # noqa >>> gen_links(path=DATA_DIR, value=1, df=df) - [{'source': 0, 'target': 1, 'command': '', 'response': '', 'value': 1}, - {'source': 1, 'target': 2, 'command': '', 'response': '', 'value': 1}, - {'source': 2, 'target': 3, 'command': '', 'response': '', 'value': 1}, - {'source': 1, 'target': 1, 'command': '', 'response': '', 'value': 1}, - {'source': 2, 'target': 1, 'command': '', 'response': '', 'value': 1}] - - >>> df = pd.DataFrame([['', '', '1', '2'], ['', '', '2', '3'], ['', '', '4', '5'], ['', '', '6', '7'], ['', '', '1|2', '7'], ['', '', '8', '2|3'], ['', '', '4|9', '9'], ['', '', '4|6', '3|5']], columns=('trigger', 'response', 'source_state', 'dest_state')) # noqa + [{'source': 0, 'target': 1, 'command': '1 goto 2', 'response': 'okay12', 'value': 1}, + {'source': 1, 'target': 2, 'command': '2 goto 3', 'response': 'okay23', 'value': 1}, + {'source': 2, 'target': 3, 'command': '3 goto 4', 'response': 'okay34', 'value': 1}, + {'source': 1, 'target': 0, 'command': '2 or 3 goto 1 or 2', 'response': 'okay2312', 'value': 1}, + {'source': 1, 'target': 1, 'command': '2 or 3 goto 1 or 2', 'response': 'okay2312', 'value': 1}, + {'source': 2, 'target': 0, 'command': '2 or 3 goto 1 or 2', 'response': 'okay2312', 'value': 1}, + {'source': 2, 'target': 1, 'command': '2 or 3 goto 1 or 2', 'response': 'okay2312', 'value': 1}] + + >>> df = pd.DataFrame([['1 goto 2', 'okay12', '1', '2'], ['2 goto 3', 'okay23', '2', '3'], ['4 goto 5', 'okay45', '4', '5'], ['6 goto 7', 'okay67', '6', '7'], ['goto 7', 'going to 7', '1|2', '7'], ['8 goto 2 or 3', 'okay823', '8', '2|3'], ['goto 9', 'going to 9', '4|9', '9'], ['4 or 6 goto 3 or 5', 'okay4635', '4|6', '3|5']], columns=('trigger', 'response', 'source_state', 'dest_state')) # noqa >>> gen_links(path=DATA_DIR, value=1, df=df) - [{'source': 0, 'target': 1, 'command': '', 'response': '', 'value': 1}, - {'source': 1, 'target': 2, 'command': '', 'response': '', 'value': 1}, - {'source': 3, 'target': 4, 'command': '', 'response': '', 'value': 1}, - {'source': 5, 'target': 6, 'command': '', 'response': '', 'value': 1}, - {'source': 0, 'target': 6, 'command': '', 'response': '', 'value': 1}, - {'source': 1, 'target': 6, 'command': '', 'response': '', 'value': 1}, - {'source': 7, 'target': 1, 'command': '', 'response': '', 'value': 1}, - {'source': 7, 'target': 2, 'command': '', 'response': '', 'value': 1}, - {'source': 3, 'target': 8, 'command': '', 'response': '', 'value': 1}, - {'source': 3, 'target': 2, 'command': '', 'response': '', 'value': 1}, - {'source': 3, 'target': 4, 'command': '', 'response': '', 'value': 1}, - {'source': 5, 'target': 2, 'command': '', 'response': '', 'value': 1}, - {'source': 5, 'target': 4, 'command': '', 'response': '', 'value': 1}] + [{'source': 0, 'target': 1, 'command': '1 goto 2', 'response': 'okay12', 'value': 1}, + {'source': 1, 'target': 2, 'command': '2 goto 3', 'response': 'okay23', 'value': 1}, + {'source': 3, 'target': 4, 'command': '4 goto 5', 'response': 'okay45', 'value': 1}, + {'source': 5, 'target': 6, 'command': '6 goto 7', 'response': 'okay67', 'value': 1}, + {'source': 0, 'target': 6, 'command': 'goto 7', 'response': 'going to 7', 'value': 1}, + {'source': 1, 'target': 6, 'command': 'goto 7', 'response': 'going to 7', 'value': 1}, + {'source': 7, 'target': 1, 'command': '8 goto 2 or 3', 'response': 'okay823', 'value': 1}, + {'source': 7, 'target': 2, 'command': '8 goto 2 or 3', 'response': 'okay823', 'value': 1}, + {'source': 3, 'target': 8, 'command': 'goto 9', 'response': 'going to 9', 'value': 1}, + {'source': 3, 'target': 2, 'command': '4 or 6 goto 3 or 5', 'response': 'okay4635', 'value': 1}, + {'source': 3, 'target': 4, 'command': '4 or 6 goto 3 or 5', 'response': 'okay4635', 'value': 1}, + {'source': 5, 'target': 2, 'command': '4 or 6 goto 3 or 5', 'response': 'okay4635', 'value': 1}, + {'source': 5, 'target': 4, 'command': '4 or 6 goto 3 or 5', 'response': 'okay4635', 'value': 1}] """ @@ -174,18 +176,20 @@ def gen_links(path=DATA_DIR, value=1, df=DF): links.append({'source': node_names.index(source_name), 'target': node_names.index(dest_name), 'command': df.trigger[source_index], - 'response': df.response[dest_index], + 'response': df.response[source_index], 'value': value}) else: if not is_globstar(df.dest_state[source_index]): current_dest_name = df.dest_state[source_index] + current_trig = df.trigger[source_index] + current_resp = df.response[source_index] source_pattern = pattern.expand_globstar(source_name) for source_index, source_name in enumerate(df.source_state.values): if regex.match(source_pattern, source_name) and not is_globstar(source_name): links.append({'source': node_names.index(source_name), 'target': node_names.index(current_dest_name), - 'command': df.trigger[source_index], - 'response': df.response[source_index], + 'command': current_trig, + 'response': current_resp, 'value': value}) else: source_pattern = pattern.expand_globstar(source_name) diff --git a/src/aichat/chatapp/models.py b/src/aichat/chatapp/models.py index 840388c..84b202e 100644 --- a/src/aichat/chatapp/models.py +++ b/src/aichat/chatapp/models.py @@ -2,9 +2,27 @@ from django.db.models import CharField, TextField, NullBooleanField, DateTimeField, IntegerField from aichat import pattern import regex +from dal import autocomplete + CHOICES_IS_GLOBSTAR = ((None, ''), (True, 'Yes'), (False, 'No')) +def get_nodes(): + nodes = [] + for object in TriggerResponse.objects.all(): + nodes.append(object.source_state) + nodes.append(object.dest_state) + nodes = sorted(set(list(set(nodes)))) + return [node for node in nodes if '*' not in node and '?' not in node and '|' not in node] + + +def is_globstar(node_name): + if '*' in node_name or '?' in node_name or '|' in node_name: + return True + else: + False + + class TimestampedModel(models.Model): """ Abstract base class with self-updating ``created`` and ``modified`` fields. """ created = DateTimeField(auto_now_add=True) @@ -22,37 +40,63 @@ class Meta: abstract = True +class Node(models.Model): + name = CharField(max_length=200, default='') + x_loc = IntegerField(default=0) + y_loc = IntegerField(default=0) + + def __str__(self): + return self.name + + class TriggerResponse(AuthoredModel): - trigger = CharField(max_length=200) - response = TextField() source_state = CharField(max_length=200) dest_state = CharField(max_length=200) + trigger = CharField(max_length=200) + response = TextField() + is_globstar = NullBooleanField(choices=CHOICES_IS_GLOBSTAR, max_length=3, null=True, blank=True, default=None) def __str__(self): return self.source_state + ' to ' + self.dest_state -class node(models.Model): - name = CharField(max_length=200, default='') - x_loc = IntegerField(default=0) - y_loc = IntegerField(default=0) - - def __str__(self): - return self.name - - -class edge(models.Model): +class Edge(models.Model): trigger = CharField(max_length=200, default='') response = CharField(max_length=200, default='') - source = models.ForeignKey(node, on_delete=models.CASCADE, related_name='source', null=True) - dest = models.ForeignKey(node, on_delete=models.CASCADE, related_name='dest', null=True) + source = models.ForeignKey(Node, on_delete=models.CASCADE, related_name='source', null=True) + dest = models.ForeignKey(Node, on_delete=models.CASCADE, related_name='dest', null=True) is_globstar = NullBooleanField(choices=CHOICES_IS_GLOBSTAR, max_length=3, null=True, blank=True, default=None) def __str__(self): return self.trigger + ' to ' + self.response +class node_obj_autocomplete(autocomplete.Select2QuerySetView): + def create(self, text): + return Node.objects.create(name=text).pk + + def get_queryset(self): + # Don't forget to filter out results depending on the visitor ! + # if not self.request.user.is_authenticated(): + # return Country.objects.none() + + objects = Node.objects.all() + if self.q: + objects = objects.filter(name__istartswith=self.q) + return objects + + +class node_autocomplete(autocomplete.Select2ListView): + def create(self, text): + return text + + def get_list(self): + nodes = get_nodes() + nodes = [node for node in nodes if bool(regex.match(self.q, node, regex.I))] + return nodes + + def get_network(qs=None, value=1): if qs is None: # query database for nodes and edges @@ -65,35 +109,60 @@ def get_network(qs=None, value=1): } nodes = [] links = [] - for obj in TriggerResponse.objects.all(): - nodes.append(obj.dest_state) - nodes = list(set(nodes)) + node_names = get_nodes() node_index = 0 - for node in nodes: - js["nodes"].append({'name': node, 'id': 'node' + str(node_index)}) + for node in node_names: + if '*' in node or '?' in node or '|' in node: + continue + nodes.append( + {'name': node, 'id': 'node' + str(node_index)}) node_index = node_index + 1 - for i, obj in enumerate(TriggerResponse.objects.all()): - source_pattern = obj.source_state - patt = pattern.expand_globstar(source_pattern) - for j, name in enumerate(nodes): - if ('{' in patt or '[' in patt) and regex.match(patt, name): - print(str(j) + source_pattern + ',' + name) - links.append({'source': nodes.index(name), - 'target': nodes.index(obj.dest_state), - 'command': obj.trigger, - 'response': obj.response, + for source_obj in TriggerResponse.objects.all(): + if not is_globstar(str(source_obj.source_state)): + current_dest_name = source_obj.dest_state + if not is_globstar(str(current_dest_name)): + links.append({'source': node_names.index(source_obj.source_state), + 'target': node_names.index(current_dest_name), + 'command': source_obj.trigger, + 'response': source_obj.response, 'value': value}) - elif source_pattern == name: - print("nonpattern:" + str(j) + source_pattern + ',' + name) - links.append({'source': nodes.index(name), - 'target': nodes.index(obj.dest_state), - 'command': obj.trigger, - 'response': obj.response, - 'value': value}) - - js["links"] = links - # js = json.dumps(js, indent=2) - # use nodes and edges to populate a json string like load.py + else: + dest_pattern = pattern.expand_globstar(current_dest_name) + for dest_node in node_names: + if regex.match(dest_pattern, dest_node): + links.append({'source': node_names.index(source_obj.source_state), + 'target': node_names.index(current_dest_name), + 'command': source_obj.trigger, + 'response': source_obj.response, + 'value': value}) + else: + if not is_globstar(source_obj.dest_state): + current_dest_name = source_obj.dest_state + current_trig = source_obj.trigger + current_resp = source_obj.response + source_pattern = pattern.expand_globstar(source_obj.source_state) + for source_obj_index, source_obj in enumerate(TriggerResponse.objects.all()): + if regex.match(source_pattern, source_obj.source_state) and not is_globstar(source_obj.source_state): + links.append({'source': node_names.index(source_obj.source_state), + 'target': node_names.index(current_dest_name), + 'command': current_trig, + 'response': current_resp, + 'value': value}) + else: + source_pattern = pattern.expand_globstar(source_obj.source_state) + current_dest_name = source_obj.dest_state + dest_pattern = pattern.expand_globstar(current_dest_name) + for current_source_index, current_source_name in enumerate(node_names): + if regex.match(source_pattern, current_source_name) and not is_globstar(current_source_name): + for dest_index, dest_name in enumerate(node_names): + if regex.match(dest_pattern, dest_name) and not is_globstar(dest_name): + links.append({'source': node_names.index(current_source_name), + 'target': node_names.index(dest_name), + 'command': source_obj.trigger, + 'response': source_obj.response, + 'value': value}) + js["nodes"] = nodes + js["links"] = links return js diff --git a/src/aichat/chatapp/static/chatapp/force.css b/src/aichat/chatapp/static/chatapp/force.css index 80d59f8..ef03a33 100644 --- a/src/aichat/chatapp/static/chatapp/force.css +++ b/src/aichat/chatapp/static/chatapp/force.css @@ -51,4 +51,32 @@ line.link { stroke: #9ecae1; stroke-width: 1.5px; } +.button{ + background-color: #e2e2e2; + border: none; + border-radius: 5px; + color: black; + padding: 7px 15px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 12px; +} +.button:hover{ + background-color: #dbdbdb; +} + + +input[type=text] { + border: solid #919191 1px; + border-radius: 4px; + height: 23px; + width: 250px; +} +input[type=textarea] { + border: solid #ebebeb 1px; + border-radius: 4px; + height: 18px; + width: 250px; +} diff --git a/src/aichat/chatapp/static/chatapp/style.css b/src/aichat/chatapp/static/chatapp/style.css index 39df20a..7f627c5 100644 --- a/src/aichat/chatapp/static/chatapp/style.css +++ b/src/aichat/chatapp/static/chatapp/style.css @@ -8,6 +8,7 @@ line.link { fill: none; stroke: #9ecae1; stroke-width: 2.5px; + cursor: pointer; } .form textarea { @@ -18,3 +19,10 @@ line.link { .form input[type="text"] { width: 400px; } + +.graph{ + border: solid #e2e2e2 2px; + + + +} diff --git a/src/aichat/chatapp/templates/chatapp/create.html b/src/aichat/chatapp/templates/chatapp/create.html index dd25cb4..bd1667e 100644 --- a/src/aichat/chatapp/templates/chatapp/create.html +++ b/src/aichat/chatapp/templates/chatapp/create.html @@ -1,28 +1,29 @@ {% load static %} - - - - Create new sequences - - - - - - + + + + Create Response + + + -

Create new sequence

- {% if error_message %}

{{ error_message }}

{% endif %} + -
- {% csrf_token %} - Source :
- Destination:
- Trigger :
- Response :
- -
+

Create Response

+ {% if error_message %}

{{ error_message }}

{% endif %} - +
+ {% csrf_token %} + {{trig_form.as_p}} + +
+ + + {{ trig_form.media }} + + +

Back

+ \ No newline at end of file diff --git a/src/aichat/chatapp/templates/chatapp/index.html b/src/aichat/chatapp/templates/chatapp/index.html index a9f5767..787c4a9 100644 --- a/src/aichat/chatapp/templates/chatapp/index.html +++ b/src/aichat/chatapp/templates/chatapp/index.html @@ -9,11 +9,10 @@ Chloe Skills - - - + + @@ -22,17 +21,18 @@

Chloe Skills

-

Create New Skill

- {% if error_message %}

{{ error_message }}

{% endif %} - -
- {% csrf_token %} - Source :
- Destination:
- Trigger :
- Response :
- -
+

Create Response

+ {% if error_message %}

{{ error_message }}

{% endif %} + +
+ {% csrf_token %} + {{trig_form.as_p}} + +
+ + + {{ trig_form.media }} +

Chloe's "Brain"

diff --git a/src/aichat/chatapp/urls.py b/src/aichat/chatapp/urls.py index 6605144..65dfd94 100644 --- a/src/aichat/chatapp/urls.py +++ b/src/aichat/chatapp/urls.py @@ -1,11 +1,14 @@ from django.urls import path - +from .models import node_obj_autocomplete, node_autocomplete, Node # noqa from . import views +from dal import autocomplete app_name = 'chatapp' urlpatterns = [ path('', views.index, name='index'), path('create/', views.create, name='create'), path('create/save/', views.save_new_sequence, name='save'), - path('network.json', views.network_rest, name='network') + path('network.json', views.network_rest, name='network'), + path('node_autocomplete', node_autocomplete.as_view(), name='node_autocomplete'), + path('node_obj_autocomplete', autocomplete.Select2QuerySetView.as_view(create_field='title'), name='node_obj_autocomplete') ] diff --git a/src/aichat/chatapp/views.py b/src/aichat/chatapp/views.py index 0bfff8f..7e8bff5 100644 --- a/src/aichat/chatapp/views.py +++ b/src/aichat/chatapp/views.py @@ -1,33 +1,27 @@ from django.shortcuts import render -from django.http import HttpResponseRedirect, JsonResponse, HttpResponse # noqa +from django.http import HttpResponseRedirect, JsonResponse, HttpResponse # noqa from django.urls import reverse -# from django.views import generic from .models import TriggerResponse, get_network +from .forms import TriggerResponseForm # from . import load def index(request): - return render(request, 'chatapp/index.html', ) + trigForm = TriggerResponseForm() + return render(request, 'chatapp/index.html', {'trig_form': trigForm}) def create(request): - return render(request, 'chatapp/create.html') - - -def save_new_sequence(request): - selected_source = request.POST.get("Source") - selected_dest = request.POST.get("Dest") - selected_trig = request.POST.get("Trigger") - selected_resp = request.POST.get("Response") - if selected_resp == "" or selected_trig == "" or selected_source == "" or selected_dest == "": - return render(request, 'chatapp/create.html', { - 'error_message': "Please fill all text boxes", - }) - else: - new_trig = TriggerResponse(dest_state=selected_dest, source_state=selected_source, - trigger=selected_trig, response=selected_resp) - new_trig.save() - return HttpResponseRedirect(reverse('chatapp:index')) + trigForm = TriggerResponseForm() + return render(request, 'chatapp/create.html', {'trig_form': trigForm}) + + +def save_new_sequence(request, form=TriggerResponseForm, model=TriggerResponse): + form = form(request.POST) + if form.is_valid(): + obj = model(**form.cleaned_data) + obj.save() + return HttpResponseRedirect(reverse('chatapp:index')) def network_rest(request): diff --git a/src/aichat/chatsite/settings.py b/src/aichat/chatsite/settings.py index b469f19..b13eb71 100644 --- a/src/aichat/chatsite/settings.py +++ b/src/aichat/chatsite/settings.py @@ -44,6 +44,8 @@ def random_str(n=50): INSTALLED_APPS = [ 'aichat.chatapp.apps.ChatAppConfig', + 'dal', + 'dal_select2', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes',