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
+9 -1
View File
@@ -1,3 +1,5 @@
use std::time::Duration;
use openrouter_rs::{Message, api::chat::ChatCompletionRequest};
pub struct OpenRouterClient {
@@ -6,10 +8,15 @@ pub struct OpenRouterClient {
}
impl OpenRouterClient {
pub fn new(token: &str, model: &str) -> anyhow::Result<Self> {
pub fn new(token: &str, model: &str, timeout: u64) -> anyhow::Result<Self> {
Ok(Self {
client: openrouter_rs::OpenRouterClient::builder()
.api_key(token)
.http_client(
reqwest::Client::builder()
.timeout(Duration::from_secs(timeout))
.build()?,
)
.build()?,
model: String::from(model),
})
@@ -18,6 +25,7 @@ impl OpenRouterClient {
pub async fn chat(&self, msg: &str) -> anyhow::Result<String> {
let request = ChatCompletionRequest::builder()
.model(&self.model)
.enable_reasoning()
.messages(vec![Message::new(
openrouter_rs::types::Role::Developer,
msg,