mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-19 17:16:48 +00:00
21 lines
458 B
TypeScript
21 lines
458 B
TypeScript
import {Chunk, File} from "parse-diff";
|
|
|
|
export function createComment(
|
|
file: File,
|
|
chunk: Chunk,
|
|
aiResponses: Array<{
|
|
lineNumber: string;
|
|
reviewComment: string;
|
|
}>
|
|
): Array<{ body: string; path: string; line: number }> {
|
|
return aiResponses.flatMap((aiResponse) => {
|
|
if (!file.to) {
|
|
return [];
|
|
}
|
|
return {
|
|
body: aiResponse.reviewComment,
|
|
path: file.to,
|
|
line: Number(aiResponse.lineNumber),
|
|
};
|
|
});
|
|
}
|