theprogrammablemind_4wp 7.5.8-beta.0 → 7.5.8-beta.1

Sign up to get free protection for your applications and to get access to all the features.
package/client.js CHANGED
@@ -110,6 +110,9 @@ class ErrorReason extends Error {
110
110
  const setupArgs = (args, config, logs, hierarchy) => {
111
111
  config.setArgs(args)
112
112
  args.calls = new InitCalls(config.name)
113
+ if (global.theprogrammablemind && global.theprogrammablemind.loadForTesting) {
114
+ args.calls = new InitCalls(Object.keys(global.theprogrammablemind.loadForTesting)[0])
115
+ }
113
116
  args.km = (name) => config.getConfig(name)
114
117
  args.error = (context) => {
115
118
  throw new ErrorReason(context)
@@ -149,7 +152,10 @@ const setupArgs = (args, config, logs, hierarchy) => {
149
152
  args.g = (c) => config.getGenerators(logs).apply(args, c)
150
153
  args.gp = (c) => config.getGenerators(logs).apply(args, { ...c, paraphrase: true, isResponse: false, response: false})
151
154
  args.gr = (c) => config.getGenerators(logs).apply(args, { ...c, paraphrase: false, isResponse: true })
152
- args.e = (c) => config.getEvaluator(args.s, logs, c)
155
+ if (!logs) {
156
+ debugger
157
+ }
158
+ args.e = (c) => config.getEvaluator(args.s, args.calls, logs, c)
153
159
  args.log = (message) => logs.push(message)
154
160
  // config.getAddedArgs(args)
155
161
  args.gs = gs(args.g)
@@ -359,6 +365,9 @@ const processContextsB = ({ config, hierarchy, semantics, generators, json, isTe
359
365
 
360
366
  const objects = config.get('objects')
361
367
  const args = { objects, isResponse: true, response: json, isTest, getObjects: getObjects(objects) }
368
+ if (!json.logs) {
369
+ json.logs = []
370
+ }
362
371
  setupArgs(args, config, json.logs, hierarchy)
363
372
  const toDo = [...contexts]
364
373
  args.insert = (context) => toDo.unshift(context)
@@ -857,10 +866,12 @@ const saveTest = async (testFile, config, test, expected, testConfig, saveDevelo
857
866
  const args = {
858
867
  }
859
868
  const saveObjects = {...config.config.objects}
869
+ /*
860
870
  saveObjects.nameToUUID = {}
861
871
  for (let km of config.configs) {
862
872
  saveObjects.nameToUUID[km.name] = km.uuid
863
873
  }
874
+ */
864
875
  writeTest(testFile, test, saveObjects, result.generated, result.paraphrases, result.responses, result.contexts, result.associations, result.metadata, actualConfig, saveDeveloper)
865
876
  }
866
877
 
@@ -1344,7 +1355,11 @@ const knowledgeModule = async ({
1344
1355
  if (config.needsRebuild(template.template, template.instance)) {
1345
1356
  throw `This module "${config.name}" cannot be used because the instance file needs rebuilding. Run on the command line with no arguements or the -rt argument to rebuild.`
1346
1357
  }
1347
- config.load(template.template, template.instance)
1358
+ try {
1359
+ config.load(template.template, template.instance)
1360
+ } catch( e ) {
1361
+ errorHandler(e)
1362
+ }
1348
1363
  }
1349
1364
  }
1350
1365
  if (isProcess) {
@@ -1587,11 +1602,6 @@ const knowledgeModule = async ({
1587
1602
 
1588
1603
  }
1589
1604
  runTests(config, test, { debug: args.debug, testConfig: useTestConfig, verbose: args.testVerbose || args.testAllVerbose, stopAtFirstError: !args.testAllVerbose }).then((results) => {
1590
- if (results.length > 0 && args.vimdiff) {
1591
- for (const result of results) {
1592
- vimdiff(result.actual, result.expected)
1593
- }
1594
- }
1595
1605
  let newError = false
1596
1606
  if (results.length > 0) {
1597
1607
  let headerShown = false
@@ -1650,6 +1660,12 @@ const knowledgeModule = async ({
1650
1660
  headerShown = true
1651
1661
  }
1652
1662
  }
1663
+ } else {
1664
+ if (results.length > 0 && args.vimdiff) {
1665
+ for (const result of results) {
1666
+ vimdiff(result.actual, result.expected)
1667
+ }
1668
+ }
1653
1669
  }
1654
1670
  if (!headerShown) {
1655
1671
  if (!(useTestConfig.check && useTestConfig.check.length > 0)) {
package/package.json CHANGED
@@ -63,6 +63,6 @@
63
63
  "json-stable-stringify": "^1.0.1",
64
64
  "node-fetch": "^2.6.1"
65
65
  },
66
- "version": "7.5.8-beta.0",
66
+ "version": "7.5.8-beta.1",
67
67
  "license": "ISC"
68
68
  }
package/src/config.js CHANGED
@@ -79,7 +79,8 @@ const handleBridgeProps = (config, bridge) => {
79
79
  if (bridge.generatorp) {
80
80
  config.config.generators.unshift({
81
81
  where: bridge.generatorp.where || bridge.where || client.where(4),
82
- match: ({context}) => bridge.id == context.marker && context.paraphrase,
82
+ // match: ({context}) => bridge.id == context.marker && context.paraphrase,
83
+ match: ({context}) => bridge.id == context.marker && context.level == bridge.level + 1 && context.paraphrase,
83
84
  apply: (args) => bridge.generatorp(args),
84
85
  applyWrapped: bridge.generatorp,
85
86
  property: 'generatorp',
@@ -614,8 +615,9 @@ class Config {
614
615
  return instance
615
616
  }
616
617
  */
617
- getEvaluator (s, log, context) {
618
+ getEvaluator (s, calls, log, context) {
618
619
  const instance = s({ ...context, evaluate: true })
620
+ calls.touch(instance)
619
621
  if (!instance.evalue && !instance.verbatim && !instance.value) {
620
622
  this.warningNotEvaluated(log, context);
621
623
  }