diff --git a/assets/1.png b/assets/1.png new file mode 100755 index 00000000..2432508b Binary files /dev/null and b/assets/1.png differ diff --git a/assets/2_2.png b/assets/2_2.png new file mode 100755 index 00000000..435a0777 Binary files /dev/null and b/assets/2_2.png differ diff --git a/assets/2_3.png b/assets/2_3.png new file mode 100755 index 00000000..3edfd424 Binary files /dev/null and b/assets/2_3.png differ diff --git a/assets/2_welcome intent.png b/assets/2_welcome intent.png new file mode 100755 index 00000000..32725fc9 Binary files /dev/null and b/assets/2_welcome intent.png differ diff --git a/assets/3_2.png b/assets/3_2.png new file mode 100755 index 00000000..4c268e08 Binary files /dev/null and b/assets/3_2.png differ diff --git a/assets/3_3.png b/assets/3_3.png new file mode 100755 index 00000000..5c7d9f6c Binary files /dev/null and b/assets/3_3.png differ diff --git a/assets/3_4.png b/assets/3_4.png new file mode 100755 index 00000000..11c96c18 Binary files /dev/null and b/assets/3_4.png differ diff --git a/assets/3_5.png b/assets/3_5.png new file mode 100755 index 00000000..88b8fc19 Binary files /dev/null and b/assets/3_5.png differ diff --git a/assets/3_Entity.png b/assets/3_Entity.png new file mode 100755 index 00000000..bfaf5578 Binary files /dev/null and b/assets/3_Entity.png differ diff --git a/assets/4-webhook.png b/assets/4-webhook.png new file mode 100755 index 00000000..c57f9b3c Binary files /dev/null and b/assets/4-webhook.png differ diff --git a/assets/4_2.png b/assets/4_2.png new file mode 100755 index 00000000..af30efdc Binary files /dev/null and b/assets/4_2.png differ diff --git a/assets/4_3.png b/assets/4_3.png new file mode 100755 index 00000000..a4e7ed12 Binary files /dev/null and b/assets/4_3.png differ diff --git a/assets/4_4.png b/assets/4_4.png new file mode 100755 index 00000000..2b7e1da6 Binary files /dev/null and b/assets/4_4.png differ diff --git a/assets/5_2.png b/assets/5_2.png new file mode 100755 index 00000000..e7866c93 Binary files /dev/null and b/assets/5_2.png differ diff --git a/assets/5_add context.png b/assets/5_add context.png new file mode 100755 index 00000000..67ef598d Binary files /dev/null and b/assets/5_add context.png differ diff --git a/assets/6_2.png b/assets/6_2.png new file mode 100755 index 00000000..e3b15641 Binary files /dev/null and b/assets/6_2.png differ diff --git a/assets/6_Integrations.png b/assets/6_Integrations.png new file mode 100755 index 00000000..c072e425 Binary files /dev/null and b/assets/6_Integrations.png differ diff --git a/assets/bvaughn-tearing-1.png b/assets/bvaughn-tearing-1.png old mode 100644 new mode 100755 diff --git a/assets/bvaughn-tearing-2.png b/assets/bvaughn-tearing-2.png old mode 100644 new mode 100755 diff --git a/assets/component-lifecycle.svg b/assets/component-lifecycle.svg old mode 100644 new mode 100755 diff --git a/assets/dan-demo-blocking.png b/assets/dan-demo-blocking.png old mode 100644 new mode 100755 diff --git a/assets/dan-demo-concurrent.png b/assets/dan-demo-concurrent.png old mode 100644 new mode 100755 diff --git a/assets/deferred-setstate.svg b/assets/deferred-setstate.svg old mode 100644 new mode 100755 diff --git a/assets/hooks-api-timing.svg b/assets/hooks-api-timing.svg old mode 100644 new mode 100755 diff --git a/assets/hooks-api.svg b/assets/hooks-api.svg old mode 100644 new mode 100755 diff --git a/assets/interrupt-rendering.svg b/assets/interrupt-rendering.svg old mode 100644 new mode 100755 diff --git a/assets/interrupted-lifecycle.svg b/assets/interrupted-lifecycle.svg old mode 100644 new mode 100755 diff --git a/assets/observing-lifecycle-events.svg b/assets/observing-lifecycle-events.svg old mode 100644 new mode 100755 diff --git a/assets/scheduler-priorities.svg b/assets/scheduler-priorities.svg old mode 100644 new mode 100755 diff --git a/decks/food.mdx b/decks/food.mdx old mode 100644 new mode 100755 index aa8461bb..691e2998 --- a/decks/food.mdx +++ b/decks/food.mdx @@ -9,76 +9,97 @@ export const theme = customTheme; -# Concurrent Mode +# Designing a ChatBot using DiagFlow +## By Shayan _____ and Ruby _____ --- - - - - - -```jsx file=./src/greeting.1.1.js -``` +## What is a ChatBot? - +--- + - - - +## ChatBot -```jsx 7 file=./src/greeting.1.1.js -``` +### A computer program that simulates and processes human conversation, allowing humans to interact with digital devices as if they were communicating with a real person. - - - - - + -```jsx file=./src/greeting.class.1.1.js -``` +--- - +## Why we need a ChatBot? - +--- - +## Never miss a chance to engage with your friends or users -```jsx file=./src/greeting.class.1.2.js -``` +--- + +## How to start? - +--- + - +## Google DialogFlow + +### "Dialogflow (formerly Api.ai, Speaktoit) is a Google-owned developer of human–computer interaction technologies based on natural language conversations." + + + +- There are so many tools, why DiagFlow ? + + + + + +--- - + -```jsx 10:12,15:17,25 file=./src/greeting.class.1.3.js -``` +- Built-in natural-language processing (NLP) +- Machine learning +- On any platform +- Offers cross-device support +- supports 20+ languages - +## DialogFlow - + +- Use machine learning to understand what users are saying +- Build Actions, Skills, bots, and apps for the Google Assistant, Alexa, Cortana, Facebook Messenger and other platforms your users are on. +- wearables, phones, cars, speakers and other smart devices +- Give users new ways to interact with your product by building engaging voice and text-based conversational interfaces, + such as voice apps and chatbots, powered by AI. + Connect with users on your website, mobile app, the Google Assistant, Amazon Alexa, Facebook Messenger, and other popular platforms and devices. - + -```jsx 1:31 file=./src/greeting.class.1.3.js -``` + - +--- - +# Let’s get started --- - - + + +## Agent + +### The face of your bot. + +#### Connects to your backend and provides it with business logic. -## Disclaimer +#### Is made up of intents -### Information in this talk may not be accurate or may change in the future + + +- DialogFlow allows you to make NLU modules, called agents (basically the face of your bot). +This agent connects to your backend and provides it with business logic. +-An agent is made up of intents. what is intents? + + @@ -86,294 +107,428 @@ export const theme = customTheme; -## Time Slicing +## Intent + +### Intents are simply actions that a user can perform on your agent. It maps what a user says to what action should be taken. + +#### “What’s the weather like in Davis today?” -### "Chunking slow rendering on subtree into little blocks of work by interrupting the work loop." + + +- They’re entry points into a conversation. +- In short, a user may request the same thing in many ways, re-structuring their sentences. But in the end, they should all resolve to a single intent. +- Examples of intents can be: “What’s the weather like in Davis today?” or “What is the recipe for an omelet?” +- You can create as many intents as your business logic desires, and even co-relate them, using contexts. An intent decides what API to call, with what parameters, and how to respond back, to a user’s request. + + --- -import DanDemoBlocking from '../assets/dan-demo-blocking.png'; + - +## Entity ---- +### The values to extract from a given user’s input (keywords) -import DanDemoConcurrent from '../assets/dan-demo-concurrent.png'; +#### Dates, events, distance - + ---- + - +- An agent wouldn’t know what values to extract from a given user’s input. + This is where entities come into play. + Any information in a sentence, critical to your business logic, will be an entity. + This includes stuff like dates, distance, currency, etc. + There are system entities, provided by DialogFlow for simple things like numbers and dates. + And then there are developer defined entities. + For example, “category”, for a bot about Pokemon! We’ll dive into how to make a custom developer entity further in the post. + + -### "Wait a minute... I already know about this! What is this talk really about?" --- - + -# Concurrent Mode +## Context -## A chain of unfortunate consequences +### A context-aware bot can remember things, and hold conversations + + - +- Final concept before we can get started with coding is “Context”. + This is what makes the bot truly conversational. + A context-aware bot can remember things, and hold a conversation like humans do. + Consider the following conversation: + + + + --- -### How does React "delay" rendering? +“Hey, are you coming for piano practice tonight?” + +“Sorry, I’ve got dinner plans.” + +“Okay, what about tomorrow night then?” + +“That works!” + + + +- Did you notice what just happened? The first question is straightforward to parse: The time is “tonight”, and the event, “piano practice”. + However, the second question, “Okay, what about tomorrow night then?” doesn’t specify anything about the actual event. + It’s implied that we’re talking about “piano practice”. + This sort of understanding comes naturally to us humans, but bots have to be explicitly programmed so that they understand the context across these sentences. + + --- -## Sources of Slowdown +## Let’s get started! -- Slow component render functions -- Slow state setter or reducer updater functions -- Slow effect functions +### Make a Reddit bot that tells a joke or an interesting fact from the day’s top threads on specific subreddits --- -import DeferredSetState from '../assets/deferred-setstate.svg'; + + + - +## 1. Creating an Agent +- Log in to the DialogFlow dashboard using your Google account. +- Click on “Create Agent” +- Enter the name of the agent, and hit “Create”. -## Deferred setState. + -### Any state setter or dispatch can be delayed. +--- - +import chatbot1 from '../assets/1.png'; - + --- -import InterruptRendering from '../assets/interrupt-rendering.svg'; + + - +## 2. Setting up a “Welcome” Intent +- Go ahead and click on the “Default Welcome Intent”. -## Interrupt Rendering. + + +--- -### Any rendering can be interrupted and can be completed later before committing. +import chatbot21 from '../assets/2_welcome intent.png'; - + - --- - +- Fill in user says as below -## Oops #1 +import chatbot22 from '../assets/2_2.png'; -### Delaying rendering is only safe when no effects are pending on a subtree. + - --- -import HooksAPI from '../assets/hooks-api.svg'; - - - -## The Hooks API. +- Scroll down to the “Responses” tab +- Delete the welcome messages +- Fill in "Responses" as below +- Click "Save" -### This restriction is reflected in the hooks API with encapsulation of effects. +import chatbot23 from '../assets/2_3.png'; - + - --- -import HooksAPITiming from '../assets/hooks-api-timing.svg'; - -## Hooks Timings. +## 3. Creating a Custom Entity -### With each hook we observe a part of the lifecycle and can react. +### Entities are what we extract from user’s input to process further - + --- -import ComponentLifecycle from '../assets/component-lifecycle.svg'; +- Click on the “Entities” tab on left-sidebar and click “Create Entity” +- Name our Entity “content” +- Fill in the following details - +import chatbot31 from '../assets/3_Entity.png'; -## The Lifecycle. + -### The lifecycle we observe has three phases repeating. - - - - --- -import ObservingLifecycleEvents from '../assets/observing-lifecycle-events.svg'; - -## Observing the Lifecycle. - -### Overlapping the lifecycle with hooks, we see a phase that we can't observe... +## 4. Attaching our new Entity to the Intent +### Create a new Intent called “say-content” - + --- -import InterruptedLifecycle from '../assets/interrupted-lifecycle.svg'; +- Add the phrase “Let’s hear a joke” in the “User Says” section - +import chatbot32 from '../assets/3_2.png'; -## Interrupting the Lifecycle. + -### Unfortunately this phase becomes very relevant in Strict and Concurrent Mode. - +--- +- Let’s add a few more inputs + +import chatbot33 from '../assets/3_3.png'; + + - --- +- Let’s add a placeholder text response to see it work +- scroll to the bottom section “Response”, and fill it like so - +import chatbot34 from '../assets/3_4.png'; -## Oops #2 + -### It's not possible to have a subscription or effect track the component lifecycle. - +--- +- Click on “Try It Now” to test your work + +import chatbot35 from '../assets/3_5.png'; + + + --- - + -## Workaround +# 5. A Webhook to process requests +- Write a JS app that fulfills the request by querying the Reddit’s website and returning the appropriate content. -### Resort to useSubscription + - +--- +# code +--- + + + +​```js +'use strict'; +const http = require('https'); +exports.appWebhook = (req, res) => { + let content = req.body.result.parameters['content']; + getContent(content).then((output) => { + res.setHeader('Content-Type', 'application/json'); + res.send(JSON.stringify({ 'speech': output, 'displayText': output })); + }).catch((error) => { + // If there is an error let the user know + res.setHeader('Content-Type', 'application/json'); + res.send(JSON.stringify({ 'speech': error, 'displayText': error })); + }); +}; +function getSubreddit (content) { + if (content == "funny" || content == "joke" || content == "laugh") + return {sub: "jokes", displayText: "joke"}; + else { + return {sub: "todayILearned", displayText: "fact"}; + } +} +function getContent (content) { + let subReddit = getSubreddit(content); + return new Promise((resolve, reject) => { + console.log('API Request: to Reddit'); + http.get(`https://www.reddit.com/r/${subReddit["sub"]}/top.json?sort=top&t=day`, (resp) => { + let data = ''; + resp.on('data', (chunk) => { + data += chunk; + }); + resp.on('end', () => { + let response = JSON.parse(data); + let thread = response["data"]["children"][(Math.floor((Math.random() * 24) + 1))]["data"]; + let output = `Here's a ${subReddit["displayText"]}: ${thread["title"]}`; + if (subReddit['sub'] == "jokes") { + output += " " + thread["selftext"]; + } + output += "\nWhat do you want to hear next, a joke or a fact?" + console.log(output); + resolve(output); + }); + }).on("error", (err) => { + console.log("Error: " + err.message); + reject(error); + }); + }); +} +​``` + --- -import SchedulerPriorities from '../assets/scheduler-priorities.svg'; + - +## Steps -## Scheduler Priorities. +- Follow the 5 steps on "Using the gcloud Command-Line Tool" +- Deploy our function using gcloud: +$ gcloud beta functions deploy appWebHook — stage-bucket BUCKET_NAME — trigger-http +- Go to your Google project’s console and click on Cloud Storage under the Resources section to find the BUCKET_NAME +- After you run the command, make note of the httpsTrigger URL mentioned. -### In Concurrent Mode the time budgets are switched on for time slicing. + - +--- +- On the Dialoglow platform, find the “Fulfilment” tab on the sidebar +- Enable webhooks and paste in the URL - +import chatbot41 from '../assets/4-webhook.png'; + + --- +- Visit the “say_content” Intent page +- Make the “content” parameter mandatory. - +import chatbot42 from '../assets/4_2.png'; -## Oops #3 + -### Seems like React isn't all that predictable anymore. +--- +- Enable the “Use webhook” checkbox in “Fulfilment” +- Click "save" and test it out - +import chatbot43 from '../assets/4_3.png'; + + --- - + -## Workaround +## 6. Adding Context to our Bot -### Synchronous Subscriber and scheduled teardown +- “More” +- “More please” +- “Give me another one” - + +- Even though this works perfectly fine, there’s one more thing I’d like to add quickly. We want the user to be able to say, “More” or “Give me another one” and the bot to be able to understand what this means. + This is done by emitting and absorbing contexts between intents. + -https://github.com/facebook/react/issues/15317#issuecomment-573337558 + --- - + -### "We didn't yet get to what happens when an effect is slow, right?" +## Steps +- scroll up on the “say-content” Intent’s page and find the “Contexts” section +- Set output the “context” for a count of 5 ---- + - +--- -## Tearing +- Create new content -### "When a subtree's renderered state falls behind while another subtree has committed updates already." +import chatbot51 from '../assets/5_add context.png'; - + --- -import Tearing1 from '../assets/bvaughn-tearing-1.png'; -import Tearing2 from '../assets/bvaughn-tearing-2.png'; +import chatbot52 from '../assets/5_2.png'; - - - - + --- + - +## 7. Integrations. -## React's solution? +### Using the Web Demo. +- Go to “Integrations” tab from the sidebar and enable “Web Demo” settings -- When an effect slows down, React can't safely interrupt or delay updates. -- Instead it batches all updates and switches back to blocking mode -- This is called a _deopt_. + +- Dialogflow provides integrations with probably every messaging service in Silicon Valley, and more. + But we’ll use the Web Demo. Go to “Integrations” tab from the sidebar and enable “Web Demo” settings. + Your bot should work like this + - + --- - +import chatbot61 from '../assets/6_Integrations.png'; -## Oops #4 + -### React Concurrent's deopt can be slower than Blocking was before. + +- And that’s it! Your bot is ready to face a real person! Now, you can easily keep adding more subreddits, like news, sports, bodypainting, dankmemes or whatever your hobbies in life are! +Or make it understand a few more parameters.For example, “A joke about Donald Trump”. + - +--- + +## That’s it! Your bot is ready to face a real person! --- - + -## However +## Debugging and Tips -- This may still cause _tearing_ when another update is scheduled during this blocking batch. +- Go to your Google Project and check the Errors and Reporting tab +- Enabled billing - + --- -## Oops #5 +## Review -### A new `useMutableSource` hook is necessary to fix this tearing-during-deopt issue. +- Agent +- Intent +- Entity +- Context +- Connect them --- - +## Any Questions? + +--- -# Concurrent Mode: Oops +## Thank you! - diff --git a/decks/index.mdx b/decks/index.mdx old mode 100644 new mode 100755 index aa8461bb..01bffa14 --- a/decks/index.mdx +++ b/decks/index.mdx @@ -1,379 +1,6 @@ -import { CodeSurfer as Surfer } from "code-surfer"; -import { CodeSurferColumns, Step } from "code-surfer"; -import { Appear, Background } from "gatsby-theme-mdx-deck"; -import * as L from "../src/layout"; -import customTheme from "../src/theme"; -import GreetingLoader from "./src/greeting-loader"; -export const theme = customTheme; - - - -# Concurrent Mode - - - ---- - - - - - - -```jsx file=./src/greeting.1.1.js -``` - - - - - - - -```jsx 7 file=./src/greeting.1.1.js -``` - - - - - - - -```jsx file=./src/greeting.class.1.1.js -``` - - - - - - - -```jsx file=./src/greeting.class.1.2.js -``` - - - - - - - -```jsx 10:12,15:17,25 file=./src/greeting.class.1.3.js -``` - - - - - - - -```jsx 1:31 file=./src/greeting.class.1.3.js -``` - - - - - ---- - - - -## Disclaimer - -### Information in this talk may not be accurate or may change in the future - - - ---- - - - -## Time Slicing - -### "Chunking slow rendering on subtree into little blocks of work by interrupting the work loop." - - - ---- - -import DanDemoBlocking from '../assets/dan-demo-blocking.png'; - - - ---- - -import DanDemoConcurrent from '../assets/dan-demo-concurrent.png'; - - - ---- - - - -### "Wait a minute... I already know about this! What is this talk really about?" - ---- - - - -# Concurrent Mode - -## A chain of unfortunate consequences - - - ---- - - - -### How does React "delay" rendering? - ---- - - - -## Sources of Slowdown - -- Slow component render functions -- Slow state setter or reducer updater functions -- Slow effect functions - - - ---- - -import DeferredSetState from '../assets/deferred-setstate.svg'; - - - -## Deferred setState. - -### Any state setter or dispatch can be delayed. - - - - - ---- - -import InterruptRendering from '../assets/interrupt-rendering.svg'; - - - -## Interrupt Rendering. - -### Any rendering can be interrupted and can be completed later before committing. - - - - +# Hello --- - - -## Oops #1 - -### Delaying rendering is only safe when no effects are pending on a subtree. - - - ---- - -import HooksAPI from '../assets/hooks-api.svg'; - - - -## The Hooks API. - -### This restriction is reflected in the hooks API with encapsulation of effects. - - - - - ---- - -import HooksAPITiming from '../assets/hooks-api-timing.svg'; - - - -## Hooks Timings. - -### With each hook we observe a part of the lifecycle and can react. - - - - - ---- - -import ComponentLifecycle from '../assets/component-lifecycle.svg'; - - - -## The Lifecycle. - -### The lifecycle we observe has three phases repeating. - - - - - ---- - -import ObservingLifecycleEvents from '../assets/observing-lifecycle-events.svg'; - - - -## Observing the Lifecycle. - -### Overlapping the lifecycle with hooks, we see a phase that we can't observe... - - - - - ---- - -import InterruptedLifecycle from '../assets/interrupted-lifecycle.svg'; - - - -## Interrupting the Lifecycle. - -### Unfortunately this phase becomes very relevant in Strict and Concurrent Mode. - - - - - ---- - - - -## Oops #2 - -### It's not possible to have a subscription or effect track the component lifecycle. - - - ---- - - - -## Workaround - -### Resort to useSubscription - - - ---- - -import SchedulerPriorities from '../assets/scheduler-priorities.svg'; - - - -## Scheduler Priorities. - -### In Concurrent Mode the time budgets are switched on for time slicing. - - - - - ---- - - - -## Oops #3 - -### Seems like React isn't all that predictable anymore. - - - ---- - - - -## Workaround - -### Synchronous Subscriber and scheduled teardown - - - -https://github.com/facebook/react/issues/15317#issuecomment-573337558 - ---- - - - -### "We didn't yet get to what happens when an effect is slow, right?" - ---- - - - -## Tearing - -### "When a subtree's renderered state falls behind while another subtree has committed updates already." - - - ---- - -import Tearing1 from '../assets/bvaughn-tearing-1.png'; -import Tearing2 from '../assets/bvaughn-tearing-2.png'; - - - - - - ---- - - - -## React's solution? - -- When an effect slows down, React can't safely interrupt or delay updates. -- Instead it batches all updates and switches back to blocking mode -- This is called a _deopt_. - - - ---- - - - -## Oops #4 - -### React Concurrent's deopt can be slower than Blocking was before. - - - ---- - - - -## However - -- This may still cause _tearing_ when another update is scheduled during this blocking batch. - - - ---- - - - -## Oops #5 - -### A new `useMutableSource` hook is necessary to fix this tearing-during-deopt issue. - - - ---- - - - -# Concurrent Mode: Oops - - +This is built with gatsby-theme-mdx-deck diff --git a/decks/src/context.js b/decks/src/context.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting-loader.js b/decks/src/greeting-loader.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.1.1.js b/decks/src/greeting.1.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.1.1.js b/decks/src/greeting.class.1.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.1.2.js b/decks/src/greeting.class.1.2.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.1.3.js b/decks/src/greeting.class.1.3.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.2.1.js b/decks/src/greeting.class.2.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.3.1.js b/decks/src/greeting.class.3.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.3.2.js b/decks/src/greeting.class.3.2.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.3.3.js b/decks/src/greeting.class.3.3.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.4.1.js b/decks/src/greeting.class.4.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.5.1.js b/decks/src/greeting.class.5.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.5.2.js b/decks/src/greeting.class.5.2.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.5.3.js b/decks/src/greeting.class.5.3.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.class.5.4.js b/decks/src/greeting.class.5.4.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.1.1.js b/decks/src/greeting.hooks.1.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.1.2.js b/decks/src/greeting.hooks.1.2.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.1.3.js b/decks/src/greeting.hooks.1.3.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.1.4.js b/decks/src/greeting.hooks.1.4.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.2.1.js b/decks/src/greeting.hooks.2.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.3.1.js b/decks/src/greeting.hooks.3.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.3.2.js b/decks/src/greeting.hooks.3.2.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.3.3.js b/decks/src/greeting.hooks.3.3.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.4.1.js b/decks/src/greeting.hooks.4.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.4.2.js b/decks/src/greeting.hooks.4.2.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.5.1.js b/decks/src/greeting.hooks.5.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.5.2.js b/decks/src/greeting.hooks.5.2.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.5.3.js b/decks/src/greeting.hooks.5.3.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.6.1.js b/decks/src/greeting.hooks.6.1.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.6.2.js b/decks/src/greeting.hooks.6.2.js old mode 100644 new mode 100755 diff --git a/decks/src/greeting.hooks.6.3.js b/decks/src/greeting.hooks.6.3.js old mode 100644 new mode 100755 diff --git a/decks/src/row.js b/decks/src/row.js old mode 100644 new mode 100755 diff --git a/decks/src/styles.css b/decks/src/styles.css old mode 100644 new mode 100755 diff --git a/gatsby-config.js b/gatsby-config.js old mode 100644 new mode 100755 diff --git a/misc/feedback/feedback-template.md b/misc/feedback/feedback-template.md new file mode 100755 index 00000000..b5b424f9 --- /dev/null +++ b/misc/feedback/feedback-template.md @@ -0,0 +1,16 @@ +# Presentation Feedback + +### Positives +_What were some aspects of the presentation that the developers excelled at?_ + +* + +### Improvements +_Describe some improvements they can make with their presentation._ + +* + +### Goals for Next Time +_What can they do to improve next time?_ + +* diff --git a/misc/proposal-template.md b/misc/proposal-template.md new file mode 100755 index 00000000..0208b05d --- /dev/null +++ b/misc/proposal-template.md @@ -0,0 +1,45 @@ +# Workshop Proposal + +### Specific Topic +_What will your workshop be about?_ + + + +### Interactive Component +_Each workshop must have an original, interactive component._ + + + +### Code Deliverables +_In Weeks 2-3, your duo must code out the interactive component, as well as any other code needed for the entire workshop. +What coding tasks do you need to complete? Each task should also come with what week each task will be completed as well as who is responsible for each task. +Please be specific._ +_Also, you can use Week 4 to complete code deliverables. Note that this is highly **discouraged** because Week 4 is reserved for finishing touches and preparing the presentation._ + +- [ ] + +### Slide Outline +_What is a general roadmap for your slides?_ + +* + +### Timing +_Each workshop should be around an hour to 90 minutes. How long will your workshop be? + + + +### Motivation behind project +_What motivated your duo to pursue this idea?_ + + + +### Explain difficulty/prior experience needed +_Is there any prior experience needed for this workshop? Please be specific._ + + + +### Technologies that will be used +_Please be specific. + +* + diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/src/chatbotcode.js b/src/chatbotcode.js new file mode 100755 index 00000000..e73ec81f --- /dev/null +++ b/src/chatbotcode.js @@ -0,0 +1,46 @@ +'use strict'; +const http = require('https'); +exports.appWebhook = (req, res) => { + let content = req.body.result.parameters['content']; + getContent(content).then((output) => { + res.setHeader('Content-Type', 'application/json'); + res.send(JSON.stringify({ 'speech': output, 'displayText': output })); + }).catch((error) => { + // If there is an error let the user know + res.setHeader('Content-Type', 'application/json'); + res.send(JSON.stringify({ 'speech': error, 'displayText': error })); + }); +}; +function getSubreddit (content) { + if (content == "funny" || content == "joke" || content == "laugh") + return {sub: "jokes", displayText: "joke"}; + else { + return {sub: "todayILearned", displayText: "fact"}; + } +} +function getContent (content) { + let subReddit = getSubreddit(content); + return new Promise((resolve, reject) => { + console.log('API Request: to Reddit'); + http.get(`https://www.reddit.com/r/${subReddit["sub"]}/top.json?sort=top&t=day`, (resp) => { + let data = ''; + resp.on('data', (chunk) => { + data += chunk; + }); + resp.on('end', () => { + let response = JSON.parse(data); + let thread = response["data"]["children"][(Math.floor((Math.random() * 24) + 1))]["data"]; + let output = `Here's a ${subReddit["displayText"]}: ${thread["title"]}`; + if (subReddit['sub'] == "jokes") { + output += " " + thread["selftext"]; + } + output += "\nWhat do you want to hear next, a joke or a fact?" + console.log(output); + resolve(output); + }); + }).on("error", (err) => { + console.log("Error: " + err.message); + reject(error); + }); + }); +} \ No newline at end of file diff --git a/src/fonts/iAWriterQuattroS-Bold.woff b/src/fonts/iAWriterQuattroS-Bold.woff old mode 100644 new mode 100755 diff --git a/src/fonts/iAWriterQuattroS-Bold.woff2 b/src/fonts/iAWriterQuattroS-Bold.woff2 old mode 100644 new mode 100755 diff --git a/src/fonts/iAWriterQuattroS-Regular.woff b/src/fonts/iAWriterQuattroS-Regular.woff old mode 100644 new mode 100755 diff --git a/src/fonts/iAWriterQuattroS-Regular.woff2 b/src/fonts/iAWriterQuattroS-Regular.woff2 old mode 100644 new mode 100755 diff --git a/src/layout.js b/src/layout.js old mode 100644 new mode 100755 diff --git a/src/theme.css b/src/theme.css old mode 100644 new mode 100755 diff --git a/src/theme.js b/src/theme.js old mode 100644 new mode 100755 diff --git a/yarn.lock b/yarn.lock old mode 100644 new mode 100755