debug: show translation cache key
Browse files- src/streamlit_app.py +8 -0
src/streamlit_app.py
CHANGED
|
@@ -445,6 +445,14 @@ if st.session_state.get("do_search"):
|
|
| 445 |
temperature=temperature,
|
| 446 |
)
|
| 447 |
if full_attractions:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 448 |
translated = translate_items_cached(
|
| 449 |
items=full_attractions,
|
| 450 |
second_language=sec_lang,
|
|
|
|
| 445 |
temperature=temperature,
|
| 446 |
)
|
| 447 |
if full_attractions:
|
| 448 |
+
# DEBUG: compute key and check cache
|
| 449 |
+
import json as _j
|
| 450 |
+
cat_hash_debug = _j.dumps(params.get("categories") or {}, sort_keys=True)
|
| 451 |
+
debug_key = (params["city"], cat_hash_debug, sec_lang)
|
| 452 |
+
from services.recommender import _TRANSLATION_CACHE
|
| 453 |
+
found = debug_key in _TRANSLATION_CACHE
|
| 454 |
+
st.caption(f"🔑 Cache key: `({params['city']}, {cat_hash_debug[:30]}..., {sec_lang})` — **{'FOUND' if found else 'MISSING'}**")
|
| 455 |
+
|
| 456 |
translated = translate_items_cached(
|
| 457 |
items=full_attractions,
|
| 458 |
second_language=sec_lang,
|