agent: implement issue #3 - Enhancement: 检查现有的代码框架,确认是否需要优化

This commit is contained in:
2026-05-06 16:13:24 +08:00
parent ee7300e31f
commit 19de4634bc
4 changed files with 90 additions and 18 deletions

View File

@@ -85,25 +85,34 @@ class GiteaClient:
return repositories
def list_open_issues(self, owner: str, name: str) -> list[GiteaIssue]:
response = self.client.get(
f"/repos/{owner}/{name}/issues",
params={"state": "open", "type": "issues", "limit": 50},
)
response.raise_for_status()
issues: list[GiteaIssue] = []
for item in response.json():
if item.get("pull_request"):
continue
issues.append(
GiteaIssue(
number=int(item["number"]),
title=item.get("title") or "",
body=item.get("body") or "",
labels=labels_from_gitea(item.get("labels")),
state=item.get("state") or "open",
html_url=item.get("html_url") or item.get("url") or "",
)
page = 1
limit = 50
while True:
response = self.client.get(
f"/repos/{owner}/{name}/issues",
params={"state": "open", "type": "issues", "page": page, "limit": limit},
)
response.raise_for_status()
payload = response.json()
if not payload:
break
for item in payload:
if item.get("pull_request"):
continue
issues.append(
GiteaIssue(
number=int(item["number"]),
title=item.get("title") or "",
body=item.get("body") or "",
labels=labels_from_gitea(item.get("labels")),
state=item.get("state") or "open",
html_url=item.get("html_url") or item.get("url") or "",
)
)
if len(payload) < limit:
break
page += 1
return issues
def create_pull_request(