@indra.ai/deva 1.1.84 → 1.1.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -773,7 +773,6 @@ class Deva {
|
|
|
773
773
|
packet.q.meta.hash = this.hash(packet.q);
|
|
774
774
|
|
|
775
775
|
this.action(_action);
|
|
776
|
-
this.talk(`${key}:question`, this.copy(packet)); // key question event make sure to copy data.
|
|
777
776
|
this.talk(config.events.question, this.copy(packet)); // global question event make sure to copy data.
|
|
778
777
|
|
|
779
778
|
if (isAsk) { // isAsk check if the question isAsk and talk
|
|
@@ -846,17 +845,16 @@ class Deva {
|
|
|
846
845
|
};
|
|
847
846
|
|
|
848
847
|
// create a hash for the answer and insert into answer meta.
|
|
849
|
-
packet_answer.meta.hash = this.hash(packet_answer);
|
|
848
|
+
packet_answer.meta.hash = this.hash(JSON.stringify(packet_answer));
|
|
850
849
|
|
|
851
|
-
packet.a = packet_answer;
|
|
850
|
+
packet.a = this.copy(packet_answer);
|
|
852
851
|
packet.hash = this.hash(packet); // hash the entire packet.
|
|
853
852
|
|
|
854
853
|
|
|
855
854
|
this.action('answer_talk');
|
|
856
|
-
this.talk(`${agent.key}:answer`, this.copy(packet)); // agent key answer event
|
|
857
855
|
this.talk(config.events.answer, this.copy(packet)); // global talk event
|
|
858
856
|
|
|
859
|
-
return resolve(
|
|
857
|
+
return resolve(packet); // resolve the packet to the caller.
|
|
860
858
|
}).catch(err => { // catch any errors in the method
|
|
861
859
|
this.action('error');
|
|
862
860
|
return this.error(err, packet, reject); // return this.error with err, packet, reject
|
|
@@ -920,7 +918,6 @@ class Deva {
|
|
|
920
918
|
packet.a.text = result;
|
|
921
919
|
}
|
|
922
920
|
this.action('ask_answer');
|
|
923
|
-
this.talk(`${agent.key}:answer`, this.copy(packet));
|
|
924
921
|
this.talk(`${agent.key}:ask:${packet.id}`, packet);
|
|
925
922
|
}).catch(err => {
|
|
926
923
|
this.action('error');
|