**Fix model switch logic when quota is exceeded**

Ensure `modelName` is updated after switching to a new model, avoiding inconsistencies in subsequent iterations.
This commit is contained in:
Luis Pater
2025-09-01 21:37:03 +08:00
parent 56c8297f6b
commit 34855bc647

View File

@@ -484,6 +484,7 @@ func (c *GeminiCLIClient) SendRawMessage(ctx context.Context, modelName string,
if newModelName != "" {
log.Debugf("Model %s is quota exceeded. Switch to preview model %s", modelName, newModelName)
rawJSON, _ = sjson.SetBytes(rawJSON, "model", newModelName)
modelName = newModelName
continue
}
}
@@ -563,6 +564,7 @@ func (c *GeminiCLIClient) SendRawMessageStream(ctx context.Context, modelName st
if newModelName != "" {
log.Debugf("Model %s is quota exceeded. Switch to preview model %s", modelName, newModelName)
rawJSON, _ = sjson.SetBytes(rawJSON, "model", newModelName)
modelName = newModelName
continue
}
}