Skip to content

Commit 13c7d96

Browse files
committed
refac
1 parent bffbf7e commit 13c7d96

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

backend/open_webui/utils/middleware.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,8 @@ def extract_attributes(tag_content):
12521252
end_tag_pattern = rf"</{tag}>"
12531253

12541254
if re.search(end_tag_pattern, content):
1255+
end_flag = True
1256+
12551257
block_content = content_blocks[-1]["content"]
12561258
# Strip start and end tags from the content
12571259
start_tag_pattern = rf"<{tag}(.*?)>"
@@ -1276,7 +1278,6 @@ def extract_attributes(tag_content):
12761278
print(f"leftover_content: {leftover_content}")
12771279

12781280
if block_content:
1279-
end_flag = True
12801281
content_blocks[-1]["content"] = block_content
12811282
content_blocks[-1]["ended_at"] = time.time()
12821283
content_blocks[-1]["duration"] = int(
@@ -1290,9 +1291,7 @@ def extract_attributes(tag_content):
12901291
"content": leftover_content,
12911292
}
12921293
)
1293-
12941294
else:
1295-
end_flag = True
12961295
# Remove the block if content is empty
12971296
content_blocks.pop()
12981297

@@ -1377,7 +1376,6 @@ async def stream_body_handler(response):
13771376

13781377
try:
13791378
data = json.loads(data)
1380-
print(data)
13811379

13821380
if "selected_model_id" in data:
13831381
model_id = data["selected_model_id"]

0 commit comments

Comments
 (0)