mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
🛠️ fix: Custom Endpoint issues, Improve SSE Response Handling (#1510)
* fix(custom): prevent presets using removed custom endpoints from causing frontend errors * refactor(abortMiddleware): send 204 status when abortController is not found/active, set expected header `application/json` when not set * fix(useSSE): general improvements: - Add endpointType to fetch URL in useSSE hook - use EndpointURLs enum - handle 204 response by setting `data` to initiated response - add better error handling UX, make clear when there is an explicit error
This commit is contained in:
parent
84892b5b98
commit
bebfffb2d9
5 changed files with 62 additions and 14 deletions
|
|
@ -14,7 +14,7 @@ async function abortMessage(req, res) {
|
|||
}
|
||||
|
||||
if (!abortControllers.has(abortKey) && !res.headersSent) {
|
||||
return res.status(404).send({ message: 'Request not found' });
|
||||
return res.status(204).send({ message: 'Request not found' });
|
||||
}
|
||||
|
||||
const { abortController } = abortControllers.get(abortKey);
|
||||
|
|
@ -26,6 +26,8 @@ async function abortMessage(req, res) {
|
|||
return sendMessage(res, finalEvent);
|
||||
}
|
||||
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
|
||||
res.send(JSON.stringify(finalEvent));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue