victorrancescode / flutter_dialogflow Goto Github PK
View Code? Open in Web Editor NEWFlutter package for makes it easy to integrate dialogflow and support dialogflow v2
License: Apache License 2.0
Flutter package for makes it easy to integrate dialogflow and support dialogflow v2
License: Apache License 2.0
lib/v2/dialogflow_v2.dart (Line : 132)
String body = '{"queryInput":{"text":{"text":"$query","language_code":"$language"}}, "queryParams": $queryParams}';
In that need to add input audio and audioConfig.
I used the firebase JSON file by mistake for another project. After it my original project throws that error when importing the dialogflow JSON file (GoogleAuth method). I tried refreshing the dialogflow service account. That generated a key I can’t download. All I can do is create a new key and import that one. The error persists.
https://blog.timekit.io/google-oauth-invalid-grant-nightmare-and-how-to-fix-it-9f4efaf1da35
I see having a "timestamp" property in v1 but not in v2.
How can I get the "timestamp" of a response in v2 api?
Am using v2 of dialogflow and trying to implement it with external webhook. How to integrate it with the app? Where can I find the fulfilment response rather than raw api response which just gives me a message "Webhook execution successful".
Following is my raw response :
{
"responseId": "0xx6xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx-xxxxxxx",
"queryResult": {
"queryText": "I want to get the list of all records",
"parameters": {
"Entity": "ListofAllRecords"
},
"allRequiredParamsPresent": true,
"fulfillmentText": "We have 25 records",
"fulfillmentMessages": [
{
"text": {
"text": [
"We have 25 records"
]
}
}
],
"intent": {
"name": "projects/{project-id}/agent/intents/{id}",
"displayName": "Records Detail"
},
"intentDetectionConfidence": 0.54289836,
"diagnosticInfo": {
"webhook_latency_ms": 89
},
"languageCode": "en"
},
"webhookStatus": {
"message": "Webhook execution successful"
}
}
Fulfilment response in DialogFlow WEBsite itself which calls the external socket.io webhook:
{ response: [ {id: 1, name: 'record1'}, {id: 2, name: 'record2'} ] }
How to access the second response using this plugin?
Hi,
The example is a sword, it works great! but how do you get an audio response? or how do I perform the audio response in flutter?
Thanks to those who answer.
Hello, can you please publish the new version of your plugin .
The actual version depends on http ^0.11.3+16 or in your source pubspec.yaml it depends on
http: ^0.12.0+2
import 'package:flutter/material.dart';
import 'package:flutter_dialogflow/dialogflow_v2.dart';
class Home extends StatefulWidget {
Home({Key key}) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
String query = "hi";
void _sendQuery() async {
try {
AuthGoogle authGoogle = await AuthGoogle(fileJson: "assets/dependencies/dialogflow.json").build();
Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH);
print(dialogflow.toString());
AIResponse response = await dialogflow.detectIntent(query);
print(response.getMessage());
} catch(e) {
print('------------------------------${e.toString()}');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Ask Now'),
),
body: RaisedButton(
onPressed: _sendQuery,
color: Colors.black87,
child: Text('Send Query', style: TextStyle(color: Colors.white)),
),
);
}
}
ERROR LOG -
I/flutter ( 9861): Instance of 'Dialogflow'
I/flutter ( 9861): ------------------------------NoSuchMethodError: The method '[]' was called on null.
I/flutter ( 9861): Receiver: null
I/flutter ( 9861): Tried calling: []("queryText")
I've taken all the necessary steps in my view. Is there anything missing out? in the code or in the process of GCP Json file downloading. I've not verified the OAuth screen though. And my GCP account is NOT payment verified.
Normal responses receiving answers with assigned intents are working correctly. However, when a response using knowledge connector is used. I receive the error:
NoSuchMethodError (NoSuchMethodError: The method '[]' was called on null.
Receiver: null
Tried calling: )
There appears to be a response returned specific for using knowledge connectors that is not being handled correctly.
Hi, I have some doubts about how I should show suggested replies to the user.
I noticed in Dialogflow that some specific platforms like Google, Facebook, Slack, Skype have suggestion chips or quick replies, also I see that it's possible to add a custom payload with custom JSON. So, if I'm making a chatbot in my Flutter app, here are my questions:
Hi,
Not sure who's maintaining the repo on this. I'm sure this is a pretty popular request.
But one suggestion is to include the outputAudio in the AIResponse class:
class OutputAudio {
ByteData _outputAudio;
...
}
class AIResponse {
String _responseId;
QueryResult _queryResult;
num _intentDetectionConfidence;
String _languageCode;
DiagnosticInfo _diagnosticInfo;
WebhookStatus _webhookStatus;
OutputAudio _outputAudio; // define and add OutputAudio class
AIResponse({Map body}) {
// add this
_outputAudio = body['outputAudio'];
_responseId = body['responseId'];
_intentDetectionConfidence = body['intentDetectionConfidence'];
_queryResult = new QueryResult(body['queryResult']);
_languageCode = body['languageCode'];
_diagnosticInfo = (body['diagnosticInfo'] != null
? new DiagnosticInfo(body['diagnosticInfo'])
: null);
_webhookStatus = body['webhookStatus'] != null
? new WebhookStatus(body['webhookStatus'])
: null;
}"
// and finally, add one getter:
OutputAudio get outputAudio {
return _outputAudio;
}
You can then choose to use any audio player on the output audio.
Just a suggestion.
my pubspec.yaml
name: myapp
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
flutter_dialogflow: 0.1.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/My Project-97cd26790e30.json
Running "flutter packages get" in myapp...
Could not un-tar (exit code 2). Error:
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Processing archive: C:\Users\XXXXX\AppData\Local\Temp\pub_1498e884-f4c5-11e8-97dd-ac9e17ba5b07\data.tar
Extracting doc\api\__404error.html
Extracting doc\api\categories.json
Extracting doc\api\flutter_dialogflow\AIResponse-class.html
Extracting doc\api\flutter_dialogflow\AIResponse\AIResponse.html
...
Extracting doc\api\v2_message\QuickReplies\operator_equals.html
file doc\api\v2_message\QuickReplies\quickReplies.html
already exists. Overwrite with
doc\api\v2_message\QuickReplies\quickReplies.html?
(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit?
ERROR: Can't allocate required memory!
package:pub/src/io.dart 944:7 _extractTarGzWindows.<fn>
===== asynchronous gap ===========================
package:pub/src/io.dart 821:20 withTempDir
===== asynchronous gap ===========================
package:pub/src/io.dart 915:10 _extractTarGzWindows
package:pub/src/io.dart 843:18 extractTarGz
===== asynchronous gap ===========================
package:pub/src/source/hosted.dart 302:11 BoundHostedSource._download
===== asynchronous gap ===========================
package:pub/src/source/hosted.dart 196:13 BoundHostedSource.downloadToSystemCache
===== asynchronous gap ===========================
package:pub/src/entrypoint.dart 371:48 Entrypoint._get.<fn>
===== asynchronous gap ===========================
dart:async runZoned
package:pub/src/http.dart 272:10 withDependencyType
package:pub/src/entrypoint.dart 367:12 Entrypoint._get
dart:async Future.wait
package:pub/src/entrypoint.dart 228:18 Entrypoint.acquireDependencies
dart:async _completeOnAsyncReturn
package:pub/src/solver/version_solver.dart VersionSolver.solve
dart:async _completeOnAsyncReturn
package:pub/src/solver/version_solver.dart VersionSolver._result
This is an unexpected error. Please run
pub --trace --verbosity=warning get --no-precompile
and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
Hi,
During a conversation in Flutter I am unable to a respond based on "Parameters and Values" of Dialogflow.
For example, if customer is using "city name" I have to respond it and tell him "current-Time" in that "City".
Thanks a lot.
Hi
Is it possible for me to use a Json file that is not in Assets (defined in pubspec)? I would like to read a dynamic Json file.
Ex:
await AuthGoogle (fileJson: url)
Thank you
Luciano
Unfortunately, I cannot use this package with Flutter. Any timetable on a possible upgrade?
In general, I would discourage checking the doc/api/
folder into source control, and I would also discourage you from having it in your folder when publishing as it gets included in the package on pub..
The problem in this case is probably (just guessing), that you renamed quickReplies
to QuickReplies
(or maybe you have two types with same name, only one is lowercase) and suddenly you have two files with the same name (except one is lowercase, the other is uppercase)... Such packages won't work on Windows, since the filesystem is case insensitive (case preserving).
Note: if you think you actually generated documentation producing both QuickReplies.html
and quickReplies.html
, then please make a small test-case that reproduces this and file an issue with: https://github.com/dart-lang/dartdoc
hola que tal!
primero dejame felicitarte por este gran tutorial sobre chatbots con flutter, es un muy buen trabajo.
ahora quisiera preguntar , por qué la app cuando funciona en un emulador , el bot responde pero cuando ejecuto en mi teléfono móvil no pasa lo mismo?
muchas gracias un cordial saludo.
Hi everyone.
As all of us know, this package seems to be outdated and abandoned by its author. Since I was using it and noticed some areas of opportunity and, most importantly, the chance to get a package that is always updated, I created another package called DialogFlowtter.
This package aims to solve the problems that this one has and to be maintained a lot of time, even donate it to the community.
Feel free to check it out here: https://pub.dev/packages/dialog_flowtter/
Leave your feedback and issues in the Github Repo
I hope the package can help you with your development journey.
Hi,
In the DialogFlow v2 version. The JSON file is needed to be secured and should not be shipped in the app. Can you please guide how to secure that file in the Flutter App?
Thanks.
NoSuchMethodError: The method '[]' was called on null.
I/flutter ( 4808): Receiver: null
I/flutter ( 4808): Tried calling:
above error is thrown when a input is sent through the post request.
var response = await authGoogle.post(_getUrl(),
headers: {
HttpHeaders.authorizationHeader: "Bearer ${authGoogle.getToken}"
},
body: body);
CAN SOMEONE FIX THIS ISSUE OR AT LEAST EXPLAIN THE SOLUTION? I"M WILLING TO LISTEN AND LEARN
intentDetectionConfidence is coming inside query set in dialogflow v2.0
but in your code you reading intentDetectionConfidence as response.body['intentDetectionConfidence'] but you should read as response.body['queryResult']['intentDetectionConfidence'] or add intentDetectionConfidence in queryResult class.
Please make the update in package and push it
Please upgrade the HTTP version it depend on
I need the latest vesion ASAP
Hi,
Is there a way to store chat conversation in firestore ?
My code is giving error at AIResponse response = await dialogflow.sendQuery(query);
. I am using webhook through my own server for response. But the error comes before hitting webhook and says that
Context should contain only Latin letters, digits and underscore [a-z0–9_].
When I am checking my request json, it shows contexts key in json as
{contexts: fashion exhibition, lifespan: 2, parameters : {} }
We can never set contexts on Dialogflow console to anything with spaces or special characters. It doesn't allow us to do that. And to clear, fashion exhibition
is one of the smart reply and I am not at all setting context to this. This is automatically happening in each request. It only works when smart reply doesn't contain any spaces.
Please help, my app is broken and this happened only 3 weeks ago. It was working fine before that
When we try to include both http and flutter_dialogflow in same application, we are getting an version resolving issue.
It would be great if authentication could be added to this plugin.
How do I authenticate users, and save unique user data per UID.. Is there anyway already available to do in flutter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.