mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +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:
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user