GithubHelp home page GithubHelp logo

victorrancescode / flutter_dialogflow Goto Github PK

View Code? Open in Web Editor NEW
214.0 214.0 73.0 584 KB

Flutter package for makes it easy to integrate dialogflow and support dialogflow v2

License: Apache License 2.0

Java 0.83% Swift 0.91% Objective-C 0.08% Dart 97.03% Shell 1.15%

flutter_dialogflow's People

Contributors

hritik14 avatar misterfifi1 avatar victorrancescode avatar yugandh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_dialogflow's Issues

Where to get the Webhook Fulfilment response?

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?

How to set audio response?

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.

Publish new version

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

ERROR: Tried calling: []("queryText")

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.

Issues using flutter knowledgebase responses

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.

How to get suggestions in v2?

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:

  • Should I use the responses from these platforms to get suggestions?
  • Should I set custom suggestions in payload and get them from it?
  • If I want to get suggestions from each platform or from payload, how can I access to them using dialogflow_v2?

outputAudio

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.

dart packages error with dialogflow dependencies

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

AuthGoogle(fileJson)

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

don't include both `QuickReplies.html` and `quickReplies.html`

See dart-lang/pub#2072

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

probar con diferentes dispositivos (emulador y dispositvo real)

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.

Outdated package and a solution (DialogFlowtter)

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.

How to secure JSON file for v2 version

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.

detectIntent function ERROR

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 null

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

[BUG] Invalid context appearing in request

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

HTTP Version Resolving

When we try to include both http and flutter_dialogflow in same application, we are getting an version resolving issue.

Response with card

I want to know how to handle a response with a card. and i got some error when i try to get response with a card. How can i map this response
Untitled

Authentication

It would be great if authentication could be added to this plugin.

How to authenticate user?

How do I authenticate users, and save unique user data per UID.. Is there anyway already available to do in flutter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.