Run the docs site's chat endpoint on the Cloudflare adapter
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 72/100
- Tipo de issue
- Refatoração
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 13
- Forks
- 7
- Merge médio
- 3h 33min
- PRs com merge (30d)
- 176
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsTalvez já em andamento @varun-pahuja assumiu há 3 dias. Abertaenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Type-check the TypeScript samples in the docsTalvez já em andamento @An16og assumiu há 2 dias. Abertadocumentation hacktoberfest help wanted testing
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 70/100
codercops/chatcops#201 · 7 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
hacktoberfest
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
-
Add built-in translations to the widgetTalvez já em andamento @piyusshhjangid assumiu há 1 dia. Abertahelp wanted widget
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 52/100
codercops/chatcops#55 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de codercops/chatcops
Issues semelhantes
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 82/100
source-cooperative/docs.source.coop#41 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Nimblesite/SharpLsp#468 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
solidjs-community/solid-primitives#1082 ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia