We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ab5b08 commit e7f0bc4Copy full SHA for e7f0bc4
1 file changed
index.ios.js
@@ -51,9 +51,18 @@ class ApiAi {
51
SpeechToText.finishRecognition();
52
}
53
54
- requestQuery(query: String, onResult: ()=>{}, onError: ()=>{}) {
55
- this.client.textRequest(query).then(res=>onResult(res)).catch(err=>onError(err));
56
- }
+ setContexts(contexts) {
+ this.contexts = contexts;
+ }
57
+
58
+ requestQuery(query: String, onResult: ()=>{}, onError: ()=>{}) {
59
+ if (this.contexts) {
60
+ this.client.textRequest(query, {contexts: this.contexts}).then(res=>onResult(res)).catch(err=>onError(err));
61
+ this.contexts = null;
62
+ } else {
63
+ this.client.textRequest(query).then(res=>onResult(res)).catch(err=>onError(err));
64
65
66
67
onAudioLevel(callback) {
68
0 commit comments