summaryrefslogtreecommitdiffstats
path: root/src/utils/request.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2025-01-22 20:51:10 +0800
committerGitHub <noreply@github.com>2025-01-22 20:51:10 +0800
commite0417e8d5bebe25476aaafa22a9ee23d9bd61457 (patch)
tree8edcd3aa9bcd1b012a3a429ad6240e6186caef36 /src/utils/request.rs
parentdf4440a2a049d26c61a540d3254cd885345fbd6c (diff)
downloadaichat-e0417e8d5bebe25476aaafa22a9ee23d9bd61457.tar.gz
feat: add `--sync-models` cli option (#1114)
Diffstat (limited to 'src/utils/request.rs')
-rw-r--r--src/utils/request.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/utils/request.rs b/src/utils/request.rs
index 9f2804b..a479e0e 100644
--- a/src/utils/request.rs
+++ b/src/utils/request.rs
@@ -50,7 +50,17 @@ lazy_static::lazy_static! {
static ref GITHUB_REPO_RE: Regex = Regex::new(r"^https://github\.com/([^/]+)/([^/]+)/tree/([^/]+)").unwrap();
}
-pub async fn fetch(
+pub async fn fetch(url: &str) -> Result<String> {
+ let client = match *CLIENT {
+ Ok(ref client) => client,
+ Err(ref err) => bail!("{err}"),
+ };
+ let res = client.get(url).send().await?;
+ let output = res.text().await?;
+ Ok(output)
+}
+
+pub async fn fetch_with_loaders(
loaders: &HashMap<String, String>,
path: &str,
allow_media: bool,