mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-09 03:18:18 +00:00
refac
This commit is contained in:
parent
facb194a07
commit
e10a00132e
1 changed files with 16 additions and 7 deletions
|
|
@ -1391,19 +1391,28 @@
|
|||
}
|
||||
};
|
||||
|
||||
let processingQueueChats = new Set<string>();
|
||||
|
||||
const processNextInQueue = async (targetChatId: string) => {
|
||||
if (processingQueueChats.has(targetChatId)) return;
|
||||
|
||||
const queue = $chatRequestQueues[targetChatId];
|
||||
if (!queue || queue.length === 0) return;
|
||||
|
||||
const combinedPrompt = queue.map((m) => m.prompt).join('\n\n');
|
||||
const combinedFiles = queue.flatMap((m) => m.files);
|
||||
processingQueueChats.add(targetChatId);
|
||||
try {
|
||||
const combinedPrompt = queue.map((m) => m.prompt).join('\n\n');
|
||||
const combinedFiles = queue.flatMap((m) => m.files);
|
||||
|
||||
chatRequestQueues.update((q) => {
|
||||
const { [targetChatId]: _, ...rest } = q;
|
||||
return rest;
|
||||
});
|
||||
chatRequestQueues.update((q) => {
|
||||
const { [targetChatId]: _, ...rest } = q;
|
||||
return rest;
|
||||
});
|
||||
|
||||
await submitPrompt(combinedPrompt, combinedFiles);
|
||||
await submitPrompt(combinedPrompt, combinedFiles);
|
||||
} finally {
|
||||
processingQueueChats.delete(targetChatId);
|
||||
}
|
||||
};
|
||||
|
||||
const chatCompletedHandler = async (_chatId, modelId, responseMessageId, messages) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue