Angular 8 Dialogflow catbot with api-ai-javascript@2.0.0-bet



我的 angular 8 应用程序在 Chrome 和 IE11 上运行良好。 但是现在在我添加了聊天机器人代码后,它没有在IE11上加载,该代码在api-ai-javascript@2.0.0-beta.21 lib的帮助下与Dialogflow通信。它在铬上工作正常。 另外,我在IE控制台上没有看到任何错误。

我关注了几乎所有关于类似主题的可用链接,并体验到即使是 Github 上可用的示例也以类似的方式运行。如果您在 chrome 上打开它,它可以工作,但在 IE11 中不起作用。同样,这个GitHub示例在Chrome上运行良好,但在IE11上则不然。

如果有人能指导我,那将有很大帮助。因此,聊天机器人代码也开始在IE11上运行。

如果需要答案,我愿意发布任何代码。这是我的聊天服务类。

import { ApiAiClient } from 'api-ai-javascript/es6/ApiAiClient';
....
export class ChatService {
....
readonly client = new ApiAiClient({ accessToken: this.token });
....
public converse(msg: string) {
const userMessage = new Msg(msg, 'user');
this.update(userMessage);
return this.client.textRequest(msg) 
.then(res => { 
const speech = res.result.fulfillment.speech; 
const botMessage = new Msg(speech, 'bot'); 
this.update(botMessage); 
});
}
....

已弃用

此 Dialogflow客户端库和 Dialogflow API V1 已 已弃用,将于 2019 年 10 月 23 日关闭。请迁移 到 Dialogflow API V2。

对于 API V2,您可以遵循 https://chatbotslife.com/dialogflow-v2-rest-api-communication-6cf7ab66ab36

最新更新