From 3d9498a42550766b53e1acb35b076fcb560d6b13 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Wed, 7 May 2025 17:16:07 -0700 Subject: [PATCH] ollamarunner: Use correct constant to remove cache entries The correct constant to remove all entries to the end of the sequence for the Ollama engine is math.MaxInt32. -1 is used by the old engine. The impact of this is currently minimal because it would only occur in situations that are not supported by the implemented models or rarely used options. --- runner/ollamarunner/cache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runner/ollamarunner/cache.go b/runner/ollamarunner/cache.go index 01f435e4b..2138d7988 100644 --- a/runner/ollamarunner/cache.go +++ b/runner/ollamarunner/cache.go @@ -284,7 +284,7 @@ func (c *InputCache) ShiftCacheSlot(slot *InputCacheSlot, numKeep int32) error { copy(newInputs[numKeep:], slot.Inputs[numKeep+discard:]) // Reset the cache - _ = c.cache.Remove(slot.Id, 0, -1) + _ = c.cache.Remove(slot.Id, 0, math.MaxInt32) slot.Inputs = []input.Input{} // Return error with inputs that need to be reprocessed