fix(ui): explain a 0 Buzz threshold in the price alerts panel

The default threshold is 0 ("only tell me when a version becomes free") and the
settings copy says so, but the panel did not: a real instance with 52 priced paid
versions and an untouched threshold showed "Nothing is under your price threshold
right now" with only a small "Alert threshold: 0 Buzz" in the corner, which reads
as a broken feature.

- the payload now carries pricedCount, so the empty state can say how many paid
  versions already have a known price
- when the threshold is 0 and prices are known, the empty state says so and
  points at Settings - Library instead of implying there is nothing to show
- the read-time threshold comparison means setting one takes effect immediately;
  measured on a copy of that instance: 0 Buzz -> 0 alerts, 100 -> 44,
  500 -> 48, 5000 -> 51
This commit is contained in:
Will Miao
2026-10-04 20:28:57 +08:00
parent 425d90a912
commit 156d2e5eb9
17 changed files with 148 additions and 23 deletions
@@ -2023,6 +2023,20 @@ async def test_failed_price_attempt_is_not_retried_within_the_ttl(tmp_path):
assert service.count_unavailable_prices("lora") == 1
@pytest.mark.asyncio
async def test_priced_count_reports_known_prices(tmp_path):
service = _price_service(tmp_path, price_tracking_enabled=True)
scanner = DummyScanner(LOCAL_RAW_DATA)
provider = PriceProvider(GATED_RESPONSE, prices=PRICE_PAYLOAD)
assert service.count_priced_versions("lora") == 0
await service.refresh_for_model_type("lora", scanner, provider)
assert service.count_priced_versions("lora") == 1
assert service.count_priced_versions("checkpoint") == 0
@pytest.mark.asyncio
async def test_forced_refresh_reprices_within_the_ttl(tmp_path):
service = _long_ttl_service(tmp_path, price_tracking_enabled=True)