summaryrefslogtreecommitdiffstats
path: root/src/repl/handler.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-10-26 16:42:54 +0800
committerGitHub <noreply@github.com>2023-10-26 16:42:54 +0800
commit7d8564cafb45afc4bccb666a310615b164800a9a (patch)
treeb431854e0f8f54fc7599da9965ad3be2edb386b1 /src/repl/handler.rs
parentf4160ff85b61e41a599e85f82d266878d35de47d (diff)
downloadaichat-7d8564cafb45afc4bccb666a310615b164800a9a.tar.gz
feat: support multi bots and custom url (#150)
Diffstat (limited to 'src/repl/handler.rs')
-rw-r--r--src/repl/handler.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/repl/handler.rs b/src/repl/handler.rs
index 2057b8b..53cdd98 100644
--- a/src/repl/handler.rs
+++ b/src/repl/handler.rs
@@ -1,4 +1,4 @@
-use crate::client::ChatGptClient;
+use crate::client::Client;
use crate::config::SharedConfig;
use crate::print_now;
use crate::render::render_stream;
@@ -26,7 +26,7 @@ pub enum ReplCmd {
#[allow(clippy::module_name_repetitions)]
pub struct ReplCmdHandler {
- client: ChatGptClient,
+ client: Box<dyn Client>,
config: SharedConfig,
reply: RefCell<String>,
abort: SharedAbortSignal,
@@ -35,7 +35,7 @@ pub struct ReplCmdHandler {
impl ReplCmdHandler {
#[allow(clippy::unnecessary_wraps)]
pub fn init(
- client: ChatGptClient,
+ client: Box<dyn Client>,
config: SharedConfig,
abort: SharedAbortSignal,
) -> Result<Self> {
@@ -59,7 +59,7 @@ impl ReplCmdHandler {
let wg = WaitGroup::new();
let ret = render_stream(
&input,
- &self.client,
+ self.client.as_ref(),
&self.config,
true,
self.abort.clone(),