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
//1) | |
const startRecording = document.getElementById('start-recording'); | |
const stopRecording = document.getElementById('stop-recording'); | |
let recordAudio; | |
//2) | |
const socketio = io(); | |
const socket = socketio.on('connect', function() { | |
startRecording.disabled = false; | |
}); |
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
const dialogflow = require('dialogflow'); | |
const client = new dialogflow.v2beta1.AgentsClient({ | |
// optional auth parameters. | |
}); | |
client.getValidationResult({}) | |
.then(responses => { | |
const response = responses[0]; |
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
const uuid = require('uuid'); | |
const df = require('dialogflow').v2beta1; | |
const sessionId = uuid.v4(); | |
const sessionClient = new df.SessionsClient(); | |
const sessionPath = sessionClient.sessionPath(projectId, sessionId); | |
let request = { | |
session: sessionPath, | |
queryInput: { |
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
{ | |
"name": "dialogflowFirebaseFulfillment", | |
"description": "Cloud Functions for Firebase", | |
"scripts": { | |
"lint": "eslint .", | |
"serve": "firebase serve --only functions", | |
"shell": "firebase functions:shell", | |
"start": "npm run shell", | |
"deploy": "firebase deploy --only functions", | |
"logs": "firebase functions:log", |
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
export default { | |
name: 'simpleresponse', | |
title: 'Simple Response', | |
type: 'document', | |
fields: [ | |
{ | |
name: 'title', | |
title: 'Title', | |
type: 'string' | |
}, |
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
import createSchema from 'part:@sanity/base/schema-creator' | |
import schemaTypes from 'all:part:@sanity/base/schema-type' | |
import simpleResponse from './simpleresponse' | |
// Then we give our schema to the builder and provide the result to Sanity | |
export default createSchema({ | |
// We name our schema | |
name: 'dialogflow', | |
// Then proceed to concatenate our document type | |
// to the ones provided by any plugins that are installed |
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
const functions = require('firebase-functions'); | |
const sanityClient = require('@sanity/client'); | |
const { | |
WebhookClient, | |
Payload | |
} = require('dialogflow-fulfillment'); | |
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements | |
const client = sanityClient({ |
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
{ | |
"hangouts": { | |
"header": { | |
"title": "Pizza Bot Customer Support", | |
"subtitle": "pizzabot@example.com", | |
"imageUrl": "https://goo.gl/aeDtrS" | |
}, | |
"sections": [ | |
{ |
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
function playOutput(arrayBuffer){ | |
let audioContext = new AudioContext(); | |
let outputSource; | |
try { | |
if(arrayBuffer.byteLength > 0){ | |
console.log(arrayBuffer.byteLength); | |
audioContext.decodeAudioData(arrayBuffer, | |
function(buffer){ | |
audioContext.resume(); | |
outputSource = audioContext.createBufferSource(); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>RecordRTC over Socket.io</title> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<script src="https://www.WebRTC-Experiment.com/RecordRTC.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script> |