Run the docs site's chat endpoint on the Cloudflare adapter
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Refactoring
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 13
- Forks
- 7
- Ø Merge
- 3 Std. 33 Min.
- Gemergte PRs (30 T.)
- 176
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsEvtl. vergeben @varun-pahuja hat das vor 2 Tagen übernommen. Offenenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Type-check the TypeScript samples in the docsEvtl. vergeben @An16og hat das vor 2 Tagen übernommen. Offendocumentation hacktoberfest help wanted testing
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 70/100
codercops/chatcops#201 · 7 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
hacktoberfest
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
-
Add built-in translations to the widgetEvtl. vergeben @piyusshhjangid hat das vor 1 Tag übernommen. Offenhelp wanted widget
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
codercops/chatcops#55 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in codercops/chatcops
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
db-ux-design-system/core-web#8613 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug:new
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
callstackincubator/simlock#934 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
gchq/LD-Explorer#286 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
foxglove/mcap#1907 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag