Skip to content
All posts

How I Built a Free Chatbot for This Site (It's a Dog)

aiazureweb

There's a robotic Belgian Malinois in the bottom-right corner of this site. His name is Mal, he answers questions about my work, and he costs me exactly nothing to run. This post is the practical bill of materials.

The constraint that shaped everything

I wanted a chatbot, but I refused to pay a monthly bill for a portfolio gimmick. That single constraint made most of the decisions:

  • No hosted vector database. The knowledge fits in the prompt. My site has seven case studies, three public repos, and one bio — compiled at build time into an 18 KB JSON pack. Retrieval infrastructure for 18 KB is a hobby, not a solution.
  • No paid LLM API. Two free tiers instead: Groq's GPT-OSS 120B as the primary (fast enough that streaming feels instant) and Gemini Flash as the failover. A managed Azure Function tries them in order — two fetch calls and a small SSE parser, no SDKs.
  • No always-up guarantee. Free tiers rate-limit. Instead of hiding that, the dog falls asleep: ears droop, a Zzz floats up, and the widget offers the projects and contact pages instead. A failure state that stays in character is indistinguishable from a feature.

Grounding a bot with a sense of humor

The bot is deliberately quirky — dry wit, one dog joke per reply, scripted responses to "sit" and "who's a good boy?". The risk with personality is that a playful model plays fast and loose with facts, and on a professional site a chatbot that invents project details is a liability wearing a costume.

The fix is the same one I used on Atlas, scaled down: facts and banter get different rules. The system prompt allows the model to improvise tone but requires every claim about me or my projects to come from the knowledge pack — and to say "that one's not in my kennel of facts" otherwise. The easter eggs don't even reach the model: dog commands are matched client-side and answered from a script, which means the tricks work even while the API is asleep.

The parts list

  • Widget: React, ~5 small components, hand-drawn SVG avatar with state-driven CSS animations (idle blink, thinking head-tilt, asleep). Mounts after hydration so static generation is untouched.
  • API: one Azure Static Web Apps managed Function. Origin check, message length caps, a per-visitor hourly limit, a global daily budget, and the provider chain. Anonymous counters in the logs; no message content stored.
  • Knowledge pack: a build script that strips the site's MDX case studies to text and bundles them with curated repo notes and a bio.
  • Bill: €0. The free tiers are the budget, and the nap is the overdraft protection.

The whole thing — widget, function, pack builder — is open source in the mal-site-dog repo. Fork it, swap the knowledge pack, draw your own animal.

NZ

Nick Zivkovic

Freelance .NET & AI Developer — work with me

NZNick Zivkovic

I build reliable web applications and practical AI integrations on .NET, React, and Azure — Microsoft certified, currently a Microsoft vendor working on the Azure platform itself and the AI being built into it.

Microsoft Certified · Current Microsoft vendor — working on the Azure platform itself

Get in touch

© 2026 Nick Zivkovic. All rights reserved.

Freelance .NET & AI Developer