🛠️ chore: Abort AI Requests on Close & Remove Verbose Logs for Plugins (#1914)

* chore: remove verbose logging of ChatOpenAI

* feat: abort AI requests on request close
This commit is contained in:
Danny Avila 2024-02-27 10:21:06 -05:00 committed by GitHub
parent 08d4b3cc8a
commit 04eeb59d47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 98 additions and 57 deletions

View file

@ -90,6 +90,20 @@ const EditController = async (req, res, next, initializeClient) => {
const { abortController, onStart } = createAbortController(req, res, getAbortData);
res.on('close', () => {
logger.debug('[EditController] Request closed');
if (!abortController) {
return;
} else if (abortController.signal.aborted) {
return;
} else if (abortController.requestCompleted) {
return;
}
abortController.abort();
logger.debug('[EditController] Request aborted on close');
});
try {
const { client } = await initializeClient({ req, res, endpointOption });