Explain This Vulnerability: Handle Null Prompt situations
ETV: include_source_code param for ai action (!124442 - merged) • Gregory Havenga • 16.2 implements the ability for the frontend to provide a source code directive to the backend when requesting a vulnerability explanation. While the frontend will be able to determine ahead of time that there is not a prompt with source code available and avoid making a request for an explanation including code, this does not remove the possibility of the request being made.
If such a request were made, the prompt would be null, and send a useless request to the AI accordingly. While not a huge issue, this is wasteful, so catching this ahead of time would save us on the redundant CPU usage.
Implementation Plan
-
backend In the ExplainThisVulnerabilityCompletion class, catch null prompt situations and exit early without sending a request to the AI API, sending an appropriate error message to the consumer.