Skip to content

Commit ccfc63c

Browse files
authored
adding comments (#6410)
1 parent b4ec047 commit ccfc63c

4 files changed

Lines changed: 35 additions & 6 deletions

File tree

package.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,7 +3239,17 @@
32393239
"comments": {
32403240
"type": "array",
32413241
"items": {
3242-
"type": "string"
3242+
"type": "object",
3243+
"properties": {
3244+
"body": {
3245+
"type": "string",
3246+
"description": "The comment body"
3247+
},
3248+
"author": {
3249+
"type": "string",
3250+
"description": "The author of the comment"
3251+
}
3252+
}
32433253
},
32443254
"description": "The array of associated string comments"
32453255
},
@@ -3316,7 +3326,17 @@
33163326
"unreadComments": {
33173327
"type": "array",
33183328
"items": {
3319-
"type": "string"
3329+
"type": "object",
3330+
"properties": {
3331+
"body": {
3332+
"type": "string",
3333+
"description": "The comment body"
3334+
},
3335+
"author": {
3336+
"type": "string",
3337+
"description": "The author of the comment"
3338+
}
3339+
}
33203340
},
33213341
"description": "The array of unread comments under the issue/PR of the notification"
33223342
},

src/lm/tools/fetchNotificationTool.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface FetchNotificationResult {
2626
title: string;
2727
body: string;
2828
unreadComments: {
29+
author: string;
2930
body: string;
3031
}[];
3132
owner: string;
@@ -73,13 +74,13 @@ export class FetchNotificationTool extends RepoToolBase<FetchNotificationToolPar
7374
const itemType = issueOrPR instanceof PullRequestModel ? 'pr' : 'issue';
7475
const notificationKey = getNotificationKey(owner, name, String(issueOrPR.number));
7576
const comments = issueOrPR.item.comments ?? [];
76-
let unreadComments: { body: string; }[];
77+
let unreadComments: { body: string; author: string }[];
7778
if (lastReadAt !== undefined && comments) {
7879
unreadComments = comments.filter(comment => {
7980
return comment.createdAt > lastReadAt;
80-
}).map(comment => { return { body: comment.body }; });
81+
}).map(comment => { return { body: comment.body, author: comment.author.login }; });
8182
} else {
82-
unreadComments = comments.map(comment => { return { body: comment.body }; });
83+
unreadComments = comments.map(comment => { return { body: comment.body, author: comment.author.login }; });
8384
}
8485
const result: FetchNotificationResult = {
8586
lastReadAt,

src/lm/tools/summarizeIssueTool.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ If a comment references for example issue or PR #123, then output either of the
7979
[#123](https://github.com/${owner}/${repo}/issues/123)
8080
[#123](https://github.com/${owner}/${repo}/pull/123)
8181
82-
When you summarize comments, give a summary of each comment and mention the author clearly.
82+
When you summarize comments, always give a summary of each comment and always mention the author clearly before the comment. If the author is called 'joe' and the comment is 'this is a comment', then the output should be:
83+
84+
joe: this is a comment
85+
8386
Make sure the summary is at least as short or shorter than the issue or PR with the comments and the patches if there are.
8487
`;
8588
}

src/lm/tools/summarizeNotificationsTool.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The following are the unread comments of the thread:
5353
for (const [index, comment] of unreadComments.entries()) {
5454
notificationInfo += `
5555
Comment ${index} :
56+
Author: ${comment.author}
5657
Body: ${comment.body}
5758
`;
5859
}
@@ -98,6 +99,10 @@ If a comment references for example issue or PR #123, then output either of the
9899
[#123](https://github.com/${owner}/${repo}/issues/123)
99100
[#123](https://github.com/${owner}/${repo}/pull/123)
100101
102+
When you summarize comments, always give a summary of each comment and always mention the author clearly before the comment. If the author is called 'joe' and the comment is 'this is a comment', then the output should be:
103+
104+
joe: this is a comment
105+
101106
Always include in your output, which part of the thread is unread by prefixing that part with the markdown heading of level 1 with text "Unread Thread" or "Unread Comments".
102107
Make sure the summary is at least as short or shorter than the issue or PR with the comments and the patches if there are.
103108
Example output:

0 commit comments

Comments
 (0)