Use reqwest 0.12 with rustls-tls and add timeouts

Also improve review prompt with line calculation instructions, switch
feedback to French, and enable reasoning for OpenRouter.
This commit is contained in:
2026-06-03 20:51:21 +00:00
parent de81232201
commit cd5c5b9478
7 changed files with 46 additions and 446 deletions
+14 -8
View File
@@ -1,3 +1,5 @@
use std::time::Duration;
use serde::Deserialize;
use serde_json::{Value, json};
@@ -5,13 +7,18 @@ use crate::errors::AppError;
pub struct GiteaAPI {
base_url: String,
client: reqwest::Client,
token: String,
}
impl GiteaAPI {
pub fn new(base_url: &str, token: &str) -> Self {
pub fn new(base_url: &str, token: &str, timeout: u64) -> Self {
Self {
base_url: String::from(base_url),
client: reqwest::Client::builder()
.timeout(Duration::from_secs(timeout))
.build()
.unwrap(),
token: String::from(token),
}
}
@@ -27,8 +34,8 @@ impl GiteaAPI {
self.base_url, full_name, index, self.token
);
let client = reqwest::Client::new();
let res = client
let res = self
.client
.post(url)
.json(&json!({
"body": body
@@ -50,16 +57,15 @@ impl GiteaAPI {
self.base_url, full_name, comment_id, self.token
);
let client = reqwest::Client::new();
let res = client
self.client
.patch(url)
.json(&json!({
"body": body
}))
.send()
.await?;
Ok(())
.await
.map(|_| ())
.map_err(anyhow::Error::from)
}
}