From c5a2f4603c3c3eb7995f4e77453ab8ca50ff88b8 Mon Sep 17 00:00:00 2001 From: sigoden Date: Mon, 6 Mar 2023 07:08:51 +0800 Subject: chore: optimize code --- src/repl/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/repl/mod.rs') diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 6aeb233..30f09fe 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -1,6 +1,8 @@ mod handler; mod init; +use crate::client::ChatGptClient; +use crate::config::SharedConfig; use crate::term; use crate::utils::{copy, dump}; @@ -32,7 +34,8 @@ pub struct Repl { } impl Repl { - pub fn run(&mut self, handler: ReplCmdHandler) -> Result<()> { + pub fn run(&mut self, client: ChatGptClient, config: SharedConfig) -> Result<()> { + let handler = ReplCmdHandler::init(client, config)?; dump( format!("Welcome to aichat {}", env!("CARGO_PKG_VERSION")), 1, -- cgit v1.2.3