theprogrammablemind_4wp 9.6.1-beta.2 → 9.6.1-beta.4
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 +12 -5
- package/package.json +1 -1
- package/src/configHelpers.js +12 -8
package/client.js
CHANGED
|
@@ -12,7 +12,7 @@ const _ = require('lodash')
|
|
|
12
12
|
const stringify = require('json-stable-stringify')
|
|
13
13
|
const Lines = require('./lines')
|
|
14
14
|
const flattens = require('./src/flatten')
|
|
15
|
-
const { sortJson, appendNoDups, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries, validProps } = require('./src/helpers')
|
|
15
|
+
const { sortJson, appendNoDups, InitCalls, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries, validProps } = require('./src/helpers')
|
|
16
16
|
const runtime = require('./runtime')
|
|
17
17
|
const db = require('./src/debug')
|
|
18
18
|
|
|
@@ -319,6 +319,13 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
|
319
319
|
|
|
320
320
|
let startCounter = 0
|
|
321
321
|
let contextIdCounter = 0
|
|
322
|
+
let calls
|
|
323
|
+
if (global.theprogrammablemind && global.theprogrammablemind.loadForTesting) {
|
|
324
|
+
calls = new InitCalls(Object.keys(global.theprogrammablemind.loadForTesting)[0])
|
|
325
|
+
} else {
|
|
326
|
+
calls = new InitCalls(config.getName())
|
|
327
|
+
}
|
|
328
|
+
|
|
322
329
|
while (true) {
|
|
323
330
|
if (queries.length === 0) {
|
|
324
331
|
break
|
|
@@ -330,7 +337,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
|
330
337
|
let resetData = false
|
|
331
338
|
if (json.code === 'NOT_IN_CACHE') {
|
|
332
339
|
resetData = true
|
|
333
|
-
const setupB = setupProcessB({ config, allowDelta: false })
|
|
340
|
+
const setupB = setupProcessB({ config, calls, allowDelta: false })
|
|
334
341
|
data = setupB.data
|
|
335
342
|
hierarchy = setupB.hierarchy
|
|
336
343
|
data.utterance = queries[0]
|
|
@@ -360,7 +367,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
|
360
367
|
const summary = { summaries: json.summaries, length: json.contexts.length }
|
|
361
368
|
summaries.push(summary)
|
|
362
369
|
const { updatedContextIdCounter, contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime } =
|
|
363
|
-
await processContextsB({ contextIdCounter, isTest, isProcess, isModule, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
|
|
370
|
+
await processContextsB({ contextIdCounter, calls, isTest, isProcess, isModule, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
|
|
364
371
|
contextIdCounter = updatedContextIdCounter
|
|
365
372
|
if (isTest) {
|
|
366
373
|
const end = runtime.performance.performance.now()
|
|
@@ -657,11 +664,11 @@ const saveTestsHelper = async (testFile, config, tests, todo, testConfig, saveDe
|
|
|
657
664
|
return
|
|
658
665
|
}
|
|
659
666
|
const test = todo.pop()
|
|
660
|
-
await config.rebuild()
|
|
667
|
+
// await config.rebuild()
|
|
661
668
|
const result = await saveTest(testFile, config, test, tests[test], testConfig, saveDeveloper)
|
|
662
669
|
// initialize in between test so state is not preserved since the test was adding without state
|
|
663
670
|
// config.initialize({force: true})
|
|
664
|
-
await config.rebuild()
|
|
671
|
+
// await config.rebuild()
|
|
665
672
|
return saveTestsHelper(testFile, config, tests, todo, testConfig, saveDeveloper)
|
|
666
673
|
}
|
|
667
674
|
|
package/package.json
CHANGED
package/src/configHelpers.js
CHANGED
|
@@ -100,11 +100,11 @@ class ContextHierarchy {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
under(markers) {
|
|
103
|
-
if (!markers) {
|
|
103
|
+
if (!markers || markers.length == 0) {
|
|
104
104
|
return this.contexts.length == 0
|
|
105
105
|
}
|
|
106
106
|
if (!Array.isArray(markers)) {
|
|
107
|
-
markers = [
|
|
107
|
+
markers = [markers]
|
|
108
108
|
}
|
|
109
109
|
for (const marker of markers) {
|
|
110
110
|
for (let i = this.contexts.length - 1; i >= 0; --i) {
|
|
@@ -131,9 +131,12 @@ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
|
|
|
131
131
|
hierarchy = config.getHierarchy()
|
|
132
132
|
}
|
|
133
133
|
// callId
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
args.calls = new InitCalls(
|
|
134
|
+
// debug.counter('InitCalls', { breakAt: 641 })
|
|
135
|
+
if (!args.calls) {
|
|
136
|
+
args.calls = new InitCalls(args.isInstance ? `${args.isInstance}#${config.getName()}` : config.getName())
|
|
137
|
+
if (global.theprogrammablemind && global.theprogrammablemind.loadForTesting) {
|
|
138
|
+
args.calls = new InitCalls(Object.keys(global.theprogrammablemind.loadForTesting)[0])
|
|
139
|
+
}
|
|
137
140
|
}
|
|
138
141
|
args.contextHierarchy = new ContextHierarchy()
|
|
139
142
|
args.cleanAssign = cleanAssign
|
|
@@ -364,7 +367,7 @@ const setupContexts = (rawContexts) => {
|
|
|
364
367
|
return contexts
|
|
365
368
|
}
|
|
366
369
|
|
|
367
|
-
const processContextsB = async ({ config, hierarchy, semantics, generators, json, isTest, isProcess, isModule, rebuildingTemplate, isInstance, instance, query, data, retries, url, commandLineArgs, forTemplate, contextIdCounter }) => {
|
|
370
|
+
const processContextsB = async ({ config, calls, hierarchy, semantics, generators, json, isTest, isProcess, isModule, rebuildingTemplate, isInstance, instance, query, data, retries, url, commandLineArgs, forTemplate, contextIdCounter }) => {
|
|
368
371
|
// TODO fix this name to contextsPrime
|
|
369
372
|
const contextsPrime = []
|
|
370
373
|
const generatedPrime = []
|
|
@@ -375,7 +378,7 @@ const processContextsB = async ({ config, hierarchy, semantics, generators, json
|
|
|
375
378
|
const contexts = setupContexts(json.contexts)
|
|
376
379
|
|
|
377
380
|
const objects = config.get('objects')
|
|
378
|
-
const args = { objects, isResponse: true, response: json, isTest, isInstance, getObjects: getObjects(objects), instance, contexts, isProcess, isModule }
|
|
381
|
+
const args = { objects, isResponse: true, response: json, isTest, isInstance, getObjects: getObjects(objects), instance, contexts, isProcess, isModule, calls }
|
|
379
382
|
if (!json.logs) {
|
|
380
383
|
json.logs = []
|
|
381
384
|
}
|
|
@@ -586,5 +589,6 @@ module.exports = {
|
|
|
586
589
|
gs,
|
|
587
590
|
processContextsB,
|
|
588
591
|
loadInstance,
|
|
589
|
-
isA
|
|
592
|
+
isA,
|
|
593
|
+
ContextHierarchy,
|
|
590
594
|
}
|