mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
fix(abortMiddleware): handle early abort error where userMessage.conversationId is undefined. In this case, the userId will be used as the abortKey
This commit is contained in:
parent
c74c68a135
commit
3c7f67fa76
1 changed files with 3 additions and 2 deletions
|
|
@ -30,10 +30,11 @@ const createAbortController = (res, req, endpointOption, getAbortData) => {
|
||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
const onStart = (userMessage) => {
|
const onStart = (userMessage) => {
|
||||||
sendMessage(res, { message: userMessage, created: true });
|
sendMessage(res, { message: userMessage, created: true });
|
||||||
abortControllers.set(userMessage.conversationId, { abortController, ...endpointOption });
|
const abortKey = userMessage?.conversationId ?? req.user.id;
|
||||||
|
abortControllers.set(abortKey, { abortController, ...endpointOption });
|
||||||
|
|
||||||
res.on('finish', function () {
|
res.on('finish', function () {
|
||||||
abortControllers.delete(userMessage.conversationId);
|
abortControllers.delete(abortKey);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue