Skip to content

Commit 23ee4b8

Browse files
Algorithm5838github-actions[bot]
authored andcommitted
perf: O(1) end-tag detection via tail slice
1 parent c8e9b9c commit 23ee4b8

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
@@ -3361,7 +3361,7 @@ def set_last_text(out, text):
33613361
else:
33623362
block_content = get_last_text(output)
33633363

3364-
if re.search(end_tag_pattern, block_content):
3364+
if end_tag in block_content[-4096:]:
33653365
end_flag = True
33663366

33673367
# Strip start and end tags from content

0 commit comments

Comments
 (0)