mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-25 05:46:13 +00:00
fix(localagent): stop re-seeding stream accumulator with previous round content (#2329)
When the LLM (e.g. MiniMax-M3) returns multiple rounds after tool calls, the _StreamAccumulator was initialized with initial_content=first_content, causing every subsequent round to repeat the entire first message. Remove the re-seeding so each round starts with a clean accumulator. Add regression test verifying multi-round tool call content is not duplicated.
This commit is contained in:
@@ -523,7 +523,6 @@ class LocalAgentRunner(runner.RequestRunner):
|
||||
final_msg = stream_accumulator.final_message()
|
||||
|
||||
pending_tool_calls = final_msg.tool_calls
|
||||
first_content = final_msg.content
|
||||
if isinstance(final_msg, provider_message.MessageChunk):
|
||||
first_end_sequence = final_msg.msg_sequence
|
||||
|
||||
@@ -606,9 +605,13 @@ class LocalAgentRunner(runner.RequestRunner):
|
||||
)
|
||||
|
||||
if is_stream:
|
||||
# Do NOT re-seed the accumulator with first_content:
|
||||
# the previous round's text was already pushed to the
|
||||
# platform adapter. Re-seeding would cause every
|
||||
# subsequent round to repeat the entire opening line,
|
||||
# which the platform then forwards as a duplicate message.
|
||||
stream_accumulator = _StreamAccumulator(
|
||||
msg_sequence=first_end_sequence,
|
||||
initial_content=first_content,
|
||||
remove_think=remove_think,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user