Run the docs site's chat endpoint on the Cloudflare adapter
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 72/100
- Type d'issue
- Refactorisation
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
Piste de recherche
Read website/src/pages/api/chat.ts and the chatcopsCloudflareHandler adapter from @chatcops/server/cloudflare, then check how locals.runtime.ctx is provided by @astrojs/cloudflare. Replace the endpoint's custom stream handling with the adapter while preserving rate limiting and cf-connecting-ip handling, and configure the site's origin for CORS. Done when OPTIONS and POST return the same origin header and the website build and local chat work as described in the issue.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
The docs site's chat endpoint (website/src/pages/api/chat.ts) builds its own SSE response around handleChat (the POST handler from line 79) instead of using chatcopsCloudflareHandler from @chatcops/server/cloudflare. The site runs on Cloudflare Workers, so it should run the same adapter users do: that way the site tests it, and fixes like #195 (stop the provider when the visitor leaves) don't have to be copied by hand. The OPTIONS handler (line 133) also answers Access-Control-Allow-Origin: * while POST sends no CORS header at all.
What to do
- Build the adapter once per isolate, the same lazy way the file builds the handler today (the API key only exists inside a request through
getSecret), and call it fromPOSTandOPTIONS. - Pass the Workers context so
waitUntilworks. With@astrojs/cloudflare14 it'slocals.cfContext(locals.runtime.ctxwas removed and throws). ogcops does the same insrc/pages/api/og.ts. - Set
corsto the site's own origin (https://chat.codercops.com) instead of*. - Keep the rate limiting and the
cf-connecting-iphandling the file has now.
Acceptance criteria
-
website/src/pages/api/chat.tsno longer has its own stream loop - The chat on the site still works locally with
pnpm --filter @chatcops/website dev(say how you tested it) -
OPTIONSandPOSTsend the sameAccess-Control-Allow-Origin -
pnpm --filter @chatcops/website buildsucceeds - No changeset needed (website only)
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.
- Langage dominant
- TypeScript
- Étoiles
- 13
- Forks
- 7
- Merge moyen
- 3 h 33 min
- PR mergées (30 j)
- 176
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsPeut-être pris @varun-pahuja l’a pris il y a 2 jours. Ouverteenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Type-check the TypeScript samples in the docsPeut-être pris @An16og l’a pris il y a 1 jour. Ouvertedocumentation hacktoberfest help wanted testing
Difficulté 4/5 3-5 jours Accessibilité débutants 70/100
codercops/chatcops#201 · 7 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Hacktoberfest 2026: start hereOuvertehacktoberfest
Difficulté 1/5 Moins d'une heure Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 1 jour
-
help wanted widget
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
codercops/chatcops#55 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de codercops/chatcops
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 76/100
logto-io/logto#9837 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulté 1/5 Moins d'une heure Accessibilité débutants 76/100
lingdojo/kana-dojo#32964 · 1 commentaire · 5 réactions ·
Les mainteneurs répondent en général sous 1 jour
-
Documentation status: needs triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
mastra-ai/mastra#28194 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
priority-low refactor-3
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
Les mainteneurs répondent en général sous 3 jours