ekms 8.0.0-beta.7 → 8.0.0-beta.70
Sign up to get free protection for your applications and to get access to all the features.
- package/common/animals.instance.json +2871 -1379
- package/common/animals.js +17 -20
- package/common/articles.js +103 -0
- package/common/articles.test.json +310 -0
- package/common/avatar.js +5 -9
- package/common/characters.js +22 -28
- package/common/colors.instance.json +7170 -3657
- package/common/colors.js +4 -8
- package/common/colors.test.json +345 -780
- package/common/comparable.instance.json +1750 -0
- package/common/comparable.js +36 -28
- package/common/comparable.test.json +438 -2
- package/common/concept.js +120 -118
- package/common/countable.js +19 -13
- package/common/countable.test.json +1050 -0
- package/common/crew.instance.json +13066 -6469
- package/common/crew.js +36 -41
- package/common/crew.test.json +714 -452
- package/common/currency.js +27 -45
- package/common/dialogues.js +161 -285
- package/common/dimension.instance.json +474 -253
- package/common/dimension.js +16 -22
- package/common/dimension.test.json +446 -1640
- package/common/edible.instance.json +20053 -10093
- package/common/edible.js +3 -8
- package/common/emotions.instance.json +147 -69
- package/common/emotions.js +35 -38
- package/common/evaluate.instance.json +2 -0
- package/common/evaluate.js +49 -0
- package/common/evaluate.test.json +574 -0
- package/common/events.js +10 -14
- package/common/fastfood.instance.json +221166 -111223
- package/common/fastfood.js +75 -85
- package/common/fastfood.test.json +268 -90
- package/common/formulas.instance.json +455 -249
- package/common/formulas.js +19 -26
- package/common/gdefaults.js +24 -26
- package/common/help.js +7 -12
- package/common/help.test.json +63 -8
- package/common/helpers/concept.js +10 -7
- package/common/helpers/dialogues.js +2 -3
- package/common/helpers/properties.js +54 -62
- package/common/helpers.js +6 -5
- package/common/hierarchy.js +16 -24
- package/common/javascript.js +11 -18
- package/common/kirk.instance.json +584 -290
- package/common/kirk.js +5 -8
- package/common/length.instance.json +8834 -4757
- package/common/length.js +4 -8
- package/common/listener.js +48 -0
- package/common/listener.test.json +104 -0
- package/common/math.instance.json +425 -1187
- package/common/math.js +16 -20
- package/common/meta.js +23 -47
- package/common/nameable.instance.json +2 -0
- package/common/nameable.js +144 -0
- package/common/nameable.test.json +3191 -0
- package/common/negation.instance.json +2 -0
- package/common/negation.js +38 -0
- package/common/negation.test.json +308 -0
- package/common/numbers.js +27 -31
- package/common/ordering.instance.json +366 -246
- package/common/ordering.js +80 -86
- package/common/people.instance.json +2074 -1022
- package/common/people.js +8 -13
- package/common/percentages.instance.json +2 -0
- package/common/percentages.js +53 -0
- package/common/percentages.test.json +751 -0
- package/common/pipboy.instance.json +11745 -6329
- package/common/pipboy.js +48 -59
- package/common/pokemon.instance.json +4226 -2081
- package/common/pokemon.js +7 -20
- package/common/pos.js +15 -13
- package/common/pressure.instance.json +2208 -1175
- package/common/pressure.js +4 -8
- package/common/properties.instance.json +131 -61
- package/common/properties.js +57 -134
- package/common/punctuation.js +15 -7
- package/common/reports.instance.json +1018 -530
- package/common/reports.js +77 -100
- package/common/reports.test.json +15623 -10458
- package/common/scorekeeper.js +18 -30
- package/common/sdefaults.js +16 -7
- package/common/sizeable.js +6 -10
- package/common/spock.instance.json +584 -290
- package/common/spock.js +5 -8
- package/common/stgame.js +19 -19
- package/common/stm.js +164 -27
- package/common/stm.test.json +1734 -1
- package/common/tell.js +14 -18
- package/common/temperature.instance.json +2271 -1222
- package/common/temperature.js +4 -8
- package/common/tester.js +15 -4
- package/common/testing.js +8 -12
- package/common/time.js +20 -25
- package/common/tokenize.js +5 -6
- package/common/ui.instance.json +459 -240
- package/common/ui.js +16 -22
- package/common/weight.instance.json +7646 -4026
- package/common/weight.js +4 -8
- package/common/yesno.js +5 -5
- package/main.js +14 -2
- package/package.json +28 -5
package/common/animals.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
const { defaultContextCheck } = require('./helpers')
|
2
|
-
const {
|
2
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
3
3
|
const hierarchy = require('./hierarchy')
|
4
4
|
const animals_tests = require('./animals.test.json')
|
5
5
|
const animals_instance = require('./animals.instance.json')
|
@@ -25,26 +25,23 @@ const template = {
|
|
25
25
|
],
|
26
26
|
}
|
27
27
|
|
28
|
-
const createConfig = () => {
|
29
|
-
const config = new Config({ name: 'animals' }, module)
|
30
|
-
config.add(hierarchy())
|
31
|
-
return config
|
32
|
-
}
|
33
|
-
|
34
28
|
knowledgeModule( {
|
35
|
-
|
36
|
-
|
37
|
-
createConfig, newWay: true,
|
38
|
-
test: {
|
39
|
-
name: './animals.test.json',
|
40
|
-
contents: animals_tests,
|
41
|
-
checks: {
|
42
|
-
context: defaultContextCheck,
|
43
|
-
},
|
29
|
+
config: { name: 'animals' },
|
30
|
+
includes: [hierarchy],
|
44
31
|
|
32
|
+
module,
|
33
|
+
description: 'animals related concepts',
|
34
|
+
newWay: true,
|
35
|
+
test: {
|
36
|
+
name: './animals.test.json',
|
37
|
+
contents: animals_tests,
|
38
|
+
checks: {
|
39
|
+
context: defaultContextCheck,
|
45
40
|
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
|
42
|
+
},
|
43
|
+
template: {
|
44
|
+
template,
|
45
|
+
instance: animals_instance
|
46
|
+
}
|
50
47
|
})
|
@@ -0,0 +1,103 @@
|
|
1
|
+
const { knowledgeModule, where, stableId } = require('./runtime').theprogrammablemind
|
2
|
+
const gdefaults = require('./gdefaults.js')
|
3
|
+
const pos = require('./pos.js')
|
4
|
+
const { defaultContextCheck } = require('./helpers')
|
5
|
+
const tests = require('./articles.test.json')
|
6
|
+
|
7
|
+
let config = {
|
8
|
+
name: 'articles',
|
9
|
+
operators: [
|
10
|
+
"([thisitthat|])",
|
11
|
+
"([it])",
|
12
|
+
"([this])",
|
13
|
+
"([that])",
|
14
|
+
"([queryable])",
|
15
|
+
/*
|
16
|
+
"(<what> ([whatAble|]))",
|
17
|
+
"([what:optional])",
|
18
|
+
*/
|
19
|
+
"(<the|> ([theAble]))",
|
20
|
+
"(<a|a,an> ([theAble|]))",
|
21
|
+
],
|
22
|
+
bridges: [
|
23
|
+
// { id: "what", level: 0, optional: "{ ...next(operator), query: ['what'], determined: true }", bridge: "{ ...after, query: ['what'], modifiers: ['what'], what: operator }" },
|
24
|
+
// { id: "whatAble", level: 0, bridge: "{ ...next(operator) }" },
|
25
|
+
{
|
26
|
+
id: 'the',
|
27
|
+
level: 0,
|
28
|
+
bridge: '{ ...after[0], focusableForPhrase: true, pullFromContext: true, concept: true, wantsValue: true, determiner: "the", modifiers: append(["determiner"], after[0].modifiers)}'
|
29
|
+
},
|
30
|
+
{
|
31
|
+
id: "a",
|
32
|
+
level: 0,
|
33
|
+
// bridge: "{ ...after[0], pullFromContext: false, instance: true, concept: true, number: 'one', wantsValue: true, determiner: operator, modifiers: append(['determiner'], after[0].modifiers) }"
|
34
|
+
bridge: "{ ...after[0], pullFromContext: false, instance: true, concept: true, number: 'one', wantsValue: true, determiner: operator, modifiers: append(['determiner'], after[0].modifiers) }"
|
35
|
+
},
|
36
|
+
{ id: "queryable" },
|
37
|
+
{
|
38
|
+
id: "theAble",
|
39
|
+
children: ['noun'],
|
40
|
+
bridge: "{ ...next(operator) }"
|
41
|
+
},
|
42
|
+
|
43
|
+
{
|
44
|
+
id: "thisitthat",
|
45
|
+
level: 0,
|
46
|
+
isA: ['queryable'],
|
47
|
+
before: ['verb'],
|
48
|
+
bridge: "{ ...next(operator) }"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
id: "it",
|
52
|
+
level: 0,
|
53
|
+
isA: ['thisitthat'],
|
54
|
+
bridge: "{ ...next(operator), pullFromContext: true, unknown: true, determined: true }"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
id: "this",
|
58
|
+
level: 0,
|
59
|
+
isA: ['thisitthat'],
|
60
|
+
bridge: "{ ...next(operator), unknown: true, pullFromContext: true }"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
id: "that",
|
64
|
+
level: 0,
|
65
|
+
isA: ['thisitthat'],
|
66
|
+
bridge: "{ ...next(operator), unknown: true, pullFromContext: true }"
|
67
|
+
},
|
68
|
+
],
|
69
|
+
words: {
|
70
|
+
"literals": {
|
71
|
+
"the": [{"id": "the", "initial": "{ modifiers: [] }" }],
|
72
|
+
}
|
73
|
+
},
|
74
|
+
hierarchy: [
|
75
|
+
['it', 'pronoun'],
|
76
|
+
['this', 'pronoun'],
|
77
|
+
// ['questionMark', 'isEd'],
|
78
|
+
['a', 'articlePOS'],
|
79
|
+
['the', 'articlePOS'],
|
80
|
+
['it', 'queryable'],
|
81
|
+
// ['it', 'toAble'],
|
82
|
+
['this', 'queryable'],
|
83
|
+
],
|
84
|
+
|
85
|
+
};
|
86
|
+
|
87
|
+
knowledgeModule( {
|
88
|
+
config,
|
89
|
+
includes: [pos, gdefaults],
|
90
|
+
|
91
|
+
module,
|
92
|
+
description: 'articles',
|
93
|
+
newWay: true,
|
94
|
+
test: {
|
95
|
+
name: './articles.test.json',
|
96
|
+
contents: tests,
|
97
|
+
checks: {
|
98
|
+
objects: ['onNevermindWasCalled', 'nevermindType', 'idSuffix'],
|
99
|
+
context: defaultContextCheck,
|
100
|
+
},
|
101
|
+
|
102
|
+
},
|
103
|
+
})
|
@@ -0,0 +1,310 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"associations": [
|
4
|
+
[
|
5
|
+
[
|
6
|
+
"the",
|
7
|
+
0
|
8
|
+
],
|
9
|
+
[
|
10
|
+
"theAble",
|
11
|
+
0
|
12
|
+
]
|
13
|
+
]
|
14
|
+
],
|
15
|
+
"config": {
|
16
|
+
},
|
17
|
+
"contexts": [
|
18
|
+
{
|
19
|
+
"concept": true,
|
20
|
+
"dead": true,
|
21
|
+
"default": true,
|
22
|
+
"determiner": "the",
|
23
|
+
"focusableForPhrase": true,
|
24
|
+
"level": 1,
|
25
|
+
"marker": "theAble",
|
26
|
+
"modifiers": [
|
27
|
+
"determiner"
|
28
|
+
],
|
29
|
+
"pullFromContext": true,
|
30
|
+
"range": {
|
31
|
+
"end": 10,
|
32
|
+
"start": 0
|
33
|
+
},
|
34
|
+
"text": "the theable",
|
35
|
+
"topLevel": true,
|
36
|
+
"types": [
|
37
|
+
"theAble"
|
38
|
+
],
|
39
|
+
"value": "theAble",
|
40
|
+
"wantsValue": true,
|
41
|
+
"word": "theable"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"developerTest": false,
|
45
|
+
"generatedParenthesized": [
|
46
|
+
""
|
47
|
+
],
|
48
|
+
"metadata": {
|
49
|
+
"opChoices": [
|
50
|
+
{
|
51
|
+
"counter": 1,
|
52
|
+
"op": [
|
53
|
+
"theAble",
|
54
|
+
0
|
55
|
+
],
|
56
|
+
"ops": [
|
57
|
+
[
|
58
|
+
"the",
|
59
|
+
0
|
60
|
+
],
|
61
|
+
[
|
62
|
+
"theAble",
|
63
|
+
0
|
64
|
+
]
|
65
|
+
]
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"counter": 2,
|
69
|
+
"op": [
|
70
|
+
"the",
|
71
|
+
0
|
72
|
+
],
|
73
|
+
"ops": [
|
74
|
+
[
|
75
|
+
"the",
|
76
|
+
0
|
77
|
+
]
|
78
|
+
]
|
79
|
+
}
|
80
|
+
]
|
81
|
+
},
|
82
|
+
"objects": {
|
83
|
+
"nameToUUID": {
|
84
|
+
"articles": "articles1",
|
85
|
+
"gdefaults": "gdefaults2",
|
86
|
+
"pos": "pos2",
|
87
|
+
"tokenize": "tokenize2"
|
88
|
+
},
|
89
|
+
"namespaced": {
|
90
|
+
"articles1": {
|
91
|
+
},
|
92
|
+
"gdefaults2": {
|
93
|
+
},
|
94
|
+
"pos2": {
|
95
|
+
},
|
96
|
+
"tokenize2": {
|
97
|
+
}
|
98
|
+
},
|
99
|
+
"processed": [
|
100
|
+
{
|
101
|
+
"context": {
|
102
|
+
"concept": true,
|
103
|
+
"dead": true,
|
104
|
+
"default": true,
|
105
|
+
"determiner": "the",
|
106
|
+
"focusableForPhrase": true,
|
107
|
+
"level": 1,
|
108
|
+
"marker": "theAble",
|
109
|
+
"modifiers": [
|
110
|
+
"determiner"
|
111
|
+
],
|
112
|
+
"pullFromContext": true,
|
113
|
+
"range": {
|
114
|
+
"end": 10,
|
115
|
+
"start": 0
|
116
|
+
},
|
117
|
+
"text": "the theable",
|
118
|
+
"topLevel": true,
|
119
|
+
"types": [
|
120
|
+
"theAble"
|
121
|
+
],
|
122
|
+
"value": "theAble",
|
123
|
+
"wantsValue": true,
|
124
|
+
"word": "theable"
|
125
|
+
},
|
126
|
+
"generatedParenthesized": "",
|
127
|
+
"paraphrases": "the theable",
|
128
|
+
"paraphrasesParenthesized": "(the (theable))",
|
129
|
+
"responses": [
|
130
|
+
""
|
131
|
+
]
|
132
|
+
}
|
133
|
+
]
|
134
|
+
},
|
135
|
+
"paraphrases": [
|
136
|
+
"the theable"
|
137
|
+
],
|
138
|
+
"paraphrasesParenthesized": [
|
139
|
+
"(the (theable))"
|
140
|
+
],
|
141
|
+
"query": "the theable",
|
142
|
+
"responses": [
|
143
|
+
""
|
144
|
+
]
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"associations": [
|
148
|
+
[
|
149
|
+
[
|
150
|
+
"a",
|
151
|
+
0
|
152
|
+
],
|
153
|
+
[
|
154
|
+
"theAble",
|
155
|
+
0
|
156
|
+
]
|
157
|
+
]
|
158
|
+
],
|
159
|
+
"config": {
|
160
|
+
},
|
161
|
+
"contexts": [
|
162
|
+
{
|
163
|
+
"concept": true,
|
164
|
+
"dead": true,
|
165
|
+
"default": true,
|
166
|
+
"determiner": {
|
167
|
+
"default": true,
|
168
|
+
"level": 0,
|
169
|
+
"marker": "a",
|
170
|
+
"range": {
|
171
|
+
"end": 0,
|
172
|
+
"start": 0
|
173
|
+
},
|
174
|
+
"text": "a",
|
175
|
+
"word": "a"
|
176
|
+
},
|
177
|
+
"level": 1,
|
178
|
+
"marker": "theAble",
|
179
|
+
"modifiers": [
|
180
|
+
"determiner"
|
181
|
+
],
|
182
|
+
"number": "one",
|
183
|
+
"pullFromContext": false,
|
184
|
+
"range": {
|
185
|
+
"end": 8,
|
186
|
+
"start": 0
|
187
|
+
},
|
188
|
+
"text": "a theable",
|
189
|
+
"topLevel": true,
|
190
|
+
"types": [
|
191
|
+
"theAble"
|
192
|
+
],
|
193
|
+
"value": "theAble",
|
194
|
+
"wantsValue": true,
|
195
|
+
"word": "theable"
|
196
|
+
}
|
197
|
+
],
|
198
|
+
"developerTest": false,
|
199
|
+
"generatedParenthesized": [
|
200
|
+
""
|
201
|
+
],
|
202
|
+
"metadata": {
|
203
|
+
"opChoices": [
|
204
|
+
{
|
205
|
+
"counter": 1,
|
206
|
+
"op": [
|
207
|
+
"theAble",
|
208
|
+
0
|
209
|
+
],
|
210
|
+
"ops": [
|
211
|
+
[
|
212
|
+
"a",
|
213
|
+
0
|
214
|
+
],
|
215
|
+
[
|
216
|
+
"theAble",
|
217
|
+
0
|
218
|
+
]
|
219
|
+
]
|
220
|
+
},
|
221
|
+
{
|
222
|
+
"counter": 2,
|
223
|
+
"op": [
|
224
|
+
"a",
|
225
|
+
0
|
226
|
+
],
|
227
|
+
"ops": [
|
228
|
+
[
|
229
|
+
"a",
|
230
|
+
0
|
231
|
+
]
|
232
|
+
]
|
233
|
+
}
|
234
|
+
]
|
235
|
+
},
|
236
|
+
"objects": {
|
237
|
+
"nameToUUID": {
|
238
|
+
"articles": "articles1",
|
239
|
+
"gdefaults": "gdefaults2",
|
240
|
+
"pos": "pos2",
|
241
|
+
"tokenize": "tokenize2"
|
242
|
+
},
|
243
|
+
"namespaced": {
|
244
|
+
"articles1": {
|
245
|
+
},
|
246
|
+
"gdefaults2": {
|
247
|
+
},
|
248
|
+
"pos2": {
|
249
|
+
},
|
250
|
+
"tokenize2": {
|
251
|
+
}
|
252
|
+
},
|
253
|
+
"processed": [
|
254
|
+
{
|
255
|
+
"context": {
|
256
|
+
"concept": true,
|
257
|
+
"dead": true,
|
258
|
+
"default": true,
|
259
|
+
"determiner": {
|
260
|
+
"default": true,
|
261
|
+
"level": 0,
|
262
|
+
"marker": "a",
|
263
|
+
"range": {
|
264
|
+
"end": 0,
|
265
|
+
"start": 0
|
266
|
+
},
|
267
|
+
"text": "a",
|
268
|
+
"word": "a"
|
269
|
+
},
|
270
|
+
"level": 1,
|
271
|
+
"marker": "theAble",
|
272
|
+
"modifiers": [
|
273
|
+
"determiner"
|
274
|
+
],
|
275
|
+
"number": "one",
|
276
|
+
"pullFromContext": false,
|
277
|
+
"range": {
|
278
|
+
"end": 8,
|
279
|
+
"start": 0
|
280
|
+
},
|
281
|
+
"text": "a theable",
|
282
|
+
"topLevel": true,
|
283
|
+
"types": [
|
284
|
+
"theAble"
|
285
|
+
],
|
286
|
+
"value": "theAble",
|
287
|
+
"wantsValue": true,
|
288
|
+
"word": "theable"
|
289
|
+
},
|
290
|
+
"generatedParenthesized": "",
|
291
|
+
"paraphrases": "a theable",
|
292
|
+
"paraphrasesParenthesized": "((a) (theable))",
|
293
|
+
"responses": [
|
294
|
+
""
|
295
|
+
]
|
296
|
+
}
|
297
|
+
]
|
298
|
+
},
|
299
|
+
"paraphrases": [
|
300
|
+
"a theable"
|
301
|
+
],
|
302
|
+
"paraphrasesParenthesized": [
|
303
|
+
"((a) (theable))"
|
304
|
+
],
|
305
|
+
"query": "a theable",
|
306
|
+
"responses": [
|
307
|
+
""
|
308
|
+
]
|
309
|
+
}
|
310
|
+
]
|
package/common/avatar.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const dialogues = require('./dialogues')
|
4
4
|
const hierarchy = require('./hierarchy')
|
5
5
|
const emotions = require('./emotions')
|
6
6
|
const avatar_tests = require('./avatar.test.json')
|
7
7
|
|
8
|
-
let
|
8
|
+
let config = {
|
9
9
|
name: 'avatar',
|
10
10
|
|
11
11
|
// TODO make different response for answerNotKnown based on emotions
|
@@ -68,16 +68,12 @@ let configStruct = {
|
|
68
68
|
|
69
69
|
};
|
70
70
|
|
71
|
-
const createConfig = () => {
|
72
|
-
const config = new Config(configStruct, module)
|
73
|
-
config.add(hierarchy(), emotions())
|
74
|
-
return config
|
75
|
-
}
|
76
|
-
|
77
71
|
knowledgeModule( {
|
72
|
+
config,
|
73
|
+
includes: [hierarchy, emotions],
|
74
|
+
|
78
75
|
module,
|
79
76
|
description: 'avatar for dialogues',
|
80
|
-
createConfig,
|
81
77
|
test: {
|
82
78
|
name: './avatar.test.json',
|
83
79
|
contents: avatar_tests,
|
package/common/characters.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where, process:clientProcess } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const gdefaults = require('./gdefaults.js')
|
4
4
|
const createCurrencyKM = require('./currency.js')
|
@@ -28,7 +28,7 @@ const getHelp = (config, indent=2) => {
|
|
28
28
|
-> get response back: sally said: blah
|
29
29
|
*/
|
30
30
|
|
31
|
-
let
|
31
|
+
let config = {
|
32
32
|
name: 'characters',
|
33
33
|
|
34
34
|
operators: [
|
@@ -126,7 +126,8 @@ class Sally {
|
|
126
126
|
}
|
127
127
|
*/
|
128
128
|
this.timeKM.server(config.getServer(), config.getAPIKey())
|
129
|
-
return this.timeKM.process(utterance)
|
129
|
+
// return this.timeKM.process(utterance)
|
130
|
+
return clientProcess(this.timeKM, utterance)
|
130
131
|
}
|
131
132
|
|
132
133
|
response({context, result}) {
|
@@ -150,7 +151,9 @@ class Bob {
|
|
150
151
|
|
151
152
|
process(config, utterance) {
|
152
153
|
this.currencyKM.server(config.getServer(), config.getAPIKey())
|
153
|
-
return this.currencyKM.process(utterance, { credentials: this.credentials })
|
154
|
+
// return this.currencyKM.process(utterance, { credentials: this.credentials })
|
155
|
+
// return clientProcess(this.currencyKM.process, utterance, { credentials: this.credentials })
|
156
|
+
return clientProcess(this.currencyKM, utterance)
|
154
157
|
}
|
155
158
|
|
156
159
|
response({context, result}) {
|
@@ -173,36 +176,27 @@ const initializeApi = (config, api) => {
|
|
173
176
|
}
|
174
177
|
|
175
178
|
|
176
|
-
const
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
config.multiApi = initializeApi
|
187
|
-
config.initializer( ({isModule, config, km}) => {
|
188
|
-
if (!isModule) {
|
189
|
-
// config.api = api2
|
190
|
-
// config.api = api
|
191
|
-
const config = km('characters')
|
192
|
-
config.api = api2
|
193
|
-
config.api = api
|
194
|
-
}
|
195
|
-
})
|
196
|
-
config.restart_auto_rebuild()
|
197
|
-
return config
|
179
|
+
const initializer = async ({isModule, km}) => {
|
180
|
+
if (!isModule) {
|
181
|
+
const timeKM = await createTimeKM()
|
182
|
+
const currencyKM = await createCurrencyKM()
|
183
|
+
const config = km('characters')
|
184
|
+
const api = new Sally(timeKM)
|
185
|
+
const api2 = new Bob(currencyKM)
|
186
|
+
await config.setApi(() => api2)
|
187
|
+
await config.setApi(() => api)
|
188
|
+
}
|
198
189
|
}
|
199
|
-
|
200
190
|
// mode this to non-module init only
|
201
191
|
knowledgeModule({
|
192
|
+
config,
|
193
|
+
includes: [gdefaults],
|
194
|
+
initializer,
|
195
|
+
multiApiInitializer: initializeApi,
|
196
|
+
|
202
197
|
module,
|
203
198
|
description: 'this module is for creating a team of characters that can respond to commands',
|
204
199
|
demo: "https://youtu.be/eA25GZ0ZAHo",
|
205
|
-
createConfig,
|
206
200
|
test: {
|
207
201
|
name: './characters.test.json',
|
208
202
|
contents: characters_tests,
|