Skip to content

About

A handy chat app well integrated into Keera Gateway and its guardrails

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Keera Chat

A chat in the browser for the people behind a Keera Gateway. People sign in with their Keera account, and every message goes through the gateway with their own key. So chats meet the same guardrails, budgets, filters and audit log as any other request.

┌─────────┐  messages  ┌────────────┐  your key  ┌───────────────┐
│ Browser │───────────▶│ Keera Chat │───────────▶│ Keera Gateway │
│ (chats) │◀───────────│ (no state) │◀───────────│ (rules, logs) │
└─────────┘   replies  └────────────┘   replies  └───────────────┘

Keera Chat with a conversation open: the chats in the sidebar and a reply with a numbered list

  • Offers only the models, routers and agents the person's keys allow.
  • Streams replies with Markdown, and takes images, PDFs and text files.
  • Keeps conversations in the browser. Keera Chat itself is stateless.

How to use it is in the user docs. How to run it is in Run Keera Chat.

Run it

Locally

Start the gateway with its own make dev, with these in its compose/.env:

KEERA_PUBLIC_URL=http://localhost:8080
KEERA_CHAT_URL=http://localhost:8090

Then install air once and start Keera Chat:

go install github.com/air-verse/air@latest
make dev

Open http://localhost:8090. Use localhost for both, not 127.0.0.1: cookies are kept apart by host name.

In production

Set KEERA_CHAT_URL on the gateway to Keera Chat's address. On Keera Chat:

KEERA_CHAT_PUBLIC_URL=https://chat.example.ch
KEERA_CHAT_GATEWAY_URL=https://keera.example.ch
KEERA_CHAT_SECRET_KEY=<openssl rand -hex 32>

Images are at ghcr.io/bespinian/keera-chat:<tag>. They run as nobody on port 8090 and need no volume. Put them behind TLS. To verify an image:

gh attestation verify oci://ghcr.io/bespinian/keera-chat:<tag> --repo bespinian/keera-chat \
  --signer-workflow bespinian/keera-chat/.github/workflows/release-build.yml

Settings

Variable Default What it is
KEERA_CHAT_GATEWAY_URL required The gateway's address as a browser reaches it.
KEERA_CHAT_SECRET_KEY required Encrypts the session cookie. At least 16 characters.
KEERA_CHAT_PUBLIC_URL http://127.0.0.1:<port> Keera Chat's address. Must match KEERA_CHAT_URL on the gateway.
KEERA_CHAT_GATEWAY_INTERNAL_URL KEERA_CHAT_GATEWAY_URL Where Keera Chat reaches the gateway, if different.
KEERA_CHAT_AGENTS_INTERNAL_URL the gateway's Where Keera Chat reaches Keera Agents, if different.
KEERA_CHAT_ADDR :8090 The listener.
KEERA_CHAT_SECURE_COOKIES follows the scheme Marks the session cookie Secure.
KEERA_CHAT_MAX_BODY_BYTES 33554432 (32 MiB) The largest message, including the whole conversation. At least 1 MiB.
KEERA_CHAT_LOG_LEVEL info debug, info, warn or error.
KEERA_CHAT_LOG_FORMAT text text or json.

Development

make check   # test + vet + fmt-check
make lint    # golangci-lint, as CI runs it
make dev     # live reload at http://localhost:8090
make build   # build/keera-chat
make image   # localhost/keera-chat:latest
make sbom    # build/sbom/keera-chat.cdx.json

A v* tag builds, signs and publishes a release.

Licence

Source-available under the Keera Community Licence v1.0. Production use by a for-profit or public sector organisation needs a commercial agreement with bespinian GmbH.

About

A handy chat app well integrated into Keera Gateway and its guardrails

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages