Skip to content

feat(website): run the docs chat on D1 and sessions when they're configured - #325

Merged
anurag629 merged 1 commit into
devfrom
feat/docs-bot-d1
Oct 25, 2026
Merged

anurag629 merged 1 commit into
devfrom
feat/docs-bot-d1

Conversation

@anurag629

Copy link
Copy Markdown
Member

T10 for the docs site (F-03 task 14, the bot half). The docs chat is the first real user of the new packages.

  • With a CHATCOPS_DB D1 binding, the chat uses cloudflareStorage({ d1 }), so conversations, rate limits and turn locks hold across every isolate, with 30-day retention. Without the binding, it stays in memory as today. That means this can merge before the database exists.
  • With a CHATCOPS_SESSION_SECRET secret, session tokens are on. requireSession stays false while pre-0.6 widgets are still cached. The new src/pages/api/chat/session.ts route serves /api/chat/session.
  • The website depends on @chatcops/store-cloudflare from the workspace, so it does not wait for the npm publish.
  • cloudflare:workers gets a small type declaration for the one env the page reads.

Two things need the maintainer: creating the D1 database, after which a one-line d1_databases entry goes into wrangler.jsonc in a follow-up, and setting the session secret on the Worker.

Checks: the website builds and typechecks, and lint is at the dev baseline. Locally, astro dev streams a reply on /api/chat without the binding, and /api/chat/session answers 404 with sessions off.

@anurag629
anurag629 merged commit 8a3f9ba into dev Oct 25, 2026
5 checks passed
@anurag629
anurag629 deleted the feat/docs-bot-d1 branch October 25, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant