diff options
| author | sigoden <sigoden@gmail.com> | 2023-11-02 09:53:54 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-02 09:53:54 +0800 |
| commit | 444f4ebe9de8aa68afdf8d39b734a8543b9b5c4b (patch) | |
| tree | d8b0e16faa0270fda2a6c7afa5fe18c1970b9a93 /src/utils/mod.rs | |
| parent | 5c7bfd92ff3e557477969be9db0638ef0d3d3659 (diff) | |
| download | aichat-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/mod.rs')
| -rw-r--r-- | src/utils/mod.rs | 19 |
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 { |
