File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ inputs:
3636 description : ' Only report security issues: true | false'
3737 required : false
3838 default : ' false'
39+ max_diff_chars :
40+ description : ' Max diff size in characters sent to the LLM (default: 20000)'
41+ required : false
42+ default : ' 20000'
3943 github_token :
4044 description : ' GitHub token for posting comments (defaults to GITHUB_TOKEN)'
4145 required : false
5458 POST_INLINE : ${{ inputs.post_inline }}
5559 SECURITY_ONLY : ${{ inputs.security_only }}
5660 GITHUB_TOKEN : ${{ inputs.github_token }}
61+ MAX_DIFF_CHARS : ${{ inputs.max_diff_chars }}
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ class Config(BaseSettings):
4646 post_summary : bool = True
4747 post_inline : bool = True
4848 security_only : bool = False
49+ max_diff_chars : int = 20000
4950
5051 @property
5152 def resolved_model (self ) -> str :
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ async def run() -> None:
2626 print ("[ai-reviewer] No diff found (all files ignored or empty PR). Skipping." )
2727 return
2828
29+ if len (diff ) > config .max_diff_chars :
30+ diff = diff [: config .max_diff_chars ]
31+ print (f"[ai-reviewer] Diff truncated to { config .max_diff_chars } chars to save tokens" )
32+
2933 print (f"[ai-reviewer] Diff size: { len (diff )} chars" )
3034
3135 # 2. Run LLM review
You can’t perform that action at this time.
0 commit comments