mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-19 16:12:30 +00:00
fix(utils): remove unreachable dead code in find_legal_message_start
The for loop at line 168 never executes because start is assigned i + 1 immediately before slicing messages[start : i + 1], which is always an empty list. Remove the dead code. Fixes #3716
This commit is contained in:
parent
de13e72e15
commit
73a8d8a875
@ -165,11 +165,6 @@ def find_legal_message_start(messages: list[dict[str, Any]]) -> int:
|
||||
if tid and str(tid) not in declared:
|
||||
start = i + 1
|
||||
declared.clear()
|
||||
for prev in messages[start : i + 1]:
|
||||
if prev.get("role") == "assistant":
|
||||
for tc in prev.get("tool_calls") or []:
|
||||
if isinstance(tc, dict) and tc.get("id"):
|
||||
declared.add(str(tc["id"]))
|
||||
return start
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user