Skip to content

Commit 5820e5f

Browse files
committed
perf: O(1) end-tag detection via tail slice
1 parent e8e8ccb commit 5820e5f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

backend/open_webui/utils/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3416,7 +3416,7 @@ def set_last_text(out, text):
34163416
else:
34173417
block_content = get_last_text(output)
34183418

3419-
if re.search(end_tag_pattern, block_content):
3419+
if end_tag in block_content[-512:]:
34203420
end_flag = True
34213421

34223422
# Strip start and end tags from content

0 commit comments

Comments
 (0)