Fix wit message

This commit is contained in:
JulienDuf
2017-01-31 19:05:12 -05:00
parent 386659ab1c
commit a11c85f84b
2 changed files with 5 additions and 6 deletions

7
node-wit/index.d.ts vendored
View File

@@ -51,14 +51,15 @@ export interface WitOption {
}
export interface MessageResponseEntity {
confidence: number;
value: string;
confidence?: number;
value?: string;
type?: string;
}
export interface MessageResponse {
msg_id: string;
_text: string;
entities: MessageResponseEntity[];
entities: any;
}
export declare class Wit {

View File

@@ -23,9 +23,7 @@ var wit = new Wit({
wit.message("what is the weather in London?", {}).then((res) => {
console.log(res._text);
for (let entity of res.entities) {
console.log(entity.value + ": " + entity.confidence * 100 + "%");
}
console.log(res.entities);
}).catch((err) => {
console.log(err);