v0.1.3
flutter_dialogflow
Flutter 套件,可輕鬆整合 Dialogflow 並支援 Dialogflow v2
50喜歡 38近 30 天下載40Pub 分數
平台暫無資料
Flutter 套件,可輕鬆整合 Dialogflow 並支援 Dialogflow v2
{"sdk":"flutter"}^0.12.0+2^0.2.6—{"sdk":"flutter"}以下為英文專案原文快照,最新內容請造訪 GitHub。
Dialogflow
A new Flutter package.
https://raw.githubusercontent.com/VictorRancesCode/flutter_dialogflow/HEAD/image1.png
Thanks for the tutorials!
dependencies:
flutter_dialogflow: ^0.1.0
$ flutter packages get
import 'package:flutter_dialogflow/flutter_dialogflow.dart';
import 'package:flutter_dialogflow/dialogflow_v2.dart';
Dialogflow dialogflow = Dialogflow(token: "Your Token");
AIResponse response = await dialogflow.sendQuery("Your Query");
void Response(query) async {
Dialogflow dialogflow = Dialogflow(token: "10178f9cb6cf12321asdf4aae75c87cd");
AIResponse response = await dialogflow.sendQuery(query);
print(response.getMessageResponse());
}
flutter:
uses-material-design: true
assets:
- assets/your_file_downloaded_google_cloud.json
import 'package:flutter_dialogflow/dialogflow_v2.dart';
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");
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())
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
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
Visit the repository: Flutter Dialogflow Web 🚀