trustgraph/templates/util/decode-config.jsonnet
cybermaggedon 53c958aaff
Fix: prompt template overrides (#136)
* Added single-target command-line config generator.  Mainly using for
testing ATM.

* Slightly tweak the config decode so that components can over-ride the
'with' method which injects parameters.

* Deliberately break the prompt-generic template.  Could do better, this
is temporary.

* Add 'prompt-overrides' component, injects new prompts.

* Removed prompt generic reference, not used

* prompt-generic is no longer supported
2024-11-05 21:17:34 +00:00

31 lines
662 B
Jsonnet

local components = import "components.jsonnet";
local apply = function(p, components)
local base = {
with:: function(k, v) self + {
[k]:: v
},
with_params:: function(pars)
self + std.foldl(
function(obj, par) obj.with(par.key, par.value),
std.objectKeysValues(pars),
self
),
};
local component = base + components[p.name];
component.with_params(p.parameters);
local decode = function(config)
local add = function(state, c) state + apply(c, components);
local patterns = std.foldl(add, config, {});
patterns;
decode