summaryrefslogtreecommitdiffstats
path: root/src/repl
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-29 13:20:00 +0800
committerGitHub <noreply@github.com>2024-06-29 13:20:00 +0800
commitd193950d204ed82bdb3d6a3a111511d189f084bb (patch)
tree5331dd37911dd991fc4c6060c7e5427bf4f850fa /src/repl
parent9416cbd8b81c0029572db854257cfc25991a12cd (diff)
downloadaichat-d193950d204ed82bdb3d6a3a111511d189f084bb.tar.gz
refactor: the name of temp file (#670)
Diffstat (limited to 'src/repl')
-rw-r--r--src/repl/mod.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 360af70..6c15002 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -10,7 +10,7 @@ use crate::client::chat_completion_streaming;
use crate::config::{AssertState, Config, GlobalConfig, Input, StateFlags};
use crate::function::need_send_tool_results;
use crate::render::render_error;
-use crate::utils::{create_abort_signal, set_text, AbortSignal};
+use crate::utils::{create_abort_signal, set_text, temp_file, AbortSignal};
use anyhow::{bail, Context, Result};
use async_recursion::async_recursion;
@@ -415,8 +415,7 @@ Type ".help" for additional help.
.with_ansi_colors(true);
if let Some(cmd) = config.read().buffer_editor() {
- let temp_file =
- env::temp_dir().join(format!("aichat-{}.txt", chrono::Utc::now().timestamp()));
+ let temp_file = temp_file("-repl-", ".txt");
let command = process::Command::new(cmd);
editor = editor.with_buffer_editor(command, temp_file);
}