Integrate OpenRouter for AI-powered code review

Add openrouter-rs dependency, review prompt, and markdown formatting.
Update comment API to accept dynamic body. Adjust devcontainer for
podman compatibility.
This commit is contained in:
2026-06-03 19:38:00 +00:00
parent 4966d08d18
commit de81232201
9 changed files with 541 additions and 50 deletions
+15 -8
View File
@@ -16,7 +16,12 @@ impl GiteaAPI {
}
}
pub async fn comment(&self, full_name: &str, index: u64) -> anyhow::Result<Comment> {
pub async fn comment(
&self,
body: &str,
full_name: &str,
index: u64,
) -> anyhow::Result<Comment> {
let url = format!(
"{}/api/v1/repos/{}/issues/{}/comments?access_token={}",
self.base_url, full_name, index, self.token
@@ -26,17 +31,20 @@ impl GiteaAPI {
let res = client
.post(url)
.json(&json!({
"body": "Hello world :)"
"body": body
}))
.send()
.await?;
println!("{}", res.status());
res.json::<Comment>().await.map_err(anyhow::Error::from)
}
pub async fn edit_comment(&self, full_name: &str, comment_id: u64) -> anyhow::Result<()> {
pub async fn edit_comment(
&self,
body: &str,
full_name: &str,
comment_id: u64,
) -> anyhow::Result<()> {
let url = format!(
"{}/api/v1/repos/{}/issues/comments/{}?access_token={}",
self.base_url, full_name, comment_id, self.token
@@ -46,13 +54,11 @@ impl GiteaAPI {
let res = client
.patch(url)
.json(&json!({
"body": "Updated Hello world :)"
"body": body
}))
.send()
.await?;
println!("{}", res.status());
Ok(())
}
}
@@ -75,6 +81,7 @@ pub struct PullRequest {
pub id: u64,
pub diff_url: String,
pub number: u64,
pub title: String,
}
#[derive(Deserialize, Debug)]