generated from ztimson/template
Updated gitea comment retrieval
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
### AI Agents
|
||||
|
||||
<!-- Description -->
|
||||
Automated AI-powered agents for automated reviews and code assistance
|
||||
AI-powered Gitea agents for automating reviews and administration
|
||||
|
||||
<!-- Repo badges -->
|
||||
[](https://git.zakscode.com/ztimson/ai-agents/tags)
|
||||
@@ -37,7 +37,9 @@ Automated AI-powered agents for automated reviews and code assistance
|
||||
|
||||
## About
|
||||
|
||||
Automated code agents that uses AI to analyze git diffs and provide inline comments on pull requests. Supports Anthropic, OpenAI, and Ollama models with tool-based reviewing for precise feedback.
|
||||
Only supports Gitea
|
||||
|
||||
Use LLM models from Anthropic, OpenAI, or Ollama to automate ticket refinement, code reviews, and releases.
|
||||
|
||||
### Built With
|
||||
[](https://docker.com/)
|
||||
|
||||
@@ -35,19 +35,15 @@ dotenv.config({path: '.env.local', override: true, quiet: true, debug: false});
|
||||
return process.exit();
|
||||
}
|
||||
|
||||
let existingComments = '';
|
||||
let existingComments = 'Existing Comments:\n';
|
||||
if(git && pr) {
|
||||
const res = await fetch(`${git}/api/v1/repos/${owner}/${repo}/pulls/${pr}/reviews`, {
|
||||
const reviews = await fetch(`${git}/api/v1/repos/${owner}/${repo}/pulls/${pr}/reviews`, {
|
||||
headers: {'Authorization': `token ${auth}`}
|
||||
});
|
||||
if(res.ok) {
|
||||
const reviews = await res.json();
|
||||
const allComments = reviews.flatMap(r => r.comments || []);
|
||||
if(allComments.length) {
|
||||
existingComments = '\n\nExisting review comments (DO NOT repeat these):\n' +
|
||||
allComments.map(c => `- ${c.path}:${c.line || c.position}: ${c.body}`).join('\n');
|
||||
}
|
||||
}
|
||||
}).then(resp => resp.ok ? resp.json() : []);
|
||||
const comments = await Promise.all(reviews.map(r => fetch(`${git}/api/v1/repos/${owner}/${repo}/pulls/${pr}/reviews/${r.id}/comments`, {
|
||||
headers: {'Authorization': `token ${auth}`}
|
||||
}).then(resp => resp.ok ? resp.json() : [])));
|
||||
existingComments += comments.flatten().map(c => `${c.path}:${c.position}\n${c.body}`).join('\n\n');
|
||||
}
|
||||
|
||||
let options = {ollama: {model, host}};
|
||||
|
||||
Reference in New Issue
Block a user