theprogrammablemind_4wp
Advanced tools
Comparing version 7.4.1-beta.2 to 7.4.1-beta.3
@@ -473,10 +473,19 @@ const { Semantics, Semantic } = require('./src/semantics') | ||
const setupProcessB = ({ config }) => { | ||
const setupProcessB = ({ config, allowDelta=false } = {}) => { | ||
const key = config._key | ||
const data = Object.assign({ key, version: '3' }, config.config, { uuid: config._uuid }) | ||
for (const uuid of Object.keys(data.namespaces)) { | ||
const km = config.configs.find((km) => km.uuid === uuid) | ||
data.namespaces[uuid].name = km.name | ||
const data = Object.assign({ key, version: '3' }, { uuid: config._uuid }) | ||
if (allowDelta && config.allowDelta && config.hasDelta()) { | ||
// console.log('config', config) | ||
data.delta = config.delta() | ||
} else { | ||
Object.assign(data, config.config) | ||
} | ||
if (data.namespaces) { | ||
for (const uuid of Object.keys(data.namespaces)) { | ||
const km = config.configs.find((km) => km.uuid === uuid) | ||
data.namespaces[uuid].name = km.name | ||
} | ||
} | ||
@@ -533,3 +542,3 @@ // const generators = new Generators((data.generators || []).map((g) => new Generator(normalizeGenerator(g)))) | ||
const { data, /* generators, semantics, */ hierarchy } = setupProcessB({ config }) | ||
let { data, /* generators, semantics, */ hierarchy } = setupProcessB({ config, allowDelta: true }) | ||
let queries = query.split('\\n') | ||
@@ -558,4 +567,24 @@ | ||
} | ||
data.utterance = queries[0] | ||
const json = await doWithRetries(retries, url, queryParams, data) | ||
let json = await doWithRetries(retries, url, queryParams, data) | ||
let resetData = false | ||
if (json.code == 'NOT_IN_CACHE') { | ||
resetData = true | ||
const setupB = setupProcessB({ config, allowDelta: false }) | ||
data = setupB.data | ||
hierarchy = setupB.hierarchy | ||
data.utterance = queries[0] | ||
json = await doWithRetries(retries, url, queryParams, data) | ||
} | ||
if (json.cacheKey) { | ||
config.cacheKey = json.cacheKey | ||
if (resetData) { | ||
if (queries.length > 1) { | ||
const setupB = setupProcessB({ config, allowDelta: true }) | ||
data = setupB.data | ||
hierarchy = setupB.hierarchy | ||
} | ||
} | ||
} | ||
json.contexts = json.results | ||
@@ -1335,3 +1364,3 @@ delete json.results | ||
if (args.print.includes('c')) { | ||
const { data } = setupProcessB({ config }) | ||
const { data } = setupProcessB({ config }) | ||
console.log("Config as sent to server") | ||
@@ -1495,3 +1524,15 @@ console.log(JSON.stringify(data, null, 2)); | ||
} | ||
promise.then(() => f()).catch( (e) => f() ) | ||
promise | ||
.then(() => { | ||
f() | ||
}) | ||
.catch( (e) => { | ||
if (e.errno == 'ECONNREFUSED') { | ||
console.log(e) | ||
readline.close() | ||
} else { | ||
console.log(e) | ||
f() | ||
} | ||
}) | ||
}) | ||
@@ -1498,0 +1539,0 @@ f() |
@@ -64,4 +64,4 @@ { | ||
}, | ||
"version": "7.4.1-beta.2", | ||
"version": "7.4.1-beta.3", | ||
"license": "ISC" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162131
4806