aa0dbdcc7a
Move `exec_review`, `download_git_diff`, and review formatting to a new `bot_actions::review` module. Update the review flow to post inline review comments via the Gitea API and simplify the comment markdown to a summary. Add diff formatting that preprocesses added lines with line numbers for the LLM prompt.
45 lines
1.3 KiB
Rust
45 lines
1.3 KiB
Rust
pub const GITEA_SIG_HEADER_NAME: &str = "x-gitea-signature";
|
|
pub const GITEA_EVENT_TYPE_HEADER_NAME: &str = "x-gitea-event-type";
|
|
|
|
pub const MAX_WEBHOOK_BODY_SIZE: usize = 1024 * 1024; // 1 MiB
|
|
pub const MAX_DIFF_SIZE: usize = 1024 * 1024; // 1 MiB
|
|
|
|
pub const BOT_PROCESS_MSG: &str = "
|
|
Review in progress with the model \"{model}\"...
|
|
";
|
|
|
|
pub const REVIEW_PROMPT: &str = "
|
|
You are a senior software engineer reviewing code changes.
|
|
|
|
Check good practices and code quality.
|
|
|
|
This is the pull request subject: \"{subject}\"
|
|
|
|
This is the user comment: \"{comment}\"
|
|
|
|
The code changes (only added lines, with line numbers):
|
|
|
|
{diff}
|
|
|
|
Please review the code changes and provide feedback.
|
|
|
|
IMPORTANT: the `line` field must be the line number shown before each line.
|
|
The provided code has the format: `filename:line:code`
|
|
|
|
Return your feedback, in french, with only this json format, reviews must contain each review
|
|
All fields are mandatory.
|
|
(filename field must contain the full path with extension) and comment must contain a final summary:
|
|
|
|
{
|
|
\"reviews\": [
|
|
{
|
|
\"filename\": \"\",
|
|
\"line\": ,
|
|
\"code\": \"\",
|
|
\"message\": \"\"
|
|
}
|
|
],
|
|
\"comment\": \"\"
|
|
}
|
|
";
|