worktree-citti-arkiver-tur #14

Merged
hjess merged 2 commits from worktree-citti-arkiver-tur into main 2026-10-31 06:54:24 +01:00
Showing only changes of commit 925174d80e - Show all commits

12
app.py
View File

@@ -423,9 +423,12 @@ def match_offers_ai():
# Skip the (daily) match call when the offer set hasn't changed since the # Skip the (daily) match call when the offer set hasn't changed since the
# last successful match — the avis only turns over weekly, so this avoids a # last successful match — the avis only turns over weekly, so this avoids a
# pointless Claude call most days. # pointless Claude call most days. The leading version forces a re-match
# whenever the matching logic/prompt changes (bump it when editing them).
MATCH_VERSION = "v2-standard-not-premium"
sig = hashlib.md5( sig = hashlib.md5(
"\n".join(sorted(o['id'] + '|' + (o.get('heading') or '') for o in offers)) (MATCH_VERSION + "\n" + "\n".join(
sorted(o['id'] + '|' + (o.get('heading') or '') for o in offers)))
.encode('utf-8')).hexdigest() .encode('utf-8')).hexdigest()
with get_db() as c: with get_db() as c:
if _meta_get(c, 'last_match_sig') == sig and \ if _meta_get(c, 'last_match_sig') == sig and \
@@ -452,7 +455,10 @@ def match_offers_ai():
"findes. Vær striks: match kun når det tydeligt er samme varetype " "findes. Vær striks: match kun når det tydeligt er samme varetype "
"(fx entrecôte↔entrecôte-tilbud). Match IKKE blot på mærke eller løst " "(fx entrecôte↔entrecôte-tilbud). Match IKKE blot på mærke eller løst "
"beslægtede varer (fx 'Nutella 1kg glas' må IKKE matche 'Nutella " "beslægtede varer (fx 'Nutella 1kg glas' må IKKE matche 'Nutella "
"julekalender'). Vælg det billigste ved flere ens. Returnér KUN et " "julekalender'). Når varen er generisk (fx 'Entrecote ½ kg'), vælg den "
"ALMINDELIGE/standard variant til den LAVESTE pris — undgå premium-/"
"luksus-varianter (Wagyu, Dry-Aged, US-Beef, øko-premium) medmindre varen "
"selv nævner det, da de giver et urealistisk højt estimat. Returnér KUN et "
'JSON-array [{"item_key":"...","offer_id":"..."}] med de sikre match, ' 'JSON-array [{"item_key":"...","offer_id":"..."}] med de sikre match, '
"intet andet.") "intet andet.")
client = anthropic.Anthropic(max_retries=CLAUDE_MAX_RETRIES) client = anthropic.Anthropic(max_retries=CLAUDE_MAX_RETRIES)