@indra.ai/deva.data 0.1.6 → 0.1.7
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/feature/methods.js +41 -12
- package/package.json +2 -2
package/feature/methods.js
CHANGED
|
@@ -12,28 +12,57 @@ export default {
|
|
|
12
12
|
async data(packet) {
|
|
13
13
|
const info = this.info();
|
|
14
14
|
const agent = this.agent();
|
|
15
|
+
const client = this.client();
|
|
15
16
|
const {id, q} = packet;
|
|
16
17
|
const {meta, text, data} = q;
|
|
17
18
|
const {params} = meta;
|
|
18
19
|
const method = params[1] ? params[1] : 'insert';
|
|
19
20
|
const collection = params[2] ? params[2] : 'PersonalVault';
|
|
20
21
|
const database = params[3] ? params[3] : `${agent.id}-${agent.profile.name.replace(/\s/g, '')}`;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
|
|
23
|
+
this.state('data', `data_packet:${id.uid}`); // set state data
|
|
24
|
+
const data_packet = {
|
|
25
|
+
id,
|
|
26
|
+
content: q.text,
|
|
27
|
+
client: client.id,
|
|
28
|
+
agent: agent.id,
|
|
29
|
+
method,
|
|
30
|
+
collection,
|
|
31
|
+
database,
|
|
32
|
+
created: Date.now(),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
this.action('hash', `data:${method}:md5:${id.uid}`); // set action hash
|
|
36
|
+
data_packet.md5 = this.hash(data_packet, 'md5');
|
|
37
|
+
this.action('hash', `data:${method}:sha256:${id.uid}`); // set action hash
|
|
38
|
+
data_packet.sha256 = this.hash(data_packet, 'sha256');
|
|
39
|
+
this.action('hash', `data:${method}:sha512:${id.uid}`); // set action hash
|
|
40
|
+
data_packet.sha512 = this.hash(data_packet, 'sha512');
|
|
41
|
+
|
|
42
|
+
const answer = await this.question(`${this.askChr}data ${method}:${collection}:${database} ${text}`, data_packet);
|
|
43
|
+
data_packet.insertedId = answer.a.data.insertedId;
|
|
44
|
+
|
|
45
|
+
const data_prompt = [
|
|
46
|
+
`::begin:data:${method}:${id.uid}`,
|
|
47
|
+
`content: ${data_packet.content}`,
|
|
48
|
+
`uid: ${id.uid}`,
|
|
49
|
+
`insertedId: ${data_packet.insertedId}`,
|
|
50
|
+
`collection: ${data_packet.collection}`,
|
|
51
|
+
`database: ${data_packet.database}`,
|
|
52
|
+
`md5: ${data_packet.md5}`,
|
|
53
|
+
`sha256: ${data_packet.sha256}`,
|
|
54
|
+
`sha512: ${data_packet.sha512}`,
|
|
55
|
+
`created: ${this.lib.formatDate(data_packet.created, 'long', true)}`,
|
|
56
|
+
`::end:data:${method}:${id.uid}`,
|
|
57
|
+
].join('\n');
|
|
58
|
+
|
|
30
59
|
this.action('resolve', `data:${packet.id.uid}`); // set action reject
|
|
31
60
|
this.state('valid', `data:${packet.id.uid}`); // set action reject
|
|
32
61
|
this.intent('good', `data:${packet.id.uid}`);
|
|
33
62
|
return {
|
|
34
|
-
text:
|
|
35
|
-
html:
|
|
36
|
-
data:
|
|
63
|
+
text: data_prompt,
|
|
64
|
+
html: false,
|
|
65
|
+
data: data_packet,
|
|
37
66
|
}
|
|
38
67
|
},
|
|
39
68
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "65859204002504361305",
|
|
3
3
|
"name": "@indra.ai/deva.data",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"license": "VLA:65859204002504361305 LICENSE.md",
|
|
6
6
|
"VLA": {
|
|
7
7
|
"uid": "65859204002504361305",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"homepage": "https://indra.ai",
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@indra.ai/deva": "^1.20.
|
|
62
|
+
"@indra.ai/deva": "^1.20.3",
|
|
63
63
|
"mongodb": "^6.13.0"
|
|
64
64
|
},
|
|
65
65
|
"data": {
|