在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:dialogflow/dialogflow-javascript-client开源软件地址:https://github.com/dialogflow/dialogflow-javascript-client开源编程语言:TypeScript 61.1%开源软件介绍:DEPRECATED
You can use this library as common pre-built .js (choose there). Or you can install it with nodejs and that import as es6 (or .ts) module. See below.
Usage.textRequestconst client = new ApiAi.ApiAiClient({accessToken: 'YOUR_ACCESS_TOKEN'});
const promise = client.textRequest(longTextRequest);
promise
.then(handleResponse)
.catch(handleError);
function handleResponse(serverResponse) {
console.log(serverResponse);
}
function handleError(serverError) {
console.log(serverError);
} .eventRequestconst promise = client.eventRequest("EVENT_NAME", options); TypeScript and ES6This SDK written with Typescript and all it's sources are available in this package. So basically if you are using something like webpack or browserify with ES6 imports and so on, you can just install this SDK with import {ApiAiClient} from "api-ai-javascript";
const client = new ApiAiClient({accessToken: 'YOUR_ACCESS_TOKEN'})
.textRequest('Hello!')
.then((response) => {/* do something */})
.catch((error) => {/* do something here too */}) Note: If you are going to build es5 version of your bundle with ApiAiClient inside, please add some typings for promises (e.g. @types/es6-promise) You also can import and use all defined interfaces and ApiAiConstants: import {IRequestOptions, IServerResponse, ApiAiConstants} from "api-ai-javascript/ApiAiClient"
const lang = ApiAiConstants.AVAILABLE_LANGUAGES.EN; You can find full list of interfaces here Development
Building
Testing
Changelog2.0.0-beta.21
2.0.0-beta.19
2.0.0-beta.18
2.0.0-beta.17
2.0.0-beta.16
2.0.0-beta.15
2.0.0-beta.14
2.0.0-beta.13
2.0.0-beta.12
2.0.0-beta.8Breaking changes:
Non-breaking changes:
How to make contributions?Please read and follow the steps in the CONTRIBUTING.md. LicenseSee LICENSE. TermsYour use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Google APIs Terms of Service. This is not an official Google product. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论