Exclude code from Explain Vulnerability prompt when there is too much
What does this MR do and why?
When generating an explanation for a vulnerability we sometimes include the snippet of vulnerable code to the AI API. In some cases this code is too large to fit within the maximum token limits offered by the AI API. In these situations, we would like to generate a prompt without the vulnerable code. This change removes the vulnerable code from the AI API request when it exceeds a specific character limit.
Screenshots or screen recordings
Before:
After:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by mo khan