fix: let Settings model reach summarizer; cap map pins at 20
This commit is contained in:
parent
450de45bfc
commit
d2bf55183c
7 changed files with 20 additions and 5 deletions
|
|
@ -13,6 +13,7 @@ _FENCE_RE = re.compile(r"```(?:json)?", re.IGNORECASE)
|
|||
TICKER_HEADLINE_MAX = 140
|
||||
MAP_HEADLINE_MAX = 160
|
||||
TICKER_CAP = 12
|
||||
MAP_CAP = 20
|
||||
|
||||
|
||||
def parse_reduce_json(raw: str) -> dict:
|
||||
|
|
@ -87,4 +88,6 @@ def select_map(items: list) -> list:
|
|||
item["headline"] = headline
|
||||
item["lat"], item["lon"] = coords
|
||||
out.append(item)
|
||||
if len(out) >= MAP_CAP:
|
||||
break
|
||||
return out
|
||||
|
|
|
|||
|
|
@ -40,3 +40,12 @@ def test_select_map_requires_valid_coords_and_flag():
|
|||
]
|
||||
out = select_map(items)
|
||||
assert [r["headline"] for r in out] == ["A"]
|
||||
|
||||
def test_select_map_caps_20():
|
||||
items = [
|
||||
{"headline": f"h{i}", "importance": "critical", "lat": 1.0, "lon": 2.0}
|
||||
for i in range(25)
|
||||
]
|
||||
out = select_map(items)
|
||||
assert len(out) == 20
|
||||
assert all(r["importance"] in ("critical", "high") for r in out)
|
||||
|
|
|
|||
Loading…
Reference in a new issue