core[patch]: merge message runs nit (#24997)

Only add separator if both chunks are non-empty
This commit is contained in:
Bagatur 2024-08-02 13:25:43 -07:00 committed by GitHub
parent 8e2316b8c2
commit 0de0cd2d31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -503,8 +503,11 @@ def merge_message_runs(
else:
last_chunk = _msg_to_chunk(last)
curr_chunk = _msg_to_chunk(curr)
if isinstance(last_chunk.content, str) and isinstance(
curr_chunk.content, str
if (
isinstance(last_chunk.content, str)
and isinstance(curr_chunk.content, str)
and last_chunk.content
and curr_chunk.content
):
last_chunk.content += "\n"
merged.append(_chunk_to_msg(last_chunk + curr_chunk))