refactor(compaction): append fitting input_text parts without copying
BN01 quality finding (Low): _truncate_input_text_parts copied each
fully-fitting part with {**part} although it never mutates it. The
fully-fitting item path already appends the original item uncopied,
and the clipped boundary part is still a new dict. No caller mutates
the returned parts (the result is only placed into the retained
message), so the copy was dead work.
This commit is contained in:
@@ -206,7 +206,7 @@ def _truncate_input_text_parts(content: List[Dict[str, Any]], budget: int) -> Li
|
||||
if lo:
|
||||
head.append({**part, "text": text[:lo]})
|
||||
break
|
||||
head.append({**part})
|
||||
head.append(part)
|
||||
budget -= cost
|
||||
return head
|
||||
|
||||
|
||||
Reference in New Issue
Block a user