From b1bcca90b5e00124fd518a9d8030f3d077a71347 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 11 Jan 2025 20:23:26 -0800 Subject: [PATCH] refac --- backend/open_webui/utils/middleware.py | 6 +++--- src/lib/components/common/Tooltip.svelte | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 77628dee5..5980d4af0 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -966,12 +966,12 @@ async def process_chat_response( if not data.strip(): continue - # "data: " is the prefix for each event - if not data.startswith("data: "): + # "data:" is the prefix for each event + if not data.startswith("data:"): continue # Remove the prefix - data = data[len("data: ") :] + data = data[len("data:") :].strip() try: data = json.loads(data) diff --git a/src/lib/components/common/Tooltip.svelte b/src/lib/components/common/Tooltip.svelte index 230427525..74f936320 100644 --- a/src/lib/components/common/Tooltip.svelte +++ b/src/lib/components/common/Tooltip.svelte @@ -12,6 +12,7 @@ export let touch = true; export let className = 'flex'; export let theme = ''; + export let offset = [0, 4]; export let allowHTML = true; export let tippyOptions = {}; @@ -29,7 +30,7 @@ touch: touch, ...(theme !== '' ? { theme } : { theme: 'dark' }), arrow: false, - offset: [0, 4], + offset: offset, ...tippyOptions }); }