diff options
| author | sigoden <sigoden@gmail.com> | 2024-06-17 17:03:28 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-17 17:03:28 +0800 |
| commit | 62b297e8bb09e257a61154afddc4017e48bd12f3 (patch) | |
| tree | b402281f625b304ad99ba392597f65d9fca0b21e /src/config/input.rs | |
| parent | ff284779d9757c128acaf690ddf64a87a986e413 (diff) | |
| download | aichat-62b297e8bb09e257a61154afddc4017e48bd12f3.tar.gz | |
feat: add `.regenerate` repl command (#610)
Diffstat (limited to 'src/config/input.rs')
| -rw-r--r-- | src/config/input.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/config/input.rs b/src/config/input.rs index 350f74c..4ddc06f 100644 --- a/src/config/input.rs +++ b/src/config/input.rs @@ -31,6 +31,7 @@ pub struct Input { text: String, patched_text: Option<String>, continue_output: Option<String>, + regenerate: bool, medias: Vec<String>, data_urls: HashMap<String, String>, tool_call: Option<ToolResults>, @@ -48,6 +49,7 @@ impl Input { text: text.to_string(), patched_text: None, continue_output: None, + regenerate: false, medias: Default::default(), data_urls: Default::default(), tool_call: None, @@ -106,6 +108,7 @@ impl Input { text: texts.join("\n"), patched_text: None, continue_output: None, + regenerate: false, medias, data_urls, tool_call: Default::default(), @@ -147,6 +150,18 @@ impl Input { self.continue_output = Some(output); } + pub fn regenerate(&self) -> bool { + self.regenerate + } + + pub fn set_regenerate(&mut self) { + let role = self.config.read().extract_role(); + if role.name() == self.role().name() { + self.role = role; + } + self.regenerate = true; + } + pub async fn use_embeddings(&mut self, abort_signal: AbortSignal) -> Result<()> { if self.text.is_empty() { return Ok(()); |
