Skip to content

Commit e9c1dfd

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

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
@@ -3413,7 +3413,7 @@ def set_last_text(out, text):
34133413
else:
34143414
block_content = get_last_text(output)
34153415

3416-
if re.search(end_tag_pattern, block_content):
3416+
if end_tag in block_content[-512:]:
34173417
end_flag = True
34183418

34193419
# Strip start and end tags from content

0 commit comments

Comments
 (0)