Skip to content

Commit b9decdf

Browse files
committed
perf: O(1) end-tag detection via tail slice
1 parent a8f249f commit b9decdf

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
@@ -3394,7 +3394,7 @@ def set_last_text(out, text):
33943394
else:
33953395
block_content = get_last_text(output)
33963396

3397-
if re.search(end_tag_pattern, block_content):
3397+
if end_tag in block_content[-512:]:
33983398
end_flag = True
33993399

34003400
# Strip start and end tags from content

0 commit comments

Comments
 (0)