feat: rewrite chat-handler in Go

Replace Python chat handler with Go for smaller container images.
Uses handler-base Go module for NATS, health, telemetry, and service clients.

- RAG pipeline: embed → Milvus → rerank → LLM
- Streaming response chunks
- Optional TTS synthesis
- Custom response_subject support for companions-frontend
This commit is contained in:
2026-02-19 17:58:52 -05:00
parent a1cf87909d
commit adcdb87b9a
14 changed files with 693 additions and 3402 deletions

View File

@@ -1,9 +1,23 @@
# Chat Handler - Using handler-base
ARG BASE_TAG=latest
FROM ghcr.io/billy-davies-2/handler-base:${BASE_TAG}
# Build stage
FROM golang:1.25-alpine AS builder
WORKDIR /app
COPY chat_handler.py .
RUN apk add --no-cache ca-certificates
CMD ["python", "chat_handler.py"]
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /chat-handler .
# Runtime stage
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /chat-handler /chat-handler
USER 65534:65534
ENTRYPOINT ["/chat-handler"]