Discourseにスマートチャットボットを設定する🤖

こんにちは、

数週間の試行錯誤の末、ついに Discobot に似た、学習機能を持ち、より応答性の高い AI ボットの構築に成功しました。興味のある方のために、その手順をご紹介します。手順は少し多いですが、すべて設定し終えれば、その結果は素晴らしいものです。

  1. Discourse 用の hubot プラグインをインストールします。Hubot Adapter for Discourse
    Discourse 上に hubot をインストールするには、(yourhubotfolder)/bin/hubot ファイルに HUBOT_DISCOURSE_USERNAME などの hubot 変数を入力します。nano やエディタで編集し、export HUBOT_DISCOURSE_USERNAME=mybot と記述してください。詳細は こちら をご覧ください。Discobot for training - #10 by featheredtoast

  2. https://dialogflow.com/ でアカウントを作成し、新しいボットを作成します。

  3. ここから hubot / apiai (dialogflow) アダプターをインストールします: GitHub - ojacques/hubot-apiai: Add smartness and conversational UX to Hubot with API.AI as back-end · GitHub
    3a. bin/hubot ファイルで、以下の変数が設定されていることを確認してください。

    export HUBOT_DISCOURSE_USERNAME=(ボットのユーザー名、discobot は使用しないでください)
    export HUBOT_DISCOURSE_KEY=(ボットユーザーの API キー。サイト全体の API キーではありません)
    export HUBOT_DISCOURSE_SERVER=(Discourse の URL)
    export API_AI_CLIENT_ACCESS_TOKEN=(Dialogflow ボットサーバーの API。設定画面で確認できます)
    export GOOGLE_APPLICATION_CREDENTIALS=(yourjson).json
    export DIALOGFLOW_PROJECT_ID=(プロジェクト名)

    Google のアプリケーション認証情報 JSON をダウンロードする必要があります。これは、以下のガイドに従って取得できます: https://cloud.google.com/genomics/downloading-credentials-for-api-access

  4. bin/hubot -a discourse-adapter と入力して hubot を起動します。ターミナルを閉じても実行し続けたい場合は、nohup bin/hubot -a discourse-adapter & と入力してください。

  5. ボットにプライベートメッセージを送ってテストしてください。Dialogflow ボットに「雑談」機能を設定していれば、すぐに「こんにちは」「元気ですか」と話しかけて雑談を楽しむことができます。その他の会話フローは別途設定が必要です。始めるのに役立つ YouTube のチュートリアルがいくつかあります。https://youtu.be/HqfN9qjNj9A

デモはこちらです。

ご質問がございましたら、お気軽にお尋ねください。

また、Discourse を開発してくださった @codinghorror とチーム、そして hubot プラグインを開発してくださった @awole20 に心から感謝申し上げます。みなさんのおかげで実現できました!

「いいね!」 38

This is just plain awesome! I am not too experienced with this myself, but do you know if this would work to deploy on Heroku or not? Thanks for the tutorial!

「いいね!」 1

Hubot is indeed able to be installed on Heroku - check out the Hubot docs for more info: Deploying to Heroku | HUBOT

「いいね!」 5

That’s cool. I’ll look further into this.

「いいね!」 1

@awole20 @Timothy_Vail I know I sound absolutely hilarious by saying this, but is there any way to make a bot that you guys know of without being an admin (a.k.a having an api key)?

「いいね!」 1

You need to be the admin of not only discourse but of the server it sits on. No way around that one.

「いいね!」 3

That´s a bummer. Thanks for the information though.

「いいね!」 1

I am slowly working my way through this. What threw me at the first stage was access errors when running yo hubot --adapter=discourse-adapter per the installation instructions for the plugin. It looks like you have to change the permission for the folders. Fix is documented here.

「いいね!」 1

So, as I discussed above, I hit an error installing NPM. Error was using root when installing, a common gotcha that leads to a lot of EACCES and permission errors. This is a well-documented error. I believe a lot of people are on Digital Ocean. Follow their documentation for correctly setting up NPM on your droplet.

ティム、共有してくれてありがとう。チャットボットでどのようなタイプの対話を設定しているのか気になります。実際の現場では、フォーラムのユーザーがどのようにそれとやり取りしているのでしょうか?

「いいね!」 4

ナチョさん、こんにちは。

チャットボットを利用したのは随分前になりますが、近々始まるプロジェクトで再度使う予定です。主に教師向けの研修セッションで使用しており、チャットボットを使ってコースを進めながら、対話を通じて教育について学んでいました。ご質問がございましたら、お知らせください。

「いいね!」 5

ありがとう、素晴らしい投稿ですね!大好きです

「いいね!」 2

すばらしく、この内容を最近よく考えています。
Discourse サイトに AI を導入したいですね。

「いいね!」 3

このDiscourseに実装する前に(そして、私はそれほど熟練していませんが、指示に従うのは得意です :nerd_face: )…このスレッドの指示はまだ機能していますか?それとも…AIボットを統合するための、より新しい、または推奨される方法はありますか?

「いいね!」 3

いくつかの会話がありました。こちらが最近の進展に関するものです。

「いいね!」 2