mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-05 03:02:35 +00:00
core[patch]: merge message runs nit (#24997)
Only add separator if both chunks are non-empty
This commit is contained in:
parent
8e2316b8c2
commit
0de0cd2d31
@ -503,8 +503,11 @@ def merge_message_runs(
|
|||||||
else:
|
else:
|
||||||
last_chunk = _msg_to_chunk(last)
|
last_chunk = _msg_to_chunk(last)
|
||||||
curr_chunk = _msg_to_chunk(curr)
|
curr_chunk = _msg_to_chunk(curr)
|
||||||
if isinstance(last_chunk.content, str) and isinstance(
|
if (
|
||||||
curr_chunk.content, str
|
isinstance(last_chunk.content, str)
|
||||||
|
and isinstance(curr_chunk.content, str)
|
||||||
|
and last_chunk.content
|
||||||
|
and curr_chunk.content
|
||||||
):
|
):
|
||||||
last_chunk.content += "\n"
|
last_chunk.content += "\n"
|
||||||
merged.append(_chunk_to_msg(last_chunk + curr_chunk))
|
merged.append(_chunk_to_msg(last_chunk + curr_chunk))
|
||||||
|
Loading…
Reference in New Issue
Block a user