소스 검색

create new input slice and replace

Bruce MacDonald 2 달 전
부모
커밋
6835f58c63
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      runner/llamarunner/cache.go

+ 4 - 1
runner/llamarunner/cache.go

@@ -258,7 +258,10 @@ func (c *InputCache) ShiftCacheSlot(slot *InputCacheSlot, numKeep int) error {
 		copy(afterDiscardInputs, slot.Inputs[numKeep+discard:])
 
 		// Update the inputs to match what would happen after a shift
-		slot.Inputs = append(keepInputs, afterDiscardInputs...)
+		newInputs := make([]input, 0, numKeep+len(afterDiscardInputs))
+		newInputs = append(newInputs, keepInputs...)
+		newInputs = append(newInputs, afterDiscardInputs...)
+		slot.Inputs = newInputs
 	}
 
 	return nil