@@ -77,13 +77,15 @@ export function initCodeReview(
7777 selectedText : editor . document . getText ( range ) ,
7878 }
7979 const prompt = supportPrompt . create ( "ADD_TO_CONTEXT" , params )
80- reviewInstance . createReviewTask ( prompt , [
81- {
82- type : ReviewTargetType . CODE ,
83- file_path : filePath ,
84- line_range : [ range . start . line , range . end . line ] ,
85- } ,
86- ] )
80+ reviewInstance . createReviewTask ( prompt , {
81+ type : ReviewTargetType . CODE ,
82+ data : [
83+ {
84+ file_path : filePath ,
85+ line_range : [ range . start . line , range . end . line ] ,
86+ } ,
87+ ] ,
88+ } )
8789 } ,
8890 reviewFilesAndFolders : async ( _ : vscode . Uri , selectedUris : vscode . Uri [ ] ) => {
8991 const visibleProvider = await ClineProvider . getInstance ( )
@@ -95,32 +97,12 @@ export function initCodeReview(
9597 return
9698 }
9799 const cwd = visibleProvider . cwd . toPosix ( )
98- const targets : ReviewTarget [ ] = await Promise . all (
99- selectedUris . map ( async ( uri ) => {
100- const stat = await vscode . workspace . fs . stat ( uri )
101- return {
102- type : stat . type === vscode . FileType . Directory ? ReviewTargetType . FOLDER : ReviewTargetType . FILE ,
103- file_path : toRelativePath ( uri . fsPath . toPosix ( ) , cwd ) ,
104- }
105- } ) ,
106- )
107- reviewInstance . startReview ( targets )
108- } ,
109- reviewRepo : async ( ) => {
110- const visibleProvider = await ClineProvider . getInstance ( )
111- if ( ! visibleProvider ) {
112- return
113- }
114- reviewInstance . setProvider ( visibleProvider )
115- if ( ! ( await reviewInstance . checkApiProviderSupport ( ) ) ) {
116- return
117- }
118- reviewInstance . startReview ( [
119- {
120- type : ReviewTargetType . FOLDER ,
121- file_path : "" ,
122- } ,
123- ] )
100+ reviewInstance . startReview ( {
101+ type : ReviewTargetType . FILE ,
102+ data : selectedUris . map ( ( uri ) => ( {
103+ file_path : toRelativePath ( uri . fsPath . toPosix ( ) , cwd ) ,
104+ } ) ) ,
105+ } )
124106 } ,
125107 acceptIssue : async ( thread : vscode . CommentThread ) => {
126108 const visibleProvider = await ClineProvider . getInstance ( )
@@ -177,14 +159,13 @@ export function initCodeReview(
177159
178160 visibleProvider . log ( `[CodeReview] Found ${ changedFiles . length } changed files` )
179161
180- // 将变更文件作为 targets 传入,使用相对路径
181- const targets : ReviewTarget [ ] = changedFiles . map ( ( file_path ) => ( {
182- type : ReviewTargetType . FILE ,
183- file_path,
184- } ) )
185-
186162 // 使用 @git-changes 来审查当前的 git 变更
187- reviewInstance . createReviewTask ( "@git-changes" , targets )
163+ reviewInstance . createReviewTask ( "@git-changes" , {
164+ type : ReviewTargetType . FILE ,
165+ data : changedFiles . map ( ( file_path ) => ( {
166+ file_path,
167+ } ) ) ,
168+ } )
188169 } ,
189170 ...( ! isJetbrains
190171 ? { }
@@ -219,13 +200,15 @@ export function initCodeReview(
219200 selectedText : selectedText ,
220201 }
221202 const prompt = supportPrompt . create ( "ADD_TO_CONTEXT" , params )
222- reviewInstance . createReviewTask ( prompt , [
223- {
224- type : ReviewTargetType . CODE ,
225- file_path : toRelativePath ( filePath . toPosix ( ) , cwd ) ,
226- line_range : [ startLine , endLine ] ,
227- } ,
228- ] )
203+ reviewInstance . createReviewTask ( prompt , {
204+ type : ReviewTargetType . CODE ,
205+ data : [
206+ {
207+ file_path : toRelativePath ( filePath . toPosix ( ) , cwd ) ,
208+ line_range : [ startLine , endLine ] ,
209+ } ,
210+ ] ,
211+ } )
229212 } ,
230213 reviewFilesAndFoldersJetbrains : async ( args : any ) => {
231214 const visibleProvider = await ClineProvider . getInstance ( )
@@ -244,15 +227,12 @@ export function initCodeReview(
244227 }
245228 const cwd = visibleProvider . cwd . toPosix ( )
246229 const { filePaths } = data
247- const targets : ReviewTarget [ ] = await Promise . all (
248- filePaths . map ( async ( filePath : string ) => {
249- return {
250- type : ReviewTargetType . FILE ,
251- file_path : toRelativePath ( filePath . toPosix ( ) , cwd ) ,
252- }
253- } ) ,
254- )
255- reviewInstance . startReview ( targets )
230+ reviewInstance . startReview ( {
231+ type : ReviewTargetType . FILE ,
232+ data : filePaths . map ( ( filePath : string ) => ( {
233+ file_path : toRelativePath ( filePath . toPosix ( ) , cwd ) ,
234+ } ) ) ,
235+ } )
256236 } ,
257237 acceptIssueJetbrains : async ( args : any ) => {
258238 const visibleProvider = await ClineProvider . getInstance ( )
0 commit comments