Bläddra i källkod

create new input slice and replace

Bruce MacDonald 2 månader sedan
förälder
incheckning
6835f58c63
1 ändrade filer med 4 tillägg och 1 borttagningar
  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