搜索插件、代码仓与 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 项

源码仓库

使用此插件的项目

暂无相关数据。