theprogrammablemind 7.5.5-beta.9 → 7.5.6-beta.0
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/client.js +31 -15
- package/package.json +1 -1
- package/src/generators.js +4 -1
package/client.js
CHANGED
@@ -244,14 +244,18 @@ const processContext = (context, { objects = {}, config, logs = [] }) => {
|
|
244
244
|
}
|
245
245
|
|
246
246
|
const convertToStable = (objects) => {
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
stableObjects.namespaced
|
252
|
-
counter
|
253
|
-
|
254
|
-
|
247
|
+
if (true) {
|
248
|
+
return objects
|
249
|
+
} else {
|
250
|
+
const stableObjects = Object.assign({}, objects)
|
251
|
+
stableObjects.namespaced = {}
|
252
|
+
let counter = 0
|
253
|
+
Object.keys(((objects || {}).namespaced || {})).forEach((uuid) => {
|
254
|
+
stableObjects.namespaced[`${counter}`] = objects.namespaced[uuid]
|
255
|
+
counter += 1
|
256
|
+
})
|
257
|
+
return stableObjects
|
258
|
+
}
|
255
259
|
}
|
256
260
|
|
257
261
|
const writeTestFile = (fn, tests) => {
|
@@ -378,7 +382,7 @@ const processContextsB = ({ config, hierarchy, semantics, generators, json, isTe
|
|
378
382
|
context.topLevel = true
|
379
383
|
try {
|
380
384
|
if (json.has_errors) {
|
381
|
-
throw new Error('There are errors in the logs')
|
385
|
+
throw new Error('There are errors in the logs. Run with the -d flag and grep for Error')
|
382
386
|
}
|
383
387
|
if (!config.get('skipSemantics')) {
|
384
388
|
if (!config.doMotivations(args, context)) {
|
@@ -690,8 +694,10 @@ const runTest = async (config, expected, { verbose, afterTest, testConfig, debug
|
|
690
694
|
}
|
691
695
|
|
692
696
|
let objects = getObjects(config.config.objects)(config.uuid)
|
697
|
+
let testConfigName = config.name
|
693
698
|
if (testConfig.testModuleName) {
|
694
699
|
objects = getObjects(config.config.objects)(config.getConfigs()[testConfig.testModuleName].uuid)
|
700
|
+
testConfigName = testConfig.testModuleName
|
695
701
|
}
|
696
702
|
config.beforeQuery({ query: test, isModule: false, objects })
|
697
703
|
// config.resetMotivations()
|
@@ -722,7 +728,8 @@ const runTest = async (config, expected, { verbose, afterTest, testConfig, debug
|
|
722
728
|
}
|
723
729
|
return picked
|
724
730
|
}
|
725
|
-
|
731
|
+
debugger
|
732
|
+
const expected_checked = sortJson(pickEm(expected.objects.namespaced[expected.objects.nameToUUID[testConfigName]]), { depth: 25 })
|
726
733
|
const actual_checked = sortJson(pickEm(objects), { depth: 25 })
|
727
734
|
const failed_checked = !matching(actual_objects, expected_objects)
|
728
735
|
|
@@ -811,7 +818,14 @@ const saveTest = async (testFile, config, test, expected, testConfig, saveDevelo
|
|
811
818
|
const result = await _process(config, test, { isTest: true })
|
812
819
|
// const actualObjects = config.config.objects
|
813
820
|
const actualConfig = getConfigForTest(config, testConfig)
|
814
|
-
|
821
|
+
const args = {
|
822
|
+
}
|
823
|
+
const saveObjects = {...config.config.objects}
|
824
|
+
saveObjects.nameToUUID = {}
|
825
|
+
for (let km of config.configs) {
|
826
|
+
saveObjects.nameToUUID[km.name] = km.uuid
|
827
|
+
}
|
828
|
+
writeTest(testFile, test, saveObjects, result.generated, result.paraphrases, result.responses, result.contexts, result.associations, result.metadata, actualConfig, saveDeveloper)
|
815
829
|
}
|
816
830
|
|
817
831
|
const saveTestsHelper = async (testFile, config, tests, todo, testConfig, saveDeveloper) => {
|
@@ -1265,9 +1279,11 @@ const knowledgeModule = async ({
|
|
1265
1279
|
processResults = processResults({ config, errorHandler })
|
1266
1280
|
config.description = description
|
1267
1281
|
config.demo = demo
|
1268
|
-
if (typeof test === 'object'
|
1269
|
-
|
1270
|
-
|
1282
|
+
if (typeof test === 'object') {
|
1283
|
+
if (test.contents) {
|
1284
|
+
config.tests = test.contents
|
1285
|
+
test = test.name
|
1286
|
+
}
|
1271
1287
|
} else {
|
1272
1288
|
if (runtime.fs && runtime.fs.existsSync(test)) {
|
1273
1289
|
config.tests = JSON.parse(runtime.fs.readFileSync(test))
|
@@ -1275,6 +1291,7 @@ const knowledgeModule = async ({
|
|
1275
1291
|
config.tests = {}
|
1276
1292
|
}
|
1277
1293
|
}
|
1294
|
+
config.setTestConfig(testConfig)
|
1278
1295
|
|
1279
1296
|
if (!isProcess) {
|
1280
1297
|
if (template) {
|
@@ -1652,7 +1669,6 @@ const knowledgeModule = async ({
|
|
1652
1669
|
}
|
1653
1670
|
} else {
|
1654
1671
|
config.addAssociationsFromTests(config.tests);
|
1655
|
-
config.setTestConfig(testConfig)
|
1656
1672
|
//for (let query in config.tests) {
|
1657
1673
|
// config.addAssociations(config.tests[query].associations || []);
|
1658
1674
|
//}
|
package/package.json
CHANGED
package/src/generators.js
CHANGED
@@ -115,6 +115,9 @@ class Generator {
|
|
115
115
|
apis: this.getAPIs(config)
|
116
116
|
}
|
117
117
|
const args = Object.assign({}, baseArgs, moreArgs, (baseArgs.getUUIDScoped || (() => { return {} }))(this.uuid))
|
118
|
+
if (this.property == 'generatorp') {
|
119
|
+
args.g = args.gp
|
120
|
+
}
|
118
121
|
// if (this.callId) {
|
119
122
|
// greg
|
120
123
|
/*
|
@@ -262,10 +265,10 @@ class Generators {
|
|
262
265
|
lines.newRow()
|
263
266
|
lines.setElement(0, 1, 'STACK')
|
264
267
|
lines.setElement(0, 2, stack)
|
265
|
-
lines.newRow()
|
266
268
|
lines.newRow()
|
267
269
|
lines.setElement(0, 1, 'DEBUG')
|
268
270
|
lines.setElement(0, 2, `To debug this use args.callId == '${args.calls.current()}'`)
|
271
|
+
lines.newRow()
|
269
272
|
lines.setElement(0, 1, 'TO')
|
270
273
|
lines.setElement(0, 2, `(HASHCODE ${helpers.hashCode(JSON.stringify(helpers.sortJson(context, { depth: 25 })))})`)
|
271
274
|
lines.setElement(1, 2, JSON.stringify(helpers.sortJson(context, { depth: 25 }), null, 2))
|