Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Run the docs site's chat endpoint on the Cloudflare adapter

未關閉
#202 5 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@Pratham2511 已經在處理了。

開始於 2026年10月21日。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
72/100
Issue 類型
重構
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
typescript
領域
api, backend

研究方向

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 內容生成。

描述

hacktoberfest help wanted website

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 from POST and OPTIONS.
  • Pass the Workers context so waitUntil works. With @astrojs/cloudflare 14 it's locals.cfContext (locals.runtime.ctx was removed and throws). ogcops does the same in src/pages/api/og.ts.
  • Set cors to the site's own origin (https://chat.codercops.com) instead of *.
  • Keep the rate limiting and the cf-connecting-ip handling the file has now.

Acceptance criteria

  • website/src/pages/api/chat.ts no 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)
  • OPTIONS and POST send the same Access-Control-Allow-Origin
  • pnpm --filter @chatcops/website build succeeds
  • 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

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

codercops/chatcops 的其他 Issue

查看 codercops/chatcops 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。