Merge pull request #9619 from XingjianXie/fix_after_tag

Fix tag_content_handler issue
This commit is contained in:
Timothy Jaeryang Baek 2025-02-07 14:42:14 -08:00 committed by GitHub
commit 4271b652a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1260,10 +1260,10 @@ async def process_chat_response(
match.end() : match.end() :
] # Content after opening tag ] # Content after opening tag
# Remove the start tag from the currently handling text block # Remove the start tag and after from the currently handling text block
content_blocks[-1]["content"] = content_blocks[-1][ content_blocks[-1]["content"] = content_blocks[-1][
"content" "content"
].replace(match.group(0), "") ].replace(match.group(0) + after_tag, "")
if before_tag: if before_tag:
content_blocks[-1]["content"] = before_tag content_blocks[-1]["content"] = before_tag