打字稿中的 Dialogflow 端点类型
Dialogflow endpoint type in typescript
我已经在 Typescript 中为 Dialogflow 实现了一个 webhook,我希望我的 Google 端点只支持 Dialogflow SDK 对象。目前我的控制器看起来像这样:
import {dialogflow, DialogflowConversation} from "actions-on-google";
export class GoogleController {
public endpoint: any;
constructor() {
this.endpoint = dialogflow();
this.endpoint.intent("Welcome", (conv: DialogflowConversation) => {
return conv.ask("Hey There");
});
};
目前我已将端点设为任意类型,但我想将其更改为 Dialogflow 对象。我试过从 SDK 导入 DialogflowApp 对象,但这些似乎不起作用。它们要么与 dialogflow() 调用返回的对象不匹配,要么接口没有 .intent 函数。
有人知道如何实现吗?
在VSCode中打开一个项目,我写道:
import { dialogflow } from 'actions-on-google'
const endpoint = dialogflow()
将鼠标悬停在 endpoint
上,VSCode 显示变量的一些元数据:
const endpoint: OmniHandler & BaseApp & DialogflowApp<{}, {}, Contexts, DialogflowConversation<{}, {}, Contexts>>
也许您的 DialogflowApp
声明需要泛型,或者您可以直接复制该字符串。
我已经在 Typescript 中为 Dialogflow 实现了一个 webhook,我希望我的 Google 端点只支持 Dialogflow SDK 对象。目前我的控制器看起来像这样:
import {dialogflow, DialogflowConversation} from "actions-on-google";
export class GoogleController {
public endpoint: any;
constructor() {
this.endpoint = dialogflow();
this.endpoint.intent("Welcome", (conv: DialogflowConversation) => {
return conv.ask("Hey There");
});
};
目前我已将端点设为任意类型,但我想将其更改为 Dialogflow 对象。我试过从 SDK 导入 DialogflowApp 对象,但这些似乎不起作用。它们要么与 dialogflow() 调用返回的对象不匹配,要么接口没有 .intent 函数。
有人知道如何实现吗?
在VSCode中打开一个项目,我写道:
import { dialogflow } from 'actions-on-google'
const endpoint = dialogflow()
将鼠标悬停在 endpoint
上,VSCode 显示变量的一些元数据:
const endpoint: OmniHandler & BaseApp & DialogflowApp<{}, {}, Contexts, DialogflowConversation<{}, {}, Contexts>>
也许您的 DialogflowApp
声明需要泛型,或者您可以直接复制该字符串。