theprogrammablemind_4wp 7.10.0-beta.1 → 7.10.0-beta.11
Sign up to get free protection for your applications and to get access to all the features.
- package/client.js +25 -6
- package/package.json +1 -1
- package/src/config.js +14 -7
package/client.js
CHANGED
@@ -362,7 +362,7 @@ const writeTest = (fn, query, objects, generated, paraphrases, responses, contex
|
|
362
362
|
}
|
363
363
|
associations.sort()
|
364
364
|
// tests[query] = sortJson({ paraphrases, responses, contexts, objects: convertToStable(objects), associations, metadata, config, developerTest: saveDeveloper }, { depth: 25 })
|
365
|
-
results = sortJson({
|
365
|
+
const results = sortJson({
|
366
366
|
query,
|
367
367
|
paraphrases,
|
368
368
|
responses,
|
@@ -667,7 +667,11 @@ const loadInstance = (config, instance) => {
|
|
667
667
|
global.transitoryMode = transitoryMode
|
668
668
|
}
|
669
669
|
|
670
|
-
const
|
670
|
+
const throwErrorHandler = (error) => {
|
671
|
+
throw error
|
672
|
+
}
|
673
|
+
|
674
|
+
const _process = async (config, query, { initializer, commandLineArgs, credentials, writeTests, isTest, saveDeveloper, rebuildingTemplate, testConfig, testsFN, errorHandler = throwErrorHandler } = {}) => {
|
671
675
|
if (credentials) {
|
672
676
|
config.server(credentials.server, credentials.key)
|
673
677
|
}
|
@@ -1462,6 +1466,19 @@ const knowledgeModuleImpl = async ({
|
|
1462
1466
|
...rest
|
1463
1467
|
} = {}) => {
|
1464
1468
|
|
1469
|
+
/*
|
1470
|
+
if (description == 'fastfood related concepts') {
|
1471
|
+
debugger
|
1472
|
+
global.old = template.template.queries[91].bridges[0]
|
1473
|
+
}
|
1474
|
+
let old
|
1475
|
+
if (template && template.template && template.template.queries) {
|
1476
|
+
old = template.template.queries
|
1477
|
+
template.template.queries = _.cloneDeep(template.template.queries)
|
1478
|
+
template.wasCopied = true
|
1479
|
+
}
|
1480
|
+
*/
|
1481
|
+
|
1465
1482
|
const unknownArgs = Object.keys(rest)
|
1466
1483
|
if (unknownArgs.length > 0) {
|
1467
1484
|
throw new Error(`Unknown arguments to knowledgeModule: ${unknownArgs.join()}`)
|
@@ -2011,6 +2028,12 @@ const knowledgeModuleImpl = async ({
|
|
2011
2028
|
printConfig()
|
2012
2029
|
} else {
|
2013
2030
|
const initConfig = (config) => {
|
2031
|
+
if (template) {
|
2032
|
+
if (config.needsRebuild(template.template, template.instance, { isModule: !isProcess }).needsRebuild) {
|
2033
|
+
const error = `This module "${config.name}" cannot be used because the instance file needs rebuilding. Run on the command line with no arguments or the -rt argument to rebuild.`
|
2034
|
+
throw new Error(error)
|
2035
|
+
}
|
2036
|
+
}
|
2014
2037
|
setupConfig(config)
|
2015
2038
|
|
2016
2039
|
let loadForTesting = false
|
@@ -2038,10 +2061,6 @@ const knowledgeModuleImpl = async ({
|
|
2038
2061
|
}
|
2039
2062
|
|
2040
2063
|
if (template) {
|
2041
|
-
if (config.needsRebuild(template.template, template.instance, { isModule: !isProcess }).needsRebuild) {
|
2042
|
-
const error = `This module "${config.name}" cannot be used because the instance file needs rebuilding. Run on the command line with no arguments or the -rt argument to rebuild.`
|
2043
|
-
throw new Error(error)
|
2044
|
-
}
|
2045
2064
|
try {
|
2046
2065
|
config.load(template.template, template.instance)
|
2047
2066
|
} catch( e ) {
|
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -204,6 +204,9 @@ const handleBridgeProps = (config, bridge, addFirst) => {
|
|
204
204
|
ecatch(`While processing the bridge for ${bridge.id}#${bridge.level}`,
|
205
205
|
() => {
|
206
206
|
if (!bridge.bridge) {
|
207
|
+
if (bridge.id == 'modification') {
|
208
|
+
debugger
|
209
|
+
}
|
207
210
|
bridge.bridge = "{ ...next(operator) }"
|
208
211
|
}
|
209
212
|
if (!bridge.level) {
|
@@ -344,11 +347,15 @@ const handleBridgeProps = (config, bridge, addFirst) => {
|
|
344
347
|
}
|
345
348
|
|
346
349
|
const handleCalculatedProps = (baseConfig, moreConfig, addFirst) => {
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
350
|
+
if (moreConfig.bridges) {
|
351
|
+
moreConfig.bridges = moreConfig.bridges.map((bridge) => {
|
352
|
+
bridge = {...bridge}
|
353
|
+
const valid = [ 'after', 'before', 'bridge', 'development', 'evaluator', 'generatorp', 'generatorr', 'generatorpr', 'generators', 'id', 'convolution', 'inverted', 'isA', 'children', 'parents',
|
354
|
+
'level', 'optional', 'selector', 'semantic', 'words', /Bridge$/, 'localHierarchy', 'levelSpecificHierarchy', 'where', 'uuid' ]
|
355
|
+
helpers.validProps(valid, bridge, 'bridge')
|
356
|
+
handleBridgeProps(baseConfig, bridge, addFirst)
|
357
|
+
return bridge
|
358
|
+
})
|
352
359
|
}
|
353
360
|
if (moreConfig.operators) {
|
354
361
|
moreConfig.operators = moreConfig.operators.map((operator) => {
|
@@ -1103,7 +1110,8 @@ class Config {
|
|
1103
1110
|
}
|
1104
1111
|
}
|
1105
1112
|
|
1106
|
-
|
1113
|
+
const debug = true
|
1114
|
+
if (debug && startOfChanges) {
|
1107
1115
|
console.log('templateQueries[startOfChanges]', templateQueries[startOfChanges]);
|
1108
1116
|
console.log('instanceQueries[startOfChanges]', instanceQueries[startOfChanges]);
|
1109
1117
|
}
|
@@ -1114,7 +1122,6 @@ class Config {
|
|
1114
1122
|
}
|
1115
1123
|
// const sameQueries = helpers.safeEquals(toCanonicalQueries(template.queries || []).map(helpers.updateQueries), toCanonicalQueries(instance.queries || []))
|
1116
1124
|
|
1117
|
-
const debug = false
|
1118
1125
|
if (debug) {
|
1119
1126
|
if (!(instance && sameQueries && sameFragments)) {
|
1120
1127
|
if (!sameQueries) {
|