summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-10-29 17:22:23 +0800
committerGitHub <noreply@github.com>2023-10-29 17:22:23 +0800
commit1ced15a2098f1469b2dd7d59636fdcdc710efc22 (patch)
tree159b76ea877291741903f97f873e28bcb259a8e3 /src/client
parent10b1d4b4de521a48747c73d29e9fe3f06db48a32 (diff)
downloadaichat-1ced15a2098f1469b2dd7d59636fdcdc710efc22.tar.gz
feat: autodetect light theme on unix-like os (#168)
Diffstat (limited to 'src/client')
-rw-r--r--src/client/mod.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs
index 37440f1..b2ceb84 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -11,7 +11,6 @@ use async_trait::async_trait;
use reqwest::{ClientBuilder, Proxy};
use serde::Deserialize;
use std::{env, time::Duration};
-use tokio::runtime::Runtime;
use tokio::time::sleep;
use crate::{
@@ -64,7 +63,7 @@ pub trait Client {
fn get_config(&self) -> &SharedConfig;
fn send_message(&self, content: &str) -> Result<String> {
- init_runtime()?.block_on(async {
+ init_tokio_runtime()?.block_on(async {
if self.get_config().read().dry_run {
return Ok(self.get_config().read().echo_messages(content));
}
@@ -88,7 +87,7 @@ pub trait Client {
}
}
let abort = handler.get_abort();
- init_runtime()?.block_on(async {
+ init_tokio_runtime()?.block_on(async {
tokio::select! {
ret = async {
if self.get_config().read().dry_run {
@@ -164,7 +163,7 @@ pub fn list_models(config: &Config) -> Vec<ModelInfo> {
.collect()
}
-pub fn init_runtime() -> Result<Runtime> {
+pub fn init_tokio_runtime() -> Result<tokio::runtime::Runtime> {
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()