Skip to content

Commit 5432795

Browse files
committed
perf: O(1) end-tag detection via tail slice
1 parent 8e2df54 commit 5432795

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
@@ -3404,7 +3404,7 @@ def set_last_text(out, text):
34043404
else:
34053405
block_content = get_last_text(output)
34063406

3407-
if re.search(end_tag_pattern, block_content):
3407+
if end_tag in block_content[-512:]:
34083408
end_flag = True
34093409

34103410
# Strip start and end tags from content

0 commit comments

Comments
 (0)