Skip to content

Commit fe19990

Browse files
committed
perf: O(1) end-tag detection via tail slice
1 parent 82394cf commit fe19990

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
@@ -3356,7 +3356,7 @@ def set_last_text(out, text):
33563356
else:
33573357
block_content = get_last_text(output)
33583358

3359-
if re.search(end_tag_pattern, block_content):
3359+
if end_tag in block_content[-4096:]:
33603360
end_flag = True
33613361

33623362
# Strip start and end tags from content

0 commit comments

Comments
 (0)