中文 | English
This project demonstrates how to build an intelligent customer service chatbot using the FAQ from Taoyuan Airport. The data can be replaced and modified as needed.
- Obtain the API Token from OpenAI:
- Register/login to an account on the OpenAI platform
- Click on the avatar in the upper right corner and select
View API keys
- Click on
Create new secret key
in the middle -> the generated key is theOPENAI_API_KEY
(which will be used later)
- Note: Each API has a free quota and restrictions, see OpenAI Pricing for details.
- Obtain the Line Token:
- Login to Line Developer
- Create a bot:
- Create a
Provider
-> ClickCreate
- Create a
Channel
-> SelectCreate a Messaging API channel
- Enter the required basic information
- After completing the input, there is a Channel Secret under
Basic Settings
-> ClickIssue
, the generated key is theLINE_CHANNEL_SECRET
(which will be used later) - Under
Messaging API
, there is aChannel access token
-> ClickIssue
, the generated key is theLINE_CHANNEL_ACCESS_TOKEN
(which will be used later)
- Create a
- Fork the Github project:
- Register/login to a GitHub account
- Go to ChatGPT-Customer-Service
- Click
Star
to support the developer - Click
Fork
to copy all the code to your repository
- Deploy (free space):
- Go to replit
- Register/login to an account
- Fork the ChatGPT-Customer-Service-HyperDB
- Environment variable settings
- After completing the
Fork
in the previous step, click onSecrets
on the left bottom corner of the project management page inReplit
. - Click
Got it
on the right to add environment variables, including:- The selected model:
- key:
OPENAI_API_KEY
- value:
[Obtained from step 1]
- key:
- Line Channel Secret:
- key:
LINE_CHANNEL_SECRET
- value:
[Obtained from step 1]
- key:
- Line Channel Access Token:
- key:
LINE_CHANNEL_ACCESS_TOKEN
- value:
[Obtained from step 1]
- key:
- The selected model:
- After completing the
- Execution:
- Click on
Run
on the top - After successful execution, the message
Hello World
will be displayed on the right side of the screen, and the URL on the top of the screen should be copied - Go back to the Line Developer, paste the URL obtained in the previous step above
Webhook URL
underMessaging API
, and add/callback
. For example:https://ChatGPT-Customer-Service-HyperDB.explainthis.repl.co/callback
- Open
Use webhook
below - Turn off
Auto-reply messages
below
- Note: If there is no request within one hour, the program will stop, so the next step is necessary.
- Click on
- CronJob sends requests regularly
- Register/Login to cron-job.org
- Select
CREATE CRONJOB
in the upper right corner of the dashboard - Enter
ChatGPT-Line-Bot
in theTitle
and enter the URL from the previous step. For example:https://ChatGPT-Customer-Service-HyperDB.explainthis.repl.co/
- Set to run every
5 minutes
below - Click
CREATE
Currently, the project will read the taoyuan-airport-faq
file, which has the following format:
category | question | answer |
---|---|---|
違禁品 | 安檢時碰到不得上機之危險(安)物品及違禁品,應如何處理? | 不得上機之危險(安)物品﹕例如超過100ml容器液體、防風型打火機、水果刀…等),需丟棄或改託運;違法違禁品(槍、武士刀、扁鑽、毒品…等),將遭航空警察局移送法辦。 |
違禁品 | 請問樂器該如何上飛機? | 大型樂器需託運,小型可置於機上隨身物品放置箱者可隨身攜帶。 |
違禁品 | 請問出境安檢手提行李的規定 (刮鬍刀、刮鬍泡... | 出境安檢手提行李規定:1. 電動刮鬍刀可以攜帶登機,丟棄式刮鬍刀、摺疊式刮鬍刀等有刀片外露形式者,禁止攜帶登機。 2. 刮鬍泡、容器... |
You can directly modify this file with the same format. After modifying the file, remember to delete the hyperdb.pickle.gz
file that was originally on the Replit website before running it again. The purpose of this file is to pre-process and store the file in Embedding. Therefore, when switching to a new dataset, the old file needs to be deleted.
You can try modifying the data_preprocessing
function in src/utils
.
If you like this project and would like to support us, you can buy us a coffee. This will be the driving force for us to continue moving forward!