Run the docs site's chat endpoint on the Cloudflare adapter
維護者通常 1 天內回覆
@Pratham2511 已經在處理了。
開始於 2026年10月21日。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 72/100
- Issue 類型
- 重構
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- TypeScript
- 星號
- 13
- 分支
- 7
- 平均合併
- 3 小時 41 分鐘
- 30 天內合併 PR
- 155
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
codercops/chatcops 的其他 Issue
-
Document the pre-chat form可能已有人在做 @masyarakatai 於 5 天前認領。 未關閉documentation good first issue hacktoberfest widget
難度 2/5 1-3 小時 新手友好度 88/100
codercops/chatcops#70 · 5 則留言 ·
維護者通常 1 天內回覆
-
docs: update the providers page for openai-compatible, registerProvider and provider imports可能已有人在做 @prakashNalla 今天認領。 未關閉documentation good first issue hacktoberfest website
難度 3/5 1-2 天 新手友好度 76/100
codercops/chatcops#291 · 1 則留言 ·
維護者通常 1 天內回覆
-
docs: add a protocol reference page for custom clients可能已有人在做 @kachamsiddarth 於 1 天前認領。 未關閉documentation good first issue hacktoberfest website
codercops/chatcops#286 · 2 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Create @chatcops/store-cloudflare (D1, KV and a Durable Object counter)可能已有人在做 @bhushan4work 今天認領。 未關閉enhancement hacktoberfest help wanted server
難度 5/5 一週以上 新手友好度 25/100
codercops/chatcops#249 · 2 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Create @chatcops/store-sqlite, a store for single-server setups可能已有人在做 @srikar-naidu 於 1 天前認領。 未關閉enhancement hacktoberfest help wanted server
難度 5/5 一週以上 新手友好度 35/100
codercops/chatcops#247 · 3 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 codercops/chatcops 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
kunchenguid/gh-axi#220 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 79/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
prerender: wait for env-runner worker readiness before crawling可能已有人在做 @sarankumar1325 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆