搜尋套件、儲存庫與 APP 分類

套件詳情v0.1.3

flutter_dialogflow

Flutter 套件,可輕鬆整合 Dialogflow 並支援 Dialogflow v2

近 30 天下載
122
喜歡數
50
Pub 分數
40

安裝套件

flutter pub add flutter_dialogflow

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個簡化與 Dialogflow 集成的 Flutter 套件,支援 Dialogflow v2。它讓開發者能夠透過將 Flutter 應用連接到 Dialogflow 代理來建立對話式介面,實現自然語言理解與意圖辨識。該套件處理與 Dialogflow API 的通訊,允許與由 Dialogflow 驅動的聊天機器人進行即時互動。專為跨平台 Flutter 應用的無縫使用而設計,提供一種簡單的方式來實現不需要深入後端設定的 AI 驅動對話。非常適合行動應用中的聊天機器人功能。

適用情境

  • 將聊天機器人整合到行動應用程式中
  • 即時使用者意圖偵測
  • 建構客戶支援機器人
  • 啟用語音或文字互動
  • 建立人工智慧驅動的虛擬助理

主要特色

  • 支援 Dialogflow v2
  • Flutter 的簡單 API
  • 即時對話處理
  • 跨平台相容性
  • 與 Dialogflow 代理的輕鬆整合

適合對象

  • 開發聊天機器人功能的開發者
  • 需要自然語言處理的應用程式
  • 具有AI驅動互動的移動應用
  • 使用 Dialogflow 進行 NLP 的團隊
  • 需要快速機器人整合的項目

使用建議

  • 需要設定 Dialogflow 代理
  • 依賴互聯網連接
  • 限制為 Dialogflow v2
  • 無內建翻譯支援
  • 透過服務帳戶金鑰進行驗證

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Dialogflow v1 & v2 for Flutter apps.

Dialogflow

:heart: Star :heart: the repo to support the project. Thanks!

A new Flutter package.

Awesome Tutorials

Thanks for the tutorials!

Installation

  • Add this to your package's pubspec.yaml file:
dependencies:
  flutter_dialogflow: ^0.1.0
  • You can install packages from the command line: with Flutter:
$ flutter packages get
  • Dialogflow v1 Import it Now in your Dart code, you can use:
 import 'package:flutter_dialogflow/flutter_dialogflow.dart';
  • Or Dialogflow v2 Import it Now in your Dart code, you can use:
 import 'package:flutter_dialogflow/dialogflow_v2.dart';

Usage

Dialogflow v1
  • Dialogflow register and create new Agent
  • Copy Api key (Token)
  • Code
  Dialogflow dialogflow = Dialogflow(token: "Your Token");
  AIResponse response = await dialogflow.sendQuery("Your Query");
  • Example
  void Response(query) async {
    Dialogflow dialogflow = Dialogflow(token: "10178f9cb6cf12321asdf4aae75c87cd");
    AIResponse response = await dialogflow.sendQuery(query);
    print(response.getMessageResponse());
  }
Dialogflow v2
  • Dialogflow](https://dialogflow.com/) register and create new Agent
  • Project Setup and Authentication
    • First of all, we need to create a Google Cloud Platform Project using Console Google Cloud
    • Create or select an existing GCP project.
    • From the GCP console, go to APIs and Services and click on credentials.
    • Click on Create credentials and choose Service account key.
    • Select your service account from the dropdown, choose JSON and click Create. This will download the JSON key to your computer. Save it securely.
    • We downloaded a JSON file with all our data.
  • In your project create folder assets(folder name recommended optional)
  • Move file json in your project in folder created
  • open file pubspec.yaml
flutter:
  uses-material-design: true
  assets:
    - assets/your_file_downloaded_google_cloud.json
  • Import dialogflow_v2
import 'package:flutter_dialogflow/dialogflow_v2.dart';
  • Code
  AuthGoogle authGoogle = await AuthGoogle(fileJson: "Asset Your File Json").build();
  // Select Language.ENGLISH or Language.SPANISH or others...
  Dialogflow dialogflow =Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH); 
  AIResponse response = await dialogflow.detectIntent("Your Query");
  • Example
  AuthGoogle authGoogle = await AuthGoogle(fileJson: "assets/your_file_downloaded_google_cloud.json").build();
  Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH);
  AIResponse response = await dialogflow.detectIntent("Hi!!!");
  print(response.getMessage())
  • Or Get List Message type Card
Call function response.getListMessage() 
response List<dynamic>
example 
new CardDialogflow(response.getListMessage()[0]).title
Convert first item in CardDialogflow for worked easy
CardDialogflow have
- title
- subtitle
- imageUri
- List buttonss
    - each button have text and postback
  • Or Setup custom authentication (session)
Get a session id from your backend server after authentication.(Eg: OAuth Token)
Pass the session id a named parameter 'sessionId' to AuthGoogle function.
On the dialogflow fulfillment, access it inside `agent.session` (WebhookClient.session)
and apply your session logic

Example:
  AuthGoogle authGoogle = await AuthGoogle(fileJson: "assets/your_file_downloaded_google_cloud.json", sessionId: "YOUR_CUSTOM_SESSION_ID").build();
  Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH);
  AIResponse response = await dialogflow.detectIntent("Hi!!!");
  print(response.getMessage())

Demo

Dialogflow For Flutter Web

Visit the repository: Flutter Dialogflow Web 🚀

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。