Skip to content

Instantly share code, notes, and snippets.

ideal path

  • init_convo
    • utter_intro
  • affirm OR inform
    • call_time_form
    • form{"name": "call_time_form"}
    • form{"name": null}
  • thankyou OR affirm
    • utter_no_worries
def request_next_slot(self, dispatcher, tracker, domain):
user_intent = tracker.latest_message['intent'].get('name')
if not tracker.get_slot('time'):
slot_needed = "time"
dispatcher.utter_template("utter_ask_{}".format(slot_needed), tracker, silent_fail=False, **tracker.slots)
return [SlotSet(REQUESTED_SLOT, "time")]
else:
t = None # initialize t as None
t_str = tracker.get_slot('time') # get the duckling time string from slot
try:
var express = require('express');
var router = express.Router();
// const sgMail = require('@sendgrid/mail');
var tauth = require('./../helper/auth.js');
var config = require('./../helper/config.js');
var utils = require('./../helper/utils.js');
const jwt = require('jsonwebtoken');
var mysql = require('mysql');
// sgMail.setApiKey(process.env.SENDGRID_API_KEY);
<!DOCTYPE html>
<html>
<head>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
</head>
<body>
<a-scene>
<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
<a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
<a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
var express = require('express');
var router = express.Router();
var mysql = require('mysql');
var shortid = require('shortid');
/* New POST route for form submissions */
router.post('/', function(req, res, next) {
/* establish mysql connection */
var connection = mysql.createConnection({
<!DOCTYPE html>
<html>
<head>
<title>My awesome app</title>
<link rel='stylesheet' href='/stylesheets/style.css' />
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
</head>
<body>
<h1>Welcome to my app!</h1>
<input type="email" id="email" placeholder="Enter your email...">
+----+---------------------+------+----------+
| id | time | type | activity |
+----+---------------------+------+----------+
| 37 | 2020-09-23 11:08:43 | 0 | pai |
| 38 | 2020-09-23 13:24:33 | 1 | pai |
| 41 | 2020-09-23 13:33:21 | 0 | mma |
| 42 | 2020-09-23 14:06:49 | 1 | mma |
+----+---------------------+------+----------+
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
# this should run as soon as the form starts
if not tracker.get_slot('time'):
return ["time", "call_hhmmss"]
# this should happen every other time
else:
t = None # initialize t as None
CREATE TABLE `records` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NOT NULL DEFAULT current_timestamp(),
`type` tinyint(1) NOT NULL,
`activity` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4
+----------+--------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| time | timestamp | NO | | current_timestamp() | |
| type | tinyint(1) | NO | | NULL | |
| activity | varchar(255) | NO | | NULL | |
+----------+--------------+------+-----+---------------------+----------------+