# The chatbot's files

The code behind [pi_web_chat.html](../pi_web_chat.html), as it runs on the Pi
on 30 September 2026. Where each file goes:

| File | On the Pi | What it is |
|---|---|---|
| `web_factory.py` | `~/web-factory/` | the chatbot: the web page, the tools, ✨ Auto |
| `biscuit.md` | `~/web-factory/` | what Biscuit knows about itself, indexed by LlamaIndex |
| `make_biscuit.py` | `~/web-factory/` | makes the `biscuit` models on the HAT (the Modelfile, in Python) |
| `use_ollama.py` | `~/web-factory/` | real Ollama on the Pi, from Python |
| `ollama_relay.py` | `/usr/local/bin/` | the HAT as Ollama, port 11434, for a Mac |
| `heat_guard.py` | `/usr/local/bin/` | shuts the Pi down if it stays over 80 °C |
| `web-factory.service` | `/etc/systemd/system/` | starts the chatbot with the Pi, as `student`, on ports 8080 and 443 |
| `hailo-ollama.service` | `/etc/systemd/system/` | Biscuit's model server on the HAT, port 8000 (runs as the admin account, `ddtraveller` here) |
| `ollama-cpu.service` | `/etc/systemd/system/` | real Ollama on the processor, port 11435 |
| `ollama-relay.service` | `/etc/systemd/system/` | the relay, port 11434 |
| `heat-guard.service`, `heat-guard.timer` | `/etc/systemd/system/` | the heat guard, every 5 minutes |
| `zz-persistent.conf` | `/etc/systemd/journald.conf.d/` | keeps the journal on the card across reboots (Pi OS keeps it in memory by default) |
| `share.conf` | `/etc/systemd/system/web-factory.service.d/` | the sharing switches as a service drop-in: `SHARE` (the page) and `SHARE_OLLAMA` (real Ollama, port 8443), each `off`, `private` or `public` |

The Python runs in `~/web-venv` with: folium, ddgs, llama-index-core,
llama-index-embeddings-huggingface, llama-index-llms-ollama, ollama.
(smolagents is still installed there from the first build, and no longer used.)

The same `web_factory.py` is on GitHub:
https://github.com/ddtraveller/watdonchan/blob/main/HTML/pi_web_chat_assets/web_factory.py
