mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
fix: add functional null safety checks and boolean casting to Chat.svelte (#19921)
* fix(chat): add functional null safety checks and boolean casting * Update Chat.svelte
This commit is contained in:
@@ -2211,14 +2211,17 @@
|
||||
generating = true;
|
||||
const [res, controller] = await generateMoACompletion(
|
||||
localStorage.token,
|
||||
message.model,
|
||||
history.messages[message.parentId].content,
|
||||
message.model ?? '',
|
||||
message.parentId ? history.messages[message.parentId].content : '',
|
||||
responses
|
||||
);
|
||||
|
||||
if (res && res.ok && res.body && generating) {
|
||||
generationController = controller;
|
||||
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
|
||||
generationController = controller as AbortController;
|
||||
const textStream = await createOpenAITextStream(
|
||||
res.body,
|
||||
Boolean($settings?.splitLargeChunks ?? false)
|
||||
);
|
||||
for await (const update of textStream) {
|
||||
const { value, done, sources, error, usage } = update;
|
||||
if (error || done) {
|
||||
@@ -2305,7 +2308,7 @@
|
||||
};
|
||||
|
||||
const MAX_DRAFT_LENGTH = 5000;
|
||||
let saveDraftTimeout = null;
|
||||
let saveDraftTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const saveDraft = async (draft, chatId = null) => {
|
||||
if (saveDraftTimeout) {
|
||||
|
||||
Reference in New Issue
Block a user