4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

英語チャットしませんか?ChatGPTで

Last updated at Posted at 2023-10-29

英語、たまに使いたくなりますよね

ありますよね〜。
英語という言語の性質のためであるか、単に自分の語彙や経験がなく、直接的な表現しかできないためであるのか、英語を使う方が思考がオープンになるのが良くて英語を使いたくなる時がありますよね。
しかし、周囲に英語を日常的に使用する人もいない、英会話を申し込むほどの熱量もないので、できれば人目につかず、かつ気軽に英語を使いたい。 
そのような気持ちで、今回はLINEbotとChatGPT、Google spread apiを使って英語でチャット&わからない単語をメモする機能を作りました。

英語チャットとメモを使ってみる

LINE_capture1.JPG

ChatGPT英語上手いですね...(当たり前だ)
そして途中でわからなかった単語をメモします。

LINE_capture2.JPG

word:XXXX
mean:YYYY
とチャットするとGoogle Sheetに以下のように記載されます。

・書き込み前
before.png

・書き込み後
after.png

わざわざChatGPTのwebサイトにアクセスしなくて良いし、メモを取ることまでLINEで完結できるのは便利ですね。

作り方

フロー図

flow.png

JSON

こちらから動かしたフロー図を取り込むことができます。

JSON
[{"id":"eea0f2d5aaf39d18","type":"ReplyMessage","z":"08d108c30d36726c","name":"","replyMessage":"stocked!","credentials":{"channelSecret":"","channelAccessToken":""},"x":920,"y":120,"wires":[]},{"id":"1c3c2a6006c8cc0c","type":"GSheet","z":"08d108c30d36726c","creds":"1b3a0ef2ce42bb1b","method":"append","action":"","sheet":"","cells":"sheet1!A2","flatten":false,"name":"","x":690,"y":120,"wires":[["eea0f2d5aaf39d18"]]},{"id":"b60288a73a2230fc","type":"change","z":"08d108c30d36726c","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"word:","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"mean:","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":120,"wires":[["1c3c2a6006c8cc0c"]]},{"id":"b1a66c50a0af3bd2","type":"switch","z":"08d108c30d36726c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"word:","vt":"str"},{"t":"cont","v":"mean:","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":3,"x":290,"y":160,"wires":[["b60288a73a2230fc"],["b60288a73a2230fc"],["9dee05ac480f2bdb"]]},{"id":"ddc57e0b453518b7","type":"Webhook","z":"08d108c30d36726c","name":"","url":"/webhook","x":100,"y":160,"wires":[["b1a66c50a0af3bd2"]]},{"id":"9dee05ac480f2bdb","type":"simple-chatgpt","z":"08d108c30d36726c","name":"","Token":"","Model":"","SystemSetting":"you are my friend. you are from America.","functions":"","functionsType":"str","function_call":"auto","function_callType":"str","x":480,"y":220,"wires":[["7a8fbd2d67f7f7cc"]]},{"id":"7a8fbd2d67f7f7cc","type":"ReplyMessage","z":"08d108c30d36726c","name":"","replyMessage":"","credentials":{"channelSecret":"","channelAccessToken":""},"x":680,"y":220,"wires":[]},{"id":"1b3a0ef2ce42bb1b","type":"gauth","name":"Unknown","credentials":{"creds":""}}]

作成環境

Node-RED (ver3.0.2)
FlowForge  
Line Developers
ChatGPT
Google Sheet API

LINEbot ⇔ ChatGPT をつなぐ

  1. ChatGPTを利用するため、シークレットキーを取得

2.LINE Messaging APIを利用するため、チャネルシークレットとチャネルアクセストークンを取得する。

line-messaging-apinode-red-contrib-simple-chatgptノードを使用することで、LINEbotのトーク上でChatGTPを使用することができました!

LINEbot ⇔ Google spread api をつなぐ

  1. Google Sheet APIを利用するため、シークレットキーを取得

node-red-contrib-google-sheetsノードを使用することでLINEbotに送ったテキストメッセージをGoogle Sheetに書き込むことができるようになりました!

その他の参考リンク

どうせなら英会話もやりたい

テキスト入力ではなく、音声入力にしてChaGPTと英会話したいですね。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?