Input modifier can still generate text when stopping

This commit is contained in:
Andrew Cantino 2020-09-29 12:04:17 -07:00
parent a32cefaf9b
commit 12a3686885
2 changed files with 2 additions and 0 deletions

View file

@ -34,6 +34,7 @@ you can return `stop: true` in order to stop processing——see [examples/comma
### Context Modifier ### Context Modifier
Called each time the AI model is about to receive input and has the opportunity to modify that input (by up to a 75% [edit distance](https://en.wikipedia.org/wiki/Levenshtein_distance) change). Called each time the AI model is about to receive input and has the opportunity to modify that input (by up to a 75% [edit distance](https://en.wikipedia.org/wiki/Levenshtein_distance) change).
When inside of a Context Modifier, you can return `stop: true` in order to stop processing.
### Output Modifier ### Output Modifier
Called each time the model generates an output and has the opportunity to modify that output. Called each time the model generates an output and has the opportunity to modify that output.

View file

@ -12,6 +12,7 @@ const modifier = (text) => {
const args = commandMatcher[2] ? commandMatcher[2].trim().split(' ') : [] const args = commandMatcher[2] ? commandMatcher[2].trim().split(' ') : []
state.message = `Got command '${command}' with args ${JSON.stringify(args)}` state.message = `Got command '${command}' with args ${JSON.stringify(args)}`
stop = true stop = true
text = null
} else { } else {
delete state.message delete state.message
} }