Skip to content

Commit 2f404c1

Browse files
Algorithm5838github-actions[bot]
authored andcommitted
perf: O(1) end-tag detection via tail slice
1 parent 80d6601 commit 2f404c1

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
@@ -3399,7 +3399,7 @@ def set_last_text(out, text):
33993399
else:
34003400
block_content = get_last_text(output)
34013401

3402-
if re.search(end_tag_pattern, block_content):
3402+
if end_tag in block_content[-4096:]:
34033403
end_flag = True
34043404

34053405
# Strip start and end tags from content

0 commit comments

Comments
 (0)