Flutter对话流不接受查询中的空间

时间:2019-09-11 12:01:22

标签: flutter dialogflow

Flutter对话流不接受查询中的空间。给dialogflow客户端的查询不接受空间。例如,允许“ Hi”,但不允许“ Hi”,因为它有空间。同样,它只接受一个单词,而不接受句子(因为它带有带空格的单词)。需要帮助。

import 'package:flutter_dialogflow/flutter_dialogflow.dart'; 
 void Response(query) async {
    _textController.clear();
    print("BLB calling $query= ${query.toString().trim()}");
    Dialogflow dialogflow =Dialogflow(token: "**api_key**");
    AIResponse response = await dialogflow.sendQuery(query).catchError((error){print("BLB $error ");});
    print("BLB called ${response.getStatus.getCode}");
    ChatMessage message = new ChatMessage(
      text: response.getMessageResponse(),
      name: "Eva the Bot",
      type: false,
    );
    //Tts.speak(response.getMessageResponse());
    setState(() {
      _messages.insert(0, message);
    });
  }

错误消息:FormatException: Context name should contain only Latin letters (a-z A-Z), digits (0-9), underscore (_), and hyphen (-). Code: 400 对话框流在控制台中运行完美(右侧的“立即尝试”)。:(

1 个答案:

答案 0 :(得分:1)

最好的解决方案是使用API​​ V2,它没有这个问题。 使用this tutorial进行设置。

由于API V1 will be shut down on October 23, 2019

,您还是必须这样做