theprogrammablemind 8.1.0-beta.0 → 8.1.0-beta.1
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 +16 -8
- package/package.json +1 -1
package/client.js
CHANGED
@@ -441,7 +441,7 @@ const getConfigForTest = (config, testConfig) => {
|
|
441
441
|
return configForTest
|
442
442
|
}
|
443
443
|
|
444
|
-
const runTest = async (config, expected, { args, verbose, testConfig, debug }) => {
|
444
|
+
const runTest = async (config, expected, { args, verbose, testConfig, debug, timings={ server: 0, client: 0 } }) => {
|
445
445
|
const test = expected.query
|
446
446
|
if (args.query && args.query != test) {
|
447
447
|
// no run this
|
@@ -472,6 +472,8 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug }) =
|
|
472
472
|
const lines = new Lines(widths)
|
473
473
|
lines.setElement(0, 0, test)
|
474
474
|
lines.setElement(0, 1, `time on server: ${result.times.toFixed(2)} client: ${(result.clientSideTimes / 1000).toFixed(2)}`)
|
475
|
+
timings.server += result.times
|
476
|
+
timings.client += result.clientSideTimes / 1000
|
475
477
|
lines.log()
|
476
478
|
}
|
477
479
|
const expected_objects = sortJson(convertToStable(expected.objects), { depth: 25 })
|
@@ -784,7 +786,7 @@ const defaultInnerProcess = (config, errorHandler, responses) => {
|
|
784
786
|
responses.errors.forEach((error) => console.log(` ${error}`))
|
785
787
|
}
|
786
788
|
console.log("KM's loaded (ordered)", config.configs.map((c) => c.name))
|
787
|
-
console.log('This is the global objects from running semantics:\n', config.objects)
|
789
|
+
// console.log('This is the global objects from running semantics:\n', config.objects)
|
788
790
|
if (!_.isEmpty(responses.learned_contextual_priorities)) {
|
789
791
|
console.log('\nThe learned contextual priorties are :\n')
|
790
792
|
for (const lcp of responses.learned_contextual_priorities) {
|
@@ -801,10 +803,12 @@ const defaultInnerProcess = (config, errorHandler, responses) => {
|
|
801
803
|
}
|
802
804
|
console.log(responses.trace)
|
803
805
|
|
804
|
-
if (
|
805
|
-
|
806
|
-
|
807
|
-
|
806
|
+
if (false) {
|
807
|
+
if (global.beforeObjects) {
|
808
|
+
console.log('objects', runtime.jsonDiff.diffString(global.beforeObjects, config.get('objects')))
|
809
|
+
} else {
|
810
|
+
console.log('objects', runtime.util.inspect(config.get('objects'), { depth: Infinity, sorted: true }))
|
811
|
+
}
|
808
812
|
}
|
809
813
|
|
810
814
|
const pickEm = () => {
|
@@ -1229,6 +1233,7 @@ const knowledgeModuleImpl = async ({
|
|
1229
1233
|
parser.add_argument('-do', '--debugOperator', { action: 'store_true', help: helpDebugOperator })
|
1230
1234
|
parser.add_argument('-ep', '--explainPriorities', { action: 'store_true', help: 'The server will return all priorities including the generated one along with an explanation of there they came from' })
|
1231
1235
|
parser.add_argument('-dic', '--debugIncludeConvolutions', { nargs: '?', help: 'When running with the --debugIncludeConvolutions flag the logs will include convolutions which are somewhat annoyingly verbose. Default is false' })
|
1236
|
+
parser.add_argument('-bc', '--bypassCache', { action: 'store_true', help: 'Bypass the cache on the server side and rebuild' })
|
1232
1237
|
|
1233
1238
|
const args = parser.parse_args()
|
1234
1239
|
args.count = args.count || 1
|
@@ -1488,7 +1493,7 @@ const knowledgeModuleImpl = async ({
|
|
1488
1493
|
}
|
1489
1494
|
}
|
1490
1495
|
|
1491
|
-
if (args.
|
1496
|
+
if (args.bypassCache) {
|
1492
1497
|
config.config.retrain = true
|
1493
1498
|
}
|
1494
1499
|
|
@@ -1520,7 +1525,8 @@ const knowledgeModuleImpl = async ({
|
|
1520
1525
|
useTestConfig.testModuleName = args.testModuleName
|
1521
1526
|
test = useTestConfig.name
|
1522
1527
|
}
|
1523
|
-
|
1528
|
+
const timings = { server: 0, client: 0 }
|
1529
|
+
await runTests(config, test, { timings, args, debug: args.debug, testConfig: useTestConfig, verbose: args.testVerbose || args.testAllVerbose, stopAtFirstError: !args.testAllVerbose }).then((results) => {
|
1524
1530
|
let newError = false
|
1525
1531
|
if (results.length > 0) {
|
1526
1532
|
let headerShown = false
|
@@ -1552,6 +1558,8 @@ const knowledgeModuleImpl = async ({
|
|
1552
1558
|
}
|
1553
1559
|
}
|
1554
1560
|
|
1561
|
+
|
1562
|
+
console.log(`Total Server Time: ${timings.server.toFixed(2)}. Total Client Time: ${timings.client.toFixed(2)}`)
|
1555
1563
|
if (hasError) {
|
1556
1564
|
console.log('**************************** ERRORS ************************')
|
1557
1565
|
for (const result of results) {
|