@@ -6,15 +6,15 @@ use std::path::Path;
6
6
use std:: process:: { Command , Stdio } ;
7
7
8
8
use crate :: gh:: issues:: ExistingGithubIssue ;
9
- use crate :: templates:: Updates ;
9
+ use crate :: templates:: { Updates , UpdatesGoal } ;
10
10
use crate :: {
11
11
gh:: {
12
12
issue_id:: { IssueId , Repository } ,
13
13
issues:: { list_issue_titles_in_milestone, ExistingGithubComment , ExistingIssueState } ,
14
14
} ,
15
15
json:: checkboxes,
16
16
llm:: LargeLanguageModel ,
17
- templates:: { self , UpdatesFlagshipGoal , UpdatesFlagshipGoalUpdate , UpdatesOtherGoal } ,
17
+ templates,
18
18
util:: comma,
19
19
} ;
20
20
@@ -114,8 +114,8 @@ async fn prepare_flagship_goals(
114
114
repository : & Repository ,
115
115
issues : & BTreeMap < String , ExistingGithubIssue > ,
116
116
filter : & Filter < ' _ > ,
117
- _llm : & LargeLanguageModel ,
118
- _quick : bool ,
117
+ llm : & LargeLanguageModel ,
118
+ quick : bool ,
119
119
updates : & mut Updates ,
120
120
) -> anyhow:: Result < ( ) > {
121
121
// First process the flagship goals, for which we capture the full text of comments.
@@ -133,7 +133,36 @@ async fn prepare_flagship_goals(
133
133
134
134
let progress = checkboxes ( & issue) ;
135
135
136
- updates. flagship_goals . push ( UpdatesFlagshipGoal {
136
+ let mut comments = issue. comments . clone ( ) ;
137
+ comments. sort_by_key ( |c| c. created_at . clone ( ) ) ;
138
+ comments. retain ( |c| filter. matches ( c) ) ;
139
+
140
+ let summary: String = if comments. len ( ) == 0 {
141
+ format ! ( "No updates in this period." )
142
+ } else if quick {
143
+ QUICK_UPDATES . iter ( ) . copied ( ) . collect ( )
144
+ } else {
145
+ let prompt = format ! (
146
+ "The following comments are updates to a project goal entitled '{title}'. \
147
+ The goal is assigned to {people} ({assignees}). \
148
+ Summarize the major developments, writing for general Rust users. \
149
+ Write the update in the third person and do not use pronouns when referring to people. \
150
+ Do not respond with anything but the summary paragraphs. \
151
+ ",
152
+ people = if issue. assignees. len( ) == 1 {
153
+ "1 person" . to_string( )
154
+ } else {
155
+ format!( "{} people" , issue. assignees. len( ) )
156
+ } ,
157
+ assignees = comma( & issue. assignees) ,
158
+ ) ;
159
+ let updates: String = comments. iter ( ) . map ( |c| format ! ( "\n {}\n " , c. body) ) . collect ( ) ;
160
+ llm. query ( & prompt, & updates)
161
+ . await
162
+ . with_context ( || format ! ( "making request to LLM failed" ) ) ?
163
+ } ;
164
+
165
+ updates. flagship_goals . push ( UpdatesGoal {
137
166
title : title. clone ( ) ,
138
167
issue_number : issue. number ,
139
168
issue_assignees : comma ( & issue. assignees ) ,
@@ -144,17 +173,7 @@ async fn prepare_flagship_goals(
144
173
. url ( ) ,
145
174
progress,
146
175
is_closed : issue. state == ExistingIssueState :: Closed ,
147
- updates : issue
148
- . comments
149
- . iter ( )
150
- . filter ( |c| filter. matches ( c) )
151
- . map ( |c| UpdatesFlagshipGoalUpdate {
152
- author : c. author . clone ( ) ,
153
- date : c. created_at_date ( ) . format ( "%m %d" ) . to_string ( ) ,
154
- update : c. body . clone ( ) ,
155
- url : c. url . clone ( ) ,
156
- } )
157
- . collect ( ) ,
176
+ updates_markdown : summary,
158
177
} ) ;
159
178
160
179
progress_bar:: inc_progress_bar ( ) ;
@@ -219,7 +238,7 @@ async fn prepare_other_goals(
219
238
llm. query ( & prompt, & updates) . await ?
220
239
} ;
221
240
222
- let goal = UpdatesOtherGoal {
241
+ let goal = UpdatesGoal {
223
242
title : title. clone ( ) ,
224
243
issue_number : issue. number ,
225
244
issue_assignees : comma ( & issue. assignees ) ,
0 commit comments