使用工具 – FancyAI

FancyAI網址: https://www.fancyai.co/
可輕鬆使用GPT大語言模型知識庫,介面化匯入文件(PDF, CSV, TXT)或網址,讓FANCY AI迅速掌握您的知識進行問答。只需30秒,即可與LINE官方帳號整合,建立分享知識Bot連結。更有視覺化的工作流程編排和對話紀錄功能!

FANCY AI 能力
- AI ChatGPT知識客服: 結合你自己專屬知識,ChatGPT 24/7 的為您的用戶服務
- 超快速精準匯入處理:自動分段,輸入,拆成問答,多種方式讓您處理的數據 (支持PDF,CSV,TXT,網址)
- 簡單直覺操作AI大模型問答介面:讓你設定你專屬AI回答流程,可以自訂預設開場白,選擇性問題,個性化你的AI
- 30秒串接好LINE官方帳號,分享連結:結合你的知識庫,LINE官方帳號直接用ChatGPT不間斷服務。
步驟一、創建OpenAI開發者使用的密鑰
首先要去你的OpenAI開發者平台,創建你的API Keys: https://platform.openai.com/api-keys。這樣其他應用程式才可以呼叫你的OpenAI帳號下的API(然後扣你的錢)

接著就是要付款給OpenAI,點此付款: https://platform.openai.com/account/billing/overview。單次可購買$5~$95美金(也就是最低約150左右)
OpenAI的API使用需要付費,價格資訊如下: https://openai.com/pricing


由上圖可知道,OpenAI的API計費單位為Token,下面會解釋甚麼叫做Token,也可以線上去測試某段文字的Token數量是多少,可以更精準地了解可能的花費。
可選擇模型的比較

甚麼是Token
在 API 處理提示之前,輸入會被分解為Tokens 。這些Tokens並未準確地在單字開始或結束的位置進行切割 – Tokens可以包含尾隨空格甚至子單字。
以下是一些幫助理解Token長度的有用經驗規則:
- 1 個標記 ~= 4 個英文字符
- 1 個令牌 ~= 3/4 個單字
- 100 個標記 ~= 75 個單字
- 1-2 句 ~= 30 個標記
- 1 段 ~= 100 個標記
- 1,500 個單字 ~= 2048 個標記
Token切割測試工具: https://platform.openai.com/tokenizer
步驟二、創建Line Bot帳號並為串接做準備
首先要申請一個Line API串接的開發者帳號: https://developers.line.biz/console/
創建帳號流程如下:
- 找到Providers -> 點選Create創建新的Providers
- 點選你剛剛創建的Providers: https://developers.line.biz/console/provider/{ID}
- 選擇Create a new channel -> Messaging API

設定你的LINE BOT帳號為使用Webhook
接著這邊是在分享時未設定的部分,就是把預設的固定回復關掉,開啟 LINE Official Account Manager

打開Webhook並且關閉自動回應訊息,這樣所收到的訊息才會傳到我們的API裡面

步驟三、創建FancyAI帳號
創建帳號之後,首先要把帳號和你的OpenAI綁定,點OpenAI帳號後,把剛剛第一步驟創建的Key貼進去,這樣FancyAI才能夠呼叫你的OpenAI API

Fancy AI: https://www.fancyai.co/
新建一個應用,選擇簡單對話

設定與Line的串接 – 設定API秘鑰

Line Channel Access Token: 瀏覽剛剛創建的Line帳號的頁面MessageAPI -> Channel access token -> Issue將出現的字串複製進去

Line Channel Secret位於Basic settings下方

接著告訴Line要API的webhook位置: 選擇”應用>你的應用名字>Line API”

把這邊的webhook網址貼到剛剛LINE Developer的webhook設定位置

接著就可以測試你的機器人囉!!
