streaming, markdown, model selecting, and lots more
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
const pendingGenerations: Record<string, AbortController> = {};
|
||||
|
||||
export const cancelPendingGeneration = (generationId: string): boolean => {
|
||||
const controller = pendingGenerations[generationId];
|
||||
if (controller) {
|
||||
controller.abort();
|
||||
delete pendingGenerations[generationId];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export const completeGeneration = (generationId: string) => {
|
||||
const controller = pendingGenerations[generationId];
|
||||
if (controller) {
|
||||
delete pendingGenerations[generationId];
|
||||
}
|
||||
};
|
||||
|
||||
export const addPendingGeneration = (generationId: string, controller: AbortController) => {
|
||||
pendingGenerations[generationId] = controller;
|
||||
};
|
||||
Reference in New Issue
Block a user