Git Product home page Git Product logo

webchatbotapi's Introduction

๐Ÿ†์กธ์—…์ž‘ํ’ˆ ์šฐ์ˆ˜ ํฌ์Šคํ„ฐ์ƒ - ํ† ๋‹ฅํ† ๋‹ฅ ํ”„๋กœ์ ํŠธ(์›น)

Dialogflow์™€ web nodejs ์—ฐ๋™๋ฒ•

KoGPT-2์™€ web nodejs ์—ฐ๋™๋ฒ•

Summary

final

์ด ํ† ๋‹ฅํ† ๋‹ฅ ํ”„๋กœ์ ํŠธ๋Š” ๋ถˆ์•ˆ ์žฅ์• ๋ฅผ ๋ง‰๊ธฐ ์œ„ํ•ด ๊ฐœ๋ฐœ๋œ ์›น ๊ธฐ๋ฐ˜ API์ž…๋‹ˆ๋‹ค. ๋ถˆ์•ˆ ์ •๋„ ๊ฒ€์‚ฌ, ๋ถˆ์•ˆ ์›์ธ ๊ฒ€์‚ฌ, ๋”ฅ๋Ÿฌ๋‹ ๊ธฐ๋ฐ˜ ์ฑ—๋ด‡๊ณผ์˜ ์ž์œ ๋กœ์šด ๋Œ€ํ™”๋ฅผ ํ†ตํ•ด ๋ถˆ์•ˆํ•œ ๊ฐ์ •์„ ํ™•์ธํ•˜๊ณ  ์น˜์œ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Demo App

์บก์ฒ˜

requirement

  1. Dialog flow๋ฅผ ํ†ตํ•ด ์ •ํ•ด์ง„ ์งˆ์˜ ์‘๋‹ต์„ ์ž‘์„ฑ (WIKI ์ฐธ์กฐ)
  2. Dialog flow API๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ Google Cloud Platform์—์„œ ํ•ด๋‹น Dialogflow project ์ฐพ์€ ํ›„์— ์ธ์ฆ ํ‚ค ๋ฐœ๊ธ‰ (https://github.com/googleapis/nodejs-dialogflow ์ฐธ์กฐ)
  3. Json ํŒŒ์ผ ๋ฐœ๊ธ‰ ํ›„ public ํŒŒ์ผ ์•ˆ์— ๋„ฃ์–ด์ค๋‹ˆ๋‹ค. (Chatbot ํŒŒ์ผ๊ณผ ๊ฐ™์€ ์œ„์น˜์—)
  4. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜ (ํ•ด๋‹น ๋””๋ ‰ํ† ๋ฆฌ(Chatbot) ๊ฒฝ๋กœ ๋ณ€๊ฒฝ ํ›„ ์„ค์น˜)
  npm init
  npm I dialogflow
  npm install uuid express body-parser

chatbot api.js

  1. ์•„๋ž˜ ํ•ด๋‹น ์ฃผ์„ ์œ„์น˜์— ๋‚ด์šฉ ์ถ”๊ฐ€
var serviceAccount = require("") // firebase json file position
admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "" // firebase database url
});
  1. child ๋‚ด๋ถ€์— ์ž์‹ ์˜ firebase uid ์ถ”๊ฐ€
  db.ref('anxiety information').child('').push().set(newContact2); //myUid
  db.ref('anxiety information for report').child('').set(newContact2); //myuid
  1. ์•„๋ž˜ function์˜ ์ฃผ์„ ์œ„์น˜์— ์ •๋ณด ์ถ”๊ฐ€
async function runSample(msg, projectId = '') { // project name
  const sessionClient = new dialogflow.SessionsClient({
    keyFilename:"" //json file position
  });
  const sessionPath = sessionClient.projectAgentSessionPath(projectId, sessionId);
  const request = {
    session: sessionPath,
    queryInput: {
      text: {
        text: msg,
        languageCode: 'en-US',
      },
    },
  };

Dialogflow Web Chatbot ์‹คํ–‰ ๋ฐฉ๋ฒ•

  1. cmd์—์„œ chatbot.js๊ฐ€ ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™
  2. ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ช…๋ น์–ด ์‹คํ–‰
  node chatbot api.js
  1. first_counsel.html / second_html ์— ๋“ค์–ด๊ฐ€์„œ ์›ํ•˜๋Š” ๋ง์„ ์ ๋Š”๋‹ค
  2. ์ดํ›„์— rule๋œ chatbot ๋Œ€๋‹ต์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

KoGPT2 Web Chatbot ์‹คํ–‰ ๋ฐฉ๋ฒ•

(KoGPT2 training ๋ฐฉ๋ฒ• https://github.com/haven-jeon/KoGPT2-chatbot ์ฐธ์กฐ)

  1. answering.py ์‹คํ–‰
  2. nodejs์˜ local ์„œ๋ฒ„ ์‹คํ–‰
  3. deep_counsel.html์— ์›ํ•˜๋Š” ๋ง์„ ์ ๋Š”๋‹ค.
  4. ์ผ์ • ์‹œ๊ฐ„ ํ›„์— ๋”ฅ๋Ÿฌ๋‹ Chatbot์˜ ๋Œ€๋‹ต์„ ํ™•์ธํ•  ํ•  ์ˆ˜ ์žˆ์Œ

โ€ป ๋ฐ์ดํ„ฐ ์…‹ ์ข…๋ฅ˜

webchatbotapi's People

Contributors

ansehoon1999 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.