mirror of
https://github.com/bitbaum/heidi.git
synced 2026-12-04 04:57:24 +01:00
* A capped paid fallback when every free model is busy; turn outcomes in health HEIDI_FALLBACK_MODELS names models on the OpenRouter key that answer for everybody after the named free models and before the weak routed one. Off until named; then under ai-kit's kill switch, Heidi's opt-in and the daily paid caps, like the pass model. Its own provider id, because ai-kit drops a vendor's remaining links after a daily refusal, which is exactly when this row is needed. Never pickable or preferred. /api/health adds ai.turns: answered and failed since restart. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r * Dock: offer to keep the conversation after three messages A dock conversation lives only in the browser, and the open chat stores nothing, so a learner who returns cannot be told from a new one and loses the thread on another device. After three learner messages one line says so and links to the full chat, which already adopts a draft into the account or offers sign-in. Measured on a Pixel 7 viewport in de, fr, ru: no overflow. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r * Translate: a compact prompt and a smaller reply budget A free model accepts ~8,000 tokens a minute and a request counts its prompt plus the reply it reserves. With the full 16,700-character prompt and 2,400 reply tokens that is one request per model per minute. translatePrompt keeps the forms never to mix in, the spelling convention, the auxiliaries and the same JSON envelope, and drops what a translation never offers (grammar topics, next moves, tones, the written standard as a second variety): 2,767 characters plus the 1,345-character instruction, with a 1,400-token reply. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r * «Nur übersetzen» under the newest answer only Seen on a phone-sized screenshot: the button repeated under every earlier answer of the dock, each one resending an old line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
138 lines
6.9 KiB
Bash
138 lines
6.9 KiB
Bash
# Secrets and settings this app reads at runtime. Copy to .env and fill in.
|
|
# Values live on the Hetzner box (/home/g/dev/<app>/.env), never in git.
|
|
DATABASE_URL=
|
|
# Models. The chat walks @bitbaum/ai-kit's free chain and uses every link it
|
|
# has a key for: GROQ_API_KEY first, then OPENROUTER_API_KEY. With neither, the
|
|
# chat says the language model is not set up on this deployment.
|
|
# GROQ_API_KEY is also the microphone: dictation in the chat and the
|
|
# transcript of a Standard German take on /speaking (lib/domain/model/speech.ts).
|
|
# Without it nothing is transcribed, and the pages say so.
|
|
# GEMINI_API_KEY is read-aloud from the server, for a device with no German
|
|
# voice of its own (lib/voice/server-tts.ts). Without it only the browser's
|
|
# voice is used.
|
|
GROQ_API_KEY=
|
|
OPENROUTER_API_KEY=
|
|
GEMINI_API_KEY=
|
|
# The model a pass buys (docs/payments.md). Off until all of these are set:
|
|
# HEIDI_PASS_MODELS names model ids at OpenRouter, in order, tried first for a
|
|
# pass holder and paid from OPENROUTER_API_KEY. AI_PAID_DISABLED=0 turns the
|
|
# fleet's kill switch off and HEIDI_AI_PAID_OK=1 opts Heidi in; both are
|
|
# @bitbaum/ai-kit's rules. HEIDI_DAILY_PAID_CALLS caps the paid calls of a day.
|
|
HEIDI_PASS_MODELS=
|
|
# The paid fallback (lib/domain/model/pass-model.ts): model ids at OpenRouter,
|
|
# asked for EVERYBODY when every free model is busy, before the weak routed
|
|
# one. Under the same switch, opt-in and daily caps as the pass model.
|
|
HEIDI_FALLBACK_MODELS=
|
|
AI_PAID_DISABLED=
|
|
HEIDI_AI_PAID_OK=
|
|
HEIDI_DAILY_PAID_CALLS=
|
|
# The grammar service for a transcribed take: a LanguageTool server of our
|
|
# own. Unset, @bitbaum/speechkit asks http://127.0.0.1:8010.
|
|
LANGUAGETOOL_URL=
|
|
NEXT_PUBLIC_FC_WIDGET_TOKEN=
|
|
# Channels (lib/channels). The hourly sweep (/api/cron/channels) runs only with
|
|
# CRON_SECRET; without it the channels page refreshes a person's own channels
|
|
# inline. Web Push needs a VAPID pair: `npx web-push generate-vapid-keys`.
|
|
# VAPID_SUBJECT is a mailto: or https: URL the push services may contact.
|
|
CRON_SECRET=
|
|
VAPID_PUBLIC_KEY=
|
|
VAPID_PRIVATE_KEY=
|
|
VAPID_SUBJECT=
|
|
# The fleet's chat-review loop. One shared secret, the same value in every
|
|
# product's env on the box (Loki's share-chat-review-token.yml writes it);
|
|
# Loki reads GET /api/chat/review-export with it each night. Unset, the
|
|
# export answers 503 and nothing is read.
|
|
CHAT_REVIEW_TOKEN=
|
|
# Accounts (@bitbaum/accountkit). BETTER_AUTH_SECRET signs sessions; without it
|
|
# (or without DATABASE_URL) the sign-in control is hidden. Generate once with
|
|
# `openssl rand -base64 48`.
|
|
BETTER_AUTH_SECRET=
|
|
# Account mail through @bitbaum/mail-kit: "Forgot your password?", the email
|
|
# sign-in link and the address check. Unset (or a placeholder key), the sign-in
|
|
# page offers none of them. RESEND_API_KEY is the fleet's shared Resend key.
|
|
# RESEND_FROM is optional and pins the From line. Unset, Heidi asks the mail
|
|
# service which domains this key has verified and sends from its own
|
|
# (heidi.orangecat.ch, then orangecat.ch) once one is; until then mail goes
|
|
# out through the fleet's shared sender domain (lib/auth/sender.ts).
|
|
# GET /api/health reports which is in use. A resend.dev sandbox sender counts
|
|
# as unconfigured in production.
|
|
# MAIL_ADDRESS is optional and sets Reply-To. Unset, replies go to the contact
|
|
# address in lib/config/site.ts, because Heidi's own host receives no mail.
|
|
RESEND_API_KEY=
|
|
RESEND_FROM=
|
|
MAIL_ADDRESS=
|
|
|
|
# Paying Heidi (docs/payments.md). The button on /pass that opens Heidi's
|
|
# public OrangeCat page needs none of these.
|
|
# ORANGECAT_PAY_ENTITY_ID is the OrangeCat entity that is paid and
|
|
# ORANGECAT_PAY_ENTITY_TYPE its kind; unset, they are Heidi's own project.
|
|
#
|
|
# The AUTOMATIC PASS through @bitbaum/paykit is OFF until at least one price
|
|
# is set (whole sats; a pass with no price is not sold). /pass then says it is
|
|
# not switched on and no route creates anything.
|
|
# ORANGECAT_API_KEY is an ock_… integration key (scopes payments.write and
|
|
# payments.read), minted at https://orangecat.ch/settings/integrations.
|
|
# Optional: without it, and whenever the key's owner is the payee, paykit uses
|
|
# OrangeCat's account-less payment call.
|
|
# ORANGECAT_WEBHOOK_SECRET is the ock_whk_… secret OrangeCat shows once when
|
|
# the endpoint https://heidi.orangecat.ch/api/pay/webhook is registered there
|
|
# for the event payment.settled. Without it the checkout page's own poll
|
|
# still settles.
|
|
ORANGECAT_PAY_ENTITY_ID=
|
|
ORANGECAT_PAY_ENTITY_TYPE=
|
|
ORANGECAT_API_KEY=
|
|
ORANGECAT_WEBHOOK_SECRET=
|
|
HEIDI_PASS_30_SATS=
|
|
HEIDI_PASS_365_SATS=
|
|
# Paying in francs: card, TWINT and whatever else the Stripe account has
|
|
# switched on (docs/payments.md). Off until the key and one CHF price are set.
|
|
# Prices in francs: 12 or 12.50. The webhook endpoint is
|
|
# /api/pay/webhook/stripe, events checkout.session.completed and
|
|
# checkout.session.async_payment_succeeded; without its secret a pass starts
|
|
# when the buyer is back on Heidi's checkout page.
|
|
STRIPE_SECRET_KEY=
|
|
STRIPE_WEBHOOK_SECRET=
|
|
HEIDI_PASS_30_CHF=
|
|
HEIDI_PASS_365_CHF=
|
|
# Free questions a day without a pass or an own key (default 100; 0 = no
|
|
# daily allowance). A pass gives three times as many.
|
|
HEIDI_FREE_TURNS_PER_DAY=
|
|
|
|
# The owner's numbers (GET /api/owner/numbers) and the owner's pass codes
|
|
# (/owner/pass-codes, docs/payments.md) answer 404 to everybody until
|
|
# one of these names the owner. OWNER_ACTOR_IDS is a comma-separated list of
|
|
# account ids; OWNER_EMAILS a list of addresses, which count only once the
|
|
# account's address is confirmed. See lib/domain/owner/gate.ts.
|
|
OWNER_ACTOR_IDS=
|
|
OWNER_EMAILS=
|
|
|
|
# Not read by the app. scripts/verify-dialect-asr.mjs, a one-off measurement
|
|
# of a dialect speech-to-text vendor, takes SPEECH_API_KEY (a live key),
|
|
# SPEECH_API_URL and SPEECH_DIALECT from the shell that runs it.
|
|
|
|
# Media (lib/media/variants.mjs). Photographs are served from object storage
|
|
# (Cloudflare R2, S3-compatible), in sizes rendered once, so the app box does
|
|
# no image work. The sources stay in public/photos.
|
|
#
|
|
# ON THE BOX, NOTHING IS RUN BY HAND. Give the bucket a public domain and put
|
|
# the four PHOTOS_S3_* settings and MEDIA_PUBLIC_BASE (that domain, without
|
|
# /photos) in /opt/fleet/env. Every deploy's `SELF_HOST=1 pnpm run build` then
|
|
# runs scripts/media/ensure.mjs first: it uploads the variants the bucket
|
|
# lacks (one at a time, low memory), fetches one through MEDIA_PUBLIC_BASE,
|
|
# and only on a 200 image writes NEXT_PUBLIC_MEDIA_BASE into the git-ignored
|
|
# .env.production.local, which turns the custom loader on. Anything missing
|
|
# or failing: one line in the build log, and the box serves the photos as
|
|
# before. The build never fails because of media.
|
|
#
|
|
# NEXT_PUBLIC_MEDIA_BASE set explicitly is an override: ensure.mjs leaves it
|
|
# alone and the site is built against it. By hand, from a laptop:
|
|
# node scripts/media/upload-photos.mjs # dry run
|
|
# node scripts/media/upload-photos.mjs --upload # idempotent
|
|
PHOTOS_S3_ENDPOINT=
|
|
PHOTOS_S3_BUCKET=
|
|
PHOTOS_S3_ACCESS_KEY_ID=
|
|
PHOTOS_S3_SECRET_ACCESS_KEY=
|
|
PHOTOS_S3_REGION=
|
|
MEDIA_PUBLIC_BASE=
|
|
NEXT_PUBLIC_MEDIA_BASE=
|