From 12a3686885a110d6640331d33bc8fbd91b8eede1 Mon Sep 17 00:00:00 2001 From: Andrew Cantino Date: Tue, 29 Sep 2020 12:04:17 -0700 Subject: [PATCH] Input modifier can still generate text when stopping --- README.md | 1 + examples/commandParser.js | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 02bd4a2..0bc7f43 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ you can return `stop: true` in order to stop processing——see [examples/comma ### 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). +When inside of a Context Modifier, you can return `stop: true` in order to stop processing. ### Output Modifier Called each time the model generates an output and has the opportunity to modify that output. diff --git a/examples/commandParser.js b/examples/commandParser.js index 6adfa3e..8c154fb 100644 --- a/examples/commandParser.js +++ b/examples/commandParser.js @@ -12,6 +12,7 @@ const modifier = (text) => { const args = commandMatcher[2] ? commandMatcher[2].trim().split(' ') : [] state.message = `Got command '${command}' with args ${JSON.stringify(args)}` stop = true + text = null } else { delete state.message }