diff options
| author | sigoden <sigoden@gmail.com> | 2023-11-02 10:45:11 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-02 10:45:11 +0800 |
| commit | 7c6841782d36faacc2aa3616dc3ed1b9403fa26e (patch) | |
| tree | 12d51728e056dbd4e57fc5977b7c51b2b60c06ae /src/repl/mod.rs | |
| parent | 444f4ebe9de8aa68afdf8d39b734a8543b9b5c4b (diff) | |
| download | aichat-7c6841782d36faacc2aa3616dc3ed1b9403fa26e.tar.gz | |
refactor: improve code quanity (#197)
- move model_info.rs/message.rs to clients/
- rename SharedConfig to GlobalConfig
Diffstat (limited to 'src/repl/mod.rs')
| -rw-r--r-- | src/repl/mod.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs index c9c3c73..c19058b 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -1,17 +1,15 @@ -mod abort; mod highlighter; mod prompt; mod validator; -pub use self::abort::{create_abort_signal, AbortSignal}; - use self::highlighter::ReplHighlighter; use self::prompt::ReplPrompt; use self::validator::ReplValidator; use crate::client::init_client; -use crate::config::SharedConfig; +use crate::config::GlobalConfig; use crate::render::{render_error, render_stream}; +use crate::utils::{create_abort_signal, AbortSignal}; use anyhow::{bail, Context, Result}; use arboard::Clipboard; @@ -52,7 +50,7 @@ lazy_static! { } pub struct Repl { - config: SharedConfig, + config: GlobalConfig, editor: Reedline, prompt: ReplPrompt, abort: AbortSignal, @@ -60,7 +58,7 @@ pub struct Repl { } impl Repl { - pub fn init(config: SharedConfig) -> Result<Self> { + pub fn init(config: GlobalConfig) -> Result<Self> { let commands: Vec<String> = REPL_COMMANDS .into_iter() .map(|(v, _)| v.to_string()) @@ -283,7 +281,7 @@ Type ".help" for more information. ) } - fn create_completer(config: &SharedConfig, commands: &[String]) -> DefaultCompleter { + fn create_completer(config: &GlobalConfig, commands: &[String]) -> DefaultCompleter { let mut completion = commands.to_vec(); completion.extend(config.read().repl_completions()); let mut completer = |
