Bladeren bron

align err types

Bruce MacDonald 2 maanden geleden
bovenliggende
commit
aebca4b70c
2 gewijzigde bestanden met toevoegingen van 2 en 13 verwijderingen
  1. 2 7
      runner/ollamarunner/cache.go
  2. 0 6
      runner/ollamarunner/cache_test.go

+ 2 - 7
runner/ollamarunner/cache.go

@@ -243,12 +243,10 @@ func (c *InputCache) ShiftDiscard(inputLen int32, numKeep int32) int32 {
 
 type ErrReprocessInputs struct {
 	Inputs []input
-	SlotId int
 }
 
 func (e *ErrReprocessInputs) Error() string {
-	return fmt.Sprintf("kv cache shift not supported, inputs need reprocessing (slot: %v, input count: %v)",
-		e.SlotId, len(e.Inputs))
+	return fmt.Sprintf("kv cache shift not supported, inputs need reprocessing (input count: %v)", len(e.Inputs))
 }
 
 // Frees up space in the KV cache by deleting the oldest half of history and shifting
@@ -289,10 +287,7 @@ func (c *InputCache) ShiftCacheSlot(slot *InputCacheSlot, numKeep int32) error {
 			slot.Inputs = []input{}
 
 			// Return error with inputs that need to be reprocessed
-			return &ErrReprocessInputs{
-				Inputs: newInputs,
-				SlotId: slot.Id,
-			}
+			return &ErrReprocessInputs{Inputs: newInputs}
 		}
 	}
 

+ 0 - 6
runner/ollamarunner/cache_test.go

@@ -378,12 +378,6 @@ func TestShiftCacheSlot(t *testing.T) {
 				if !errors.As(err, &tt.wantErr) {
 					t.Errorf("Expected error of type %T but got %T: %v", tt.wantErr, err, err)
 				}
-
-				if errReproc, ok := err.(*ErrReprocessInputs); ok {
-					if errReproc.SlotId != slot.Id {
-						t.Errorf("ErrReprocessInputs has wrong SlotId: got %v, want %v", errReproc.SlotId, slot.Id)
-					}
-				}
 			} else if err != nil {
 				t.Errorf("Unexpected error: %v", err)
 			}