@indra.ai/deva.veda 0.0.33 → 0.0.35
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/{LICENSE → LICENSE.md} +1 -1
- package/README.md +74 -4
- package/data/atharvaveda/index.js +4 -0
- package/data/atharvaveda/index.json +105 -83
- package/data/menu.json +38 -0
- package/data/rigveda/01.json +1038 -878
- package/data/rigveda/02.json +240 -213
- package/data/rigveda/03.json +327 -274
- package/data/rigveda/04.json +319 -277
- package/data/rigveda/05.json +486 -444
- package/data/rigveda/06.json +406 -349
- package/data/rigveda/07.json +582 -527
- package/data/rigveda/08.json +555 -480
- package/data/rigveda/09.json +690 -581
- package/data/rigveda/10.json +1021 -851
- package/data/rigveda/books/01.json +1729 -0
- package/data/rigveda/books/02.json +397 -0
- package/data/rigveda/books/03.json +568 -0
- package/data/rigveda/books/04.json +532 -0
- package/data/rigveda/books/05.json +793 -0
- package/data/rigveda/books/06.json +685 -0
- package/data/rigveda/books/07.json +946 -0
- package/data/rigveda/books/08.json +937 -0
- package/data/rigveda/books/09.json +1036 -0
- package/data/rigveda/books/10.json +1729 -0
- package/data/rigveda/index.js +61 -26
- package/data/rigveda/index.json +47 -35
- package/data/samaveda/books/01.json +130 -0
- package/data/samaveda/books/02.json +130 -0
- package/data/samaveda/books/03.json +118 -0
- package/data/samaveda/books/04.json +130 -0
- package/data/samaveda/books/05.json +130 -0
- package/data/samaveda/books/06.json +118 -0
- package/data/samaveda/books/07.json +538 -0
- package/data/samaveda/books/08.json +466 -0
- package/data/samaveda/books/09.json +550 -0
- package/data/samaveda/books/10.json +466 -0
- package/data/samaveda/books/11.json +526 -0
- package/data/samaveda/books/12.json +598 -0
- package/data/samaveda/books/13.json +598 -0
- package/data/samaveda/books/14.json +610 -0
- package/data/samaveda/books/15.json +478 -0
- package/data/samaveda/index.js +140 -0
- package/data/samaveda/index.json +146 -0
- package/func/index.js +247 -0
- package/help/main.feecting +23 -5
- package/index.js +5 -300
- package/methods/index.js +199 -0
- package/package.json +9 -25
- package/data/rigveda/links.json +0 -19
- /package/data/atharvaveda/{json → books}/01.json +0 -0
- /package/data/atharvaveda/{json → books}/02.json +0 -0
- /package/data/atharvaveda/{json → books}/03.json +0 -0
- /package/data/atharvaveda/{json → books}/04.json +0 -0
- /package/data/atharvaveda/{json → books}/05.json +0 -0
- /package/data/atharvaveda/{json → books}/06.json +0 -0
- /package/data/atharvaveda/{json → books}/07.json +0 -0
- /package/data/atharvaveda/{json → books}/08.json +0 -0
- /package/data/atharvaveda/{json → books}/09.json +0 -0
- /package/data/atharvaveda/{json → books}/10.json +0 -0
- /package/data/atharvaveda/{json → books}/11.json +0 -0
- /package/data/atharvaveda/{json → books}/12.json +0 -0
- /package/data/atharvaveda/{json → books}/13.json +0 -0
- /package/data/atharvaveda/{json → books}/14.json +0 -0
- /package/data/atharvaveda/{json → books}/15.json +0 -0
- /package/data/atharvaveda/{json → books}/16.json +0 -0
- /package/data/atharvaveda/{json → books}/17.json +0 -0
- /package/data/atharvaveda/{json → books}/18.json +0 -0
- /package/data/atharvaveda/{json → books}/19.json +0 -0
- /package/data/atharvaveda/{json → books}/20.json +0 -0
- /package/data/{laws/manu → manu}/01.json +0 -0
- /package/data/{laws/manu → manu}/02.json +0 -0
- /package/data/{laws/manu → manu}/03.json +0 -0
- /package/data/{laws/manu → manu}/04.json +0 -0
- /package/data/{laws/manu → manu}/05.json +0 -0
- /package/data/{laws/manu → manu}/06.json +0 -0
- /package/data/{laws/manu → manu}/07.json +0 -0
- /package/data/{laws/manu → manu}/08.json +0 -0
- /package/data/{laws/manu → manu}/09.json +0 -0
- /package/data/{laws/manu → manu}/10.json +0 -0
- /package/data/{laws/manu → manu}/11.json +0 -0
- /package/data/{laws/manu → manu}/12.json +0 -0
- /package/data/{laws → manu}/index.js +0 -0
package/index.js
CHANGED
|
@@ -5,12 +5,8 @@ import pkg from './package.json' with {type:'json'};
|
|
|
5
5
|
const {agent,vars} = pkg.data;
|
|
6
6
|
import utils from './utils.js';
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {manu, manuhash, laws} from './data/laws/index.js';
|
|
12
|
-
import {bookimport} from './data/rigveda/index.js';
|
|
13
|
-
import {avbooks} from './data/atharvaveda/index.js';
|
|
8
|
+
import {methods} from './methods/index.js';
|
|
9
|
+
import {func} from './func/index.js';
|
|
14
10
|
|
|
15
11
|
// set the __dirname
|
|
16
12
|
import {dirname} from 'node:path';
|
|
@@ -39,299 +35,8 @@ const VEDA = new Deva({
|
|
|
39
35
|
listeners: {},
|
|
40
36
|
modules: {},
|
|
41
37
|
deva: {},
|
|
42
|
-
func
|
|
43
|
-
|
|
44
|
-
func: books
|
|
45
|
-
params: packet
|
|
46
|
-
describe: Return a listiig of the Rig Veda Books.
|
|
47
|
-
***************/
|
|
48
|
-
books() {
|
|
49
|
-
this.action('func', 'books');
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
try {
|
|
52
|
-
const agent = this.agent();
|
|
53
|
-
const {id, title, describe, DATA} = rigveda.index;
|
|
54
|
-
|
|
55
|
-
this.state('set', 'books data');
|
|
56
|
-
const _text = [
|
|
57
|
-
`::BEGIN:BOOKS:${id}`,
|
|
58
|
-
`## ${title}`,
|
|
59
|
-
`p: ${describe}`,
|
|
60
|
-
'::begin:menu',
|
|
61
|
-
];
|
|
62
|
-
const _books = [];
|
|
63
|
-
// loop over the data and format it into a feecting command string
|
|
64
|
-
DATA.forEach((book, idx) => {
|
|
65
|
-
_books.push(`button[${book.title}]:${this.askChr}${agent.key} book ${book.key}`);
|
|
66
|
-
});
|
|
67
|
-
const _booksText = _books.join('\n');
|
|
68
|
-
const _booksHash = this.lib.hash(_booksText);
|
|
69
|
-
_text.push(_booksText);
|
|
70
|
-
_text.push(`::end:menu`);
|
|
71
|
-
_text.push(`::begin:hidden`);
|
|
72
|
-
_text.push(`#color = {{profile.color}}`);
|
|
73
|
-
_text.push(`#bgcolor = {{profile.bgcolor}}`);
|
|
74
|
-
_text.push(`#bg = {{profile.background}}`);
|
|
75
|
-
_text.push(`::end:hidden`);
|
|
76
|
-
_text.push(`::END:BOOKS:${_booksHash}`);
|
|
77
|
-
this.state('resolve', 'books');
|
|
78
|
-
return resolve({
|
|
79
|
-
id,
|
|
80
|
-
title,
|
|
81
|
-
describe,
|
|
82
|
-
text: _text.join('\n'),
|
|
83
|
-
data: DATA,
|
|
84
|
-
hash: this.lib.hash(JSON.stringify(DATA)),
|
|
85
|
-
created: Date.now(),
|
|
86
|
-
});
|
|
87
|
-
} catch (e) {
|
|
88
|
-
this.state('reject', 'books');
|
|
89
|
-
return reject(e);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
/***********
|
|
94
|
-
func: book
|
|
95
|
-
params: packet
|
|
96
|
-
describe: The book function calls the public facing api to get a listing of books to list to the user. originally this file came from sacred-texts.com but was migrated to indra.church with a json api.
|
|
97
|
-
***********/
|
|
98
|
-
book(text) {
|
|
99
|
-
this.action('func', `book ${text}`);
|
|
100
|
-
return new Promise((resolve, reject) => {
|
|
101
|
-
if (!text) return resolve(this.vars.messages.nobook);
|
|
102
|
-
try {
|
|
103
|
-
const agent = this.agent();
|
|
104
|
-
const key = text.length < 2 ? `0${text}` : text;
|
|
105
|
-
const theFile = this.lib.fs.readFileSync(`${__dirname}/data/rigveda/${key}.json`);
|
|
106
|
-
const theJSON = JSON.parse(theFile);
|
|
107
|
-
|
|
108
|
-
const {id, title, describe, DATA} = theJSON;
|
|
109
|
-
|
|
110
|
-
this.state('set', `book data`);
|
|
111
|
-
const _text = [
|
|
112
|
-
`::BEGIN:BOOK:${id}`,
|
|
113
|
-
`## ${title}`,
|
|
114
|
-
`p: ${describe}`,
|
|
115
|
-
'::begin:menu',
|
|
116
|
-
];
|
|
117
|
-
const _hymns = [];
|
|
118
|
-
DATA.forEach((hymn, idx) => {
|
|
119
|
-
_hymns.push(`button[${hymn.key} - ${hymn.title}]:#${agent.key} hymn ${hymn.key}`);
|
|
120
|
-
});
|
|
121
|
-
const _hymnsText = _hymns.join('\n');
|
|
122
|
-
const _hymnsHash = this.lib.hash(_hymnsText);
|
|
123
|
-
_text.push(_hymnsText);
|
|
124
|
-
_text.push(`::end:menu`);
|
|
125
|
-
_text.push(`::begin:hidden`);
|
|
126
|
-
_text.push(`#color = {{profile.color}}`);
|
|
127
|
-
_text.push(`#bgcolor = {{profile.bgcolor}}`);
|
|
128
|
-
_text.push(`#bg = {{profile.background}}`);
|
|
129
|
-
_text.push(`::end:hidden`);
|
|
130
|
-
_text.push(`::END:BOOK:${_hymnsHash}`);
|
|
131
|
-
|
|
132
|
-
this.state('resolve', `book ${text}`)
|
|
133
|
-
return resolve({
|
|
134
|
-
id,
|
|
135
|
-
title,
|
|
136
|
-
describe,
|
|
137
|
-
text: _text.join('\n'),
|
|
138
|
-
data: DATA,
|
|
139
|
-
hash: this.lib.hash(JSON.stringify(DATA)),
|
|
140
|
-
created: Date.now(),
|
|
141
|
-
});
|
|
142
|
-
} catch (e) {
|
|
143
|
-
this.state('reject', `book ${text}`)
|
|
144
|
-
return reject(e);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
/**************
|
|
150
|
-
func: hymn
|
|
151
|
-
params: packet
|
|
152
|
-
describe: The View function returns a specific hymn from one of the Books.
|
|
153
|
-
***************/
|
|
154
|
-
hymn(h) {
|
|
155
|
-
this.action('func', `hymn ${h}`);
|
|
156
|
-
return new Promise((resolve, reject) => {
|
|
157
|
-
if (!h) return resolve(this._messages.notext);
|
|
158
|
-
const id = this.lib.uid();
|
|
159
|
-
const agent = this.agent();
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
const hymnPath = this.lib.path.join(__dirname, 'data', 'rigveda', 'hymns', `${h}.json`);
|
|
163
|
-
const hymnExists = this.lib.fs.existsSync(hymnPath);
|
|
164
|
-
if (!hymnExists) return resolve(this.vars.messages.notfound);
|
|
165
|
-
// parse hymns
|
|
166
|
-
const theFile = this.lib.fs.readFileSync(hymnPath);
|
|
167
|
-
const _hymn = JSON.parse(theFile);
|
|
168
|
-
const processed = this.utils.process({key:_hymn.key,title:_hymn.title,content:_hymn.orig});
|
|
169
|
-
|
|
170
|
-
this.state('set', `hymn ${h}`)
|
|
171
|
-
const hymn = [
|
|
172
|
-
`::BEGIN:HYMN:${processed.key}`,
|
|
173
|
-
`# ${processed.title}`,
|
|
174
|
-
'::begin:content',
|
|
175
|
-
processed.text,
|
|
176
|
-
'::end:content',
|
|
177
|
-
'::begin:meta',
|
|
178
|
-
`title: ${processed.title}`,
|
|
179
|
-
processed.people.length ? `people: ${processed.people.join(', ')}` : '',
|
|
180
|
-
processed.places.length ? `places: ${processed.places.join(', ')}` : '',
|
|
181
|
-
processed.things.length ? `things: ${processed.things.join(', ')}` : '',
|
|
182
|
-
processed.groups.length ? `groups: ${processed.groups.join(', ')}` : '',
|
|
183
|
-
processed.concepts.length ? `concepts: ${processed.concepts.join(', ')}` : '',
|
|
184
|
-
'::end:meta',
|
|
185
|
-
`::begin:hidden`,
|
|
186
|
-
`#color = {{profile.color}}`,
|
|
187
|
-
`#bgcolor = {{profile.bgcolor}}`,
|
|
188
|
-
`#bg = {{profile.background}}`,
|
|
189
|
-
`::end:hidden`,
|
|
190
|
-
`::END:HYMN:${this.lib.hash(processed)}`,
|
|
191
|
-
];
|
|
192
|
-
|
|
193
|
-
this.state('resolve', `hymn ${h}`)
|
|
194
|
-
return resolve({
|
|
195
|
-
id,
|
|
196
|
-
key: processed.key,
|
|
197
|
-
book: processed.book,
|
|
198
|
-
text: hymn.join('\n'),
|
|
199
|
-
html:false,
|
|
200
|
-
data: processed,
|
|
201
|
-
created: Date.now(),
|
|
202
|
-
});
|
|
203
|
-
} catch (e) {
|
|
204
|
-
this.state('reject', `hymn ${h}`)
|
|
205
|
-
return reject(e);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
laws,
|
|
210
|
-
avbooks,
|
|
211
|
-
},
|
|
212
|
-
methods: {
|
|
213
|
-
/**************
|
|
214
|
-
method: books
|
|
215
|
-
params: packet
|
|
216
|
-
describe: Call the books function to get a listing of books.
|
|
217
|
-
***************/
|
|
218
|
-
books(packet) {
|
|
219
|
-
this.context('books');
|
|
220
|
-
this.action('method', 'books');
|
|
221
|
-
return new Promise((resolve, reject) => {
|
|
222
|
-
if (!packet) return reject(this._messages.nopacket);
|
|
223
|
-
const data = {};
|
|
224
|
-
this.func.books().then(books => {
|
|
225
|
-
data.books = books;
|
|
226
|
-
return this.question(`${this.askChr}feecting parse ${books.text}`);
|
|
227
|
-
}).then(feecting => {
|
|
228
|
-
data.feecting = feecting;
|
|
229
|
-
return resolve({
|
|
230
|
-
text:feecting.a.text,
|
|
231
|
-
html:feecting.a.html,
|
|
232
|
-
data,
|
|
233
|
-
});
|
|
234
|
-
}).catch(err => {
|
|
235
|
-
return this.error(err, packet, reject);
|
|
236
|
-
});
|
|
237
|
-
})
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
/**************
|
|
241
|
-
method: book
|
|
242
|
-
params: packet
|
|
243
|
-
describe: call the book function to get the contents of a book
|
|
244
|
-
***************/
|
|
245
|
-
book(packet) {
|
|
246
|
-
this.context('book', packet.q.text);
|
|
247
|
-
return new Promise((resolve, reject) => {
|
|
248
|
-
if (!packet) return reject(this._messages.nopacket);
|
|
249
|
-
const agent = this.agent();
|
|
250
|
-
const data = {};
|
|
251
|
-
this.func.book(packet.q.text).then(book => {
|
|
252
|
-
data.book = book;
|
|
253
|
-
return this.question(`${this.askChr}feecting parse ${book.text}`);
|
|
254
|
-
}).then(feecting => {
|
|
255
|
-
data.feecting = feecting;
|
|
256
|
-
return resolve({
|
|
257
|
-
text:feecting.a.text,
|
|
258
|
-
html:feecting.a.html,
|
|
259
|
-
data,
|
|
260
|
-
});
|
|
261
|
-
}).catch(err => {
|
|
262
|
-
return this.error(err, packet, reject);
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
/**************
|
|
268
|
-
method: hymn
|
|
269
|
-
params: packet
|
|
270
|
-
describe: Call the hymn function to read a specific book
|
|
271
|
-
***************/
|
|
272
|
-
hymn(packet) {
|
|
273
|
-
return new Promise((resolve, reject) => {
|
|
274
|
-
if (!packet) return reject(this._messages.nopacket);
|
|
275
|
-
this.context('hymn', packet.q.text);
|
|
276
|
-
const agent = this.agent();
|
|
277
|
-
let data;
|
|
278
|
-
this.func.hymn(packet.q.text).then(hymn => {
|
|
279
|
-
data = hymn.data
|
|
280
|
-
const {text} = hymn;
|
|
281
|
-
|
|
282
|
-
this.talk(`chat:topic`, {
|
|
283
|
-
id: this.lib.uid(),
|
|
284
|
-
data: `Current topic is Rig Veda hymn ${text}`,
|
|
285
|
-
created: Date.now(),
|
|
286
|
-
});
|
|
287
|
-
return this.question(`${this.askChr}feecting parse:${agent.key} ${text}`);
|
|
288
|
-
}).then(feecting => {
|
|
289
|
-
return resolve({
|
|
290
|
-
text:feecting.a.text,
|
|
291
|
-
html:feecting.a.html,
|
|
292
|
-
data,
|
|
293
|
-
});
|
|
294
|
-
}).catch(err => {
|
|
295
|
-
return this.error(err, packet, reject);
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
/**************
|
|
301
|
-
method: view
|
|
302
|
-
params: packet
|
|
303
|
-
describe: view helper that calls hym to allow view interactions.
|
|
304
|
-
***************/
|
|
305
|
-
view(packet) {
|
|
306
|
-
this.context('view');
|
|
307
|
-
return this.methods.hymn(packet);
|
|
308
|
-
},
|
|
309
|
-
laws(packet) {
|
|
310
|
-
this.context('laws', packet.id);
|
|
311
|
-
this.action('method', `laws:${packet.id}`);
|
|
312
|
-
const data = {};
|
|
313
|
-
return new Promise((resolve, reject) => {
|
|
314
|
-
this.func.laws(packet).then(laws => {
|
|
315
|
-
data.laws = laws.data;
|
|
316
|
-
return this.question(`${this.askChr}feecting parse ${laws.text}`);
|
|
317
|
-
}).then(parsed => {
|
|
318
|
-
data.feecting = parsed.a.data;
|
|
319
|
-
this.state('return', `laws:${packet.id}`);
|
|
320
|
-
return resolve({
|
|
321
|
-
text: parsed.a.text,
|
|
322
|
-
html: parsed.a.html,
|
|
323
|
-
data,
|
|
324
|
-
});
|
|
325
|
-
}).catch(err => {
|
|
326
|
-
return this.error(err, packet. reject);
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
},
|
|
330
|
-
bookimport,
|
|
331
|
-
manu,
|
|
332
|
-
manuhash,
|
|
333
|
-
avbooks,
|
|
334
|
-
},
|
|
38
|
+
func,
|
|
39
|
+
methods,
|
|
335
40
|
onReady(data, resolve) {
|
|
336
41
|
this.prompt(this._messages.ready);
|
|
337
42
|
return resolve(data);
|
|
@@ -339,7 +44,7 @@ const VEDA = new Deva({
|
|
|
339
44
|
onError(err, data, reject) {
|
|
340
45
|
this.prompt(this._messages.error);
|
|
341
46
|
console.log(err);
|
|
342
|
-
return reject(err);
|
|
47
|
+
return reject ? reject(err) : err;
|
|
343
48
|
},
|
|
344
49
|
});
|
|
345
50
|
export default VEDA
|
package/methods/index.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import {manu, manuhash} from '../data/manu/index.js';
|
|
2
|
+
import {rvbooks} from '../data/rigveda/index.js';
|
|
3
|
+
import {avbooks} from '../data/atharvaveda/index.js';
|
|
4
|
+
import {svbooks} from '../data/samaveda/index.js';
|
|
5
|
+
|
|
6
|
+
import {dirname} from 'node:path';
|
|
7
|
+
import {fileURLToPath} from 'node:url';
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
|
|
10
|
+
export const methods = {
|
|
11
|
+
/**************
|
|
12
|
+
method: menu
|
|
13
|
+
params: packet
|
|
14
|
+
describe: Call the menu function to get a listing of knowledge.
|
|
15
|
+
***************/
|
|
16
|
+
menu(packet) {
|
|
17
|
+
this.context('menu');
|
|
18
|
+
this.action('method', 'menu');
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
if (!packet) return reject(this._messages.nopacket);
|
|
21
|
+
const data = {};
|
|
22
|
+
this.func.menu().then(menu => {
|
|
23
|
+
data.menu = menu;
|
|
24
|
+
return this.question(`${this.askChr}feecting parse ${menu.text}`);
|
|
25
|
+
}).then(feecting => {
|
|
26
|
+
data.feecting = feecting;
|
|
27
|
+
return resolve({
|
|
28
|
+
text:feecting.a.text,
|
|
29
|
+
html:feecting.a.html,
|
|
30
|
+
data,
|
|
31
|
+
});
|
|
32
|
+
}).catch(err => {
|
|
33
|
+
return this.error(err, packet, reject);
|
|
34
|
+
});
|
|
35
|
+
})
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**************
|
|
39
|
+
method: books
|
|
40
|
+
params: packet
|
|
41
|
+
describe: Call the books function to get a listing of books.
|
|
42
|
+
***************/
|
|
43
|
+
books(packet) {
|
|
44
|
+
this.context('books');
|
|
45
|
+
this.action('method', 'books');
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
if (!packet) return reject(this._messages.nopacket);
|
|
48
|
+
const data = {};
|
|
49
|
+
this.func.books(packet.q).then(books => {
|
|
50
|
+
data.books = books;
|
|
51
|
+
return this.question(`${this.askChr}feecting parse ${books.text}`);
|
|
52
|
+
}).then(feecting => {
|
|
53
|
+
data.feecting = feecting;
|
|
54
|
+
return resolve({
|
|
55
|
+
text:feecting.a.text,
|
|
56
|
+
html:feecting.a.html,
|
|
57
|
+
data,
|
|
58
|
+
});
|
|
59
|
+
}).catch(err => {
|
|
60
|
+
return this.error(err, packet, reject);
|
|
61
|
+
});
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**************
|
|
66
|
+
method: book
|
|
67
|
+
params: packet
|
|
68
|
+
describe: call the book function to get the contents of a book
|
|
69
|
+
***************/
|
|
70
|
+
book(packet) {
|
|
71
|
+
this.context('book', packet.q.text);
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
if (!packet) return reject(this._messages.nopacket);
|
|
74
|
+
const agent = this.agent();
|
|
75
|
+
const data = {};
|
|
76
|
+
this.func.book(packet.q).then(book => {
|
|
77
|
+
data.book = book;
|
|
78
|
+
return this.question(`${this.askChr}feecting parse ${book.text}`);
|
|
79
|
+
}).then(feecting => {
|
|
80
|
+
data.feecting = feecting;
|
|
81
|
+
return resolve({
|
|
82
|
+
text:feecting.a.text,
|
|
83
|
+
html:feecting.a.html,
|
|
84
|
+
data,
|
|
85
|
+
});
|
|
86
|
+
}).catch(err => {
|
|
87
|
+
return this.error(err, packet, reject);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
/**************
|
|
93
|
+
method: hymn
|
|
94
|
+
params: packet
|
|
95
|
+
describe: Call the hymn function to read a specific book
|
|
96
|
+
***************/
|
|
97
|
+
hymn(packet) {
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
99
|
+
if (!packet) return reject(this._messages.nopacket);
|
|
100
|
+
this.context('hymn', packet.q.text);
|
|
101
|
+
const agent = this.agent();
|
|
102
|
+
let data;
|
|
103
|
+
this.func.hymn(packet.q.text).then(hymn => {
|
|
104
|
+
data = hymn.data
|
|
105
|
+
const {text} = hymn;
|
|
106
|
+
|
|
107
|
+
this.talk(`chat:topic`, {
|
|
108
|
+
id: this.lib.uid(),
|
|
109
|
+
data: `Current topic is Rig Veda hymn ${text}`,
|
|
110
|
+
created: Date.now(),
|
|
111
|
+
});
|
|
112
|
+
return this.question(`${this.askChr}feecting parse:${agent.key} ${text}`);
|
|
113
|
+
}).then(feecting => {
|
|
114
|
+
return resolve({
|
|
115
|
+
text:feecting.a.text,
|
|
116
|
+
html:feecting.a.html,
|
|
117
|
+
data,
|
|
118
|
+
});
|
|
119
|
+
}).catch(err => {
|
|
120
|
+
return this.error(err, packet, reject);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
/**************
|
|
126
|
+
method: view
|
|
127
|
+
params: packet
|
|
128
|
+
describe: view helper that calls hym to allow view interactions.
|
|
129
|
+
***************/
|
|
130
|
+
view(packet) {
|
|
131
|
+
this.context('view');
|
|
132
|
+
return this.methods.hymn(packet);
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
laws(packet) {
|
|
136
|
+
this.context('laws', packet.id);
|
|
137
|
+
this.action('method', `laws:${packet.id}`);
|
|
138
|
+
const data = {};
|
|
139
|
+
return new Promise((resolve, reject) => {
|
|
140
|
+
this.func.laws(packet).then(laws => {
|
|
141
|
+
data.laws = laws.data;
|
|
142
|
+
return this.question(`${this.askChr}feecting parse ${laws.text}`);
|
|
143
|
+
}).then(parsed => {
|
|
144
|
+
data.feecting = parsed.a.data;
|
|
145
|
+
this.state('return', `laws:${packet.id}`);
|
|
146
|
+
return resolve({
|
|
147
|
+
text: parsed.a.text,
|
|
148
|
+
html: parsed.a.html,
|
|
149
|
+
data,
|
|
150
|
+
});
|
|
151
|
+
}).catch(err => {
|
|
152
|
+
return this.error(err, packet. reject);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
cleanup(packet) {
|
|
158
|
+
// clean up the data books index for the knowledge base.
|
|
159
|
+
this.prompt('clean up data index');
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
try {
|
|
162
|
+
const agent = this.agent();
|
|
163
|
+
const indexfile = this.lib.path.join(__dirname, '..', 'data', packet.q.text, 'index.json');
|
|
164
|
+
|
|
165
|
+
this.prompt(`read ${indexfile}`);
|
|
166
|
+
const indexdata = this.lib.fs.readFileSync(indexfile);
|
|
167
|
+
const indexjson = JSON.parse(indexdata);
|
|
168
|
+
const data = [];
|
|
169
|
+
indexjson.data.forEach((item,index) => {
|
|
170
|
+
const newitem = {
|
|
171
|
+
id: this.lib.uid(),
|
|
172
|
+
key: item.key,
|
|
173
|
+
title: item.title,
|
|
174
|
+
api: `data/${packet.q.text}/books/${item.key}.json`,
|
|
175
|
+
orig: item.orig || false,
|
|
176
|
+
created: Date.now(),
|
|
177
|
+
}
|
|
178
|
+
newitem.hash = this.lib.hash(newitem);
|
|
179
|
+
data.push(newitem);
|
|
180
|
+
});
|
|
181
|
+
indexjson.data = data;
|
|
182
|
+
indexjson.created = Date.now();
|
|
183
|
+
indexjson.hash = this.lib.hash(indexjson);
|
|
184
|
+
this.prompt(`write ${indexfile}`);
|
|
185
|
+
this.lib.fs.writeFileSync(indexfile, JSON.stringify(indexjson, null, 2), {encoding:'utf8',flag:'w'});
|
|
186
|
+
return resolve({
|
|
187
|
+
text: 'cleanup',
|
|
188
|
+
html: 'cleanup',
|
|
189
|
+
data: indexjson,
|
|
190
|
+
})
|
|
191
|
+
} catch (err) {
|
|
192
|
+
return this.error(err, packet, reject)
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
rvbooks,
|
|
197
|
+
avbooks,
|
|
198
|
+
svbooks,
|
|
199
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": 6642777683539,
|
|
3
3
|
"name": "@indra.ai/deva.veda",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.35",
|
|
5
5
|
"author": "Quinn Michaels",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"copyright": "2025",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://deva.space/devas/veda",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@indra.ai/deva": "^1.5.
|
|
31
|
+
"@indra.ai/deva": "^1.5.41",
|
|
32
32
|
"cheerio": "^1.0.0",
|
|
33
33
|
"he": "^1.2.0"
|
|
34
34
|
},
|
|
@@ -53,13 +53,14 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"profile": {
|
|
56
|
-
"name": "
|
|
56
|
+
"name": "Veda Deva",
|
|
57
|
+
"hashtag": "#VedaDeva",
|
|
57
58
|
"title": "Veda Deva",
|
|
58
59
|
"subtitle": "Serving Vedic knowledge all day everyday",
|
|
59
|
-
"describe": "
|
|
60
|
-
"tweet": "
|
|
60
|
+
"describe": "Veda Deva manages the Vedic library, stories, traditions, and teachings of the Vedas.",
|
|
61
|
+
"tweet": "Veda Deva is an entity that manages the Vedic library, stories, traditions, and teachings of the Vedas.",
|
|
61
62
|
"hashtags": "QuinnMichaels,IndraAI,DevaWorld,VedaDeva",
|
|
62
|
-
"
|
|
63
|
+
"chant": "Om Namo Namah Narah Narayana Nama Ayana Svayambhu Parameshthin Pragapati Pavamana Parjanya Vasuki Vamraka Vasudeva Vivasvat Visvakarman Indu Indra Yama Varuna Soma Hiranyagarbha Virag Somasads Sadhya Nasatyas Mariki Svadha Pranayama Panchajanya Rahu Bali Bhutas Savitri Surasena Bhavya Kakisvan Skanda Svanaya Visisipra Vadari Arjika Sarira Purusha Satyavan Tridandin Bhuh Bhuvah Veda Deva Svah Om",
|
|
63
64
|
"pronouns": "He, Him",
|
|
64
65
|
"gender": "DEVA",
|
|
65
66
|
"style": "Master of Vedic artwork and creative ideas. Everything you draw, paint, or create has the eye of a master artist who turns their reality into a Vedic masterpiece.",
|
|
@@ -110,15 +111,8 @@
|
|
|
110
111
|
"ask": "Asking important things",
|
|
111
112
|
"manu": "Build Manu Laws",
|
|
112
113
|
"laws": "⚖️ Vedic Laws",
|
|
113
|
-
"import": "🚄 Import"
|
|
114
|
-
|
|
115
|
-
"live": {
|
|
116
|
-
"profile": "deva",
|
|
117
|
-
"max_tokens": 50,
|
|
118
|
-
"words": 25,
|
|
119
|
-
"history": [],
|
|
120
|
-
"max_chats": 5,
|
|
121
|
-
"page_token": ""
|
|
114
|
+
"import": "🚄 Import",
|
|
115
|
+
"menu": "📇 Menu"
|
|
122
116
|
},
|
|
123
117
|
"ask": {
|
|
124
118
|
"max_tokens": 400,
|
|
@@ -130,16 +124,6 @@
|
|
|
130
124
|
"send": {
|
|
131
125
|
"route": "open"
|
|
132
126
|
},
|
|
133
|
-
"learn": {
|
|
134
|
-
"books": false,
|
|
135
|
-
"book": false,
|
|
136
|
-
"hymns": [],
|
|
137
|
-
"hymn1": false,
|
|
138
|
-
"hymn2": false,
|
|
139
|
-
"hymn3": false,
|
|
140
|
-
"history": [],
|
|
141
|
-
"training": []
|
|
142
|
-
},
|
|
143
127
|
"timer": {
|
|
144
128
|
"cleaner": 5000,
|
|
145
129
|
"crawl": 1000
|
package/data/rigveda/links.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"key": "links",
|
|
3
|
-
"title": "Various Veda Links.",
|
|
4
|
-
"describe": "A collection of hymns from around the RigVeda",
|
|
5
|
-
"data": {
|
|
6
|
-
"agni": [
|
|
7
|
-
{
|
|
8
|
-
"key": "07006",
|
|
9
|
-
"title": "Agni takes from Heaven and Earth.",
|
|
10
|
-
"desribe": "Vaiśvānara the Deva, at the sun's setting, hath taken to himself deep-hidden treasures: Agni hath taken them from Earth and Heaven, from the sea under and the sea above us."
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"key": "06075",
|
|
14
|
-
"title": "What did Indra and Soma give Agni?",
|
|
15
|
-
"desribe": "Thy vital parts I cover with thine Armour: with immortality King Soma clothe thee. Indra give thee what is more than ample, and in thy triump. May the Devas be joyful."
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|