Skip to content

Commit 510c486

Browse files
committed
perf: O(1) end-tag detection via tail slice
1 parent 53199be commit 510c486

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
@@ -3372,7 +3372,7 @@ def set_last_text(out, text):
33723372
else:
33733373
block_content = get_last_text(output)
33743374

3375-
if re.search(end_tag_pattern, block_content):
3375+
if end_tag in block_content[-512:]:
33763376
end_flag = True
33773377

33783378
# Strip start and end tags from content

0 commit comments

Comments
 (0)