Skip to content

Commit 1959ba2

Browse files
Algorithm5838github-actions[bot]
authored andcommitted
perf: O(1) end-tag detection via tail slice
1 parent 1e2e984 commit 1959ba2

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
@@ -3423,7 +3423,7 @@ def set_last_text(out, text):
34233423
else:
34243424
block_content = get_last_text(output)
34253425

3426-
if re.search(end_tag_pattern, block_content):
3426+
if end_tag in block_content[-512:]:
34273427
end_flag = True
34283428

34293429
# Strip start and end tags from content

0 commit comments

Comments
 (0)