Spaces:
Running
Send cache headers so updates reach visitors on a normal reload
What
Cache headers for the demo's files. server.py replaces python -m http.server: the page, scripts and data (index.html, worker.js, pybot_web.py, tree.json) get Cache-Control: no-cache; the bot bundle gets immutable, the fonts one day.
Why
After #2 was merged, Lewis's browser kept the old index.html and paired it with the new tree.json, so file links had the new commit but no line numbers. http.server sends no Cache-Control, so browsers may reuse a page heuristically after an update.
How
no-cachestill lets browsers keep a copy, but they check it on every load. An unchanged file costs a 304 (http.serveralready handlesIf-Modified-Since).- The bundle can be cached for good because its name changes with every build (
pybot-<sha12>-<hash>.zip). Dockerfilerunsserver.py(port 7860 as before;HOST/PORTcan be overridden for local tests). README updated.
Testing
Served the live files locally with server.py: the headers are as above, and an unchanged index.html revalidates with 304. In headless Chromium the demo loads and answers, and "Hi, I'm Sam" links to chat.py#L14163-L14285, with no page errors.
๐ค Generated with Claude Code