feat: localchat, a Go + Templ + HTMX chat app for local Gemma models

Streams replies over SSE from any OpenAI-compatible server (oMLX,
llama.cpp, Ollama, ...). Single binary that can install itself as an
OS service; docker compose bundles llama.cpp + Gemma 4 E2B.
This commit is contained in:
bdeb1337 committed 2026-10-05 07:10:07 +02:00
commit 9391a252aa
30 files changed
+2566

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS := -s -w -X main.version=$(VERSION)
PLATFORMS := linux/amd64 linux/arm64 darwin/arm64 darwin/amd64 windows/amd64 windows/arm64
.PHONY: generate build run test e2e dist up down
generate: ## regenerate Templ components
go tool templ generate
build: generate ## build ./bin/localchat for this machine
go build -trimpath -ldflags "$(LDFLAGS)" -o bin/localchat ./cmd/localchat
run: build ## run in the foreground (reads ./.env)
./bin/localchat --debug
test: ## unit + handler tests (no model needed)
go test -race ./...
e2e: ## browser test against a running instance + real model
uv run scripts/e2e.py
dist: generate ## cross-compile for every platform into ./dist
@for p in $(PLATFORMS); do \
os=$${p%/*}; arch=$${p#*/}; ext=$$( [ $$os = windows ] && echo .exe ); \
echo " $$os/$$arch"; \
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build -trimpath -ldflags "$(LDFLAGS)" \
-o dist/localchat-$$os-$$arch$$ext ./cmd/localchat || exit 1; \
done
up: ## start app + llama.cpp + Gemma in containers
docker compose up -d --build
down:
docker compose down