summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-11-02 09:53:54 +0800
committerGitHub <noreply@github.com>2023-11-02 09:53:54 +0800
commit444f4ebe9de8aa68afdf8d39b734a8543b9b5c4b (patch)
treed8b0e16faa0270fda2a6c7afa5fe18c1970b9a93 /src/utils
parent5c7bfd92ff3e557477969be9db0638ef0d3d3659 (diff)
downloadaichat-444f4ebe9de8aa68afdf8d39b734a8543b9b5c4b.tar.gz
refactor: improve code quanity (#196)
- rewrite Repl, remove ReplHandler - move ReplyStreamHandler to repl/ and rename it to ReplyHandler - deprecate utils::print_now - refactor session info
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/mod.rs19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index ab922e3..938e07c 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -6,24 +6,9 @@ pub use self::prompt_input::*;
pub use self::split_line::*;
pub use self::tiktoken::cl100k_base_singleton;
-use chrono::prelude::*;
-use std::io::{stdout, Write};
-
-#[macro_export]
-macro_rules! print_now {
- ($($arg:tt)*) => {
- $crate::utils::print_now(&format!($($arg)*))
- };
-}
-
-pub fn print_now<T: ToString>(text: &T) {
- print!("{}", text.to_string());
- let _ = stdout().flush();
-}
-
pub fn now() -> String {
- let now = Local::now();
- now.to_rfc3339_opts(SecondsFormat::Secs, false)
+ let now = chrono::Local::now();
+ now.to_rfc3339_opts(chrono::SecondsFormat::Secs, false)
}
pub fn get_env_name(key: &str) -> String {