Docs: the events page and the CSS variables table don't match the widget
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- markdown, typescript
调研方向
首先阅读 website/src/content/docs/widget/events.mdx(第 59-87 行),并结合所引用范围内的 packages/widget/src/widget.ts(804-809、916-940、988-994、1001-1023)和 packages/widget/src/api/client.ts(205、239-273、280-291),确认 message 和 error 何时触发以及 error.message 值的完整列表;检查 MessageData(在 packages/widget/src/dom/messages.ts 第 10-19 行),了解 sources。然后,将 website/src/content/docs/widget/configuration.mdx(第 388-408 行)中的 CSS 表格替换为指向 theming.mdx(第 49-71 行)中 token 表格的链接。完成的标准是:两个页面都与代码一致,pnpm docs:check 通过,并且你在构建各包并在 website/ 中运行 pnpm dev 后,用 packages/widget/dev.html 验证了事件。
由索引模型根据 Issue 内容生成。
描述
Two widget docs pages describe behavior the code doesn't have.
The events page (website/src/content/docs/widget/events.mdx)
The message section (lines 59 to 75) says the payload is { id, role, content, status?, errorType? }, with status one of 'streaming' | 'complete' | 'error' and four error types. In the code, message fires for a visitor's message when it's sent (deliver() in packages/widget/src/widget.ts, lines 804 to 809) and for a reply once it has finished (lines 988 to 994). It never fires while a reply streams, and it never fires for a failed reply, which fires error only (lines 916 to 940 and 1001 to 1023). So status is undefined on the visitor's message and 'complete' on a reply, and errorType never appears. A reply also carries sources, the pages the answer came from (see MessageData in packages/widget/src/dom/messages.ts, lines 10 to 19). The page leaves that out, though it's handy for analytics.
The error section (lines 77 to 87) only says the payload is an Error. Its message is the kind of failure, built at widget.ts line 937 from what packages/widget/src/api/client.ts yields: errorChunk() maps the server's codes to rate_limit, timeout, budget, budget_daily, unavailable or provider_error (lines 280 to 291), and the stream itself gives cut_off, network or timeout (lines 239 to 273). A server error without a code gives HTTP <status> (line 205). Pressing Stop doesn't fire error (widget.ts line 917). A site needs this list to tell a rate limit from an outage in its own analytics.
The CSS custom properties table (website/src/content/docs/widget/configuration.mdx, lines 388 to 408)
Its "Default" column has the dark theme's values, such as --cc-bg: #0a0a0a, --cc-text: #ffffff and --cc-accent: #6366f1. Light is the default (packages/widget/src/styles/launcher.css, lines 2 to 28). --cc-font and --cc-shadow are also wrong, and six tokens are missing: --cc-on-accent, --cc-accent-contrast, --cc-surface-raised, --cc-danger, --cc-code-bg and --cc-pre-bg. The theming page already has a correct table with both modes (website/src/content/docs/widget/theming.mdx, lines 49 to 71).
What to do
- Rewrite the
messageanderrorsections of the events page from the code: when each one fires, what the payload has, and the list oferror.messagevalues. A short example that sendserror.messageto analytics would help. - Replace the CSS table on the configuration page with a sentence that links to the theming page's token table, so there's only one list to keep current.
Acceptance criteria
- Everything the events page says about
messageanderrormatcheswidget.tsandclient.ts(link the lines in the PR description) - The configuration page links to the theming table instead of repeating it
-
pnpm docs:checkpasses (it type-checks the TypeScript samples) - No changeset (docs only)
How to test
Build the packages (pnpm --filter "./packages/*" build), then run pnpm dev in website/ and read both pages. To watch the events, use packages/widget/dev.html, which already logs message and error to the console. With no backend running, sending a message logs an error whose message is network.
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 #611. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.
- 主要语言
- TypeScript
- 星标
- 13
- 派生
- 7
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 46
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codercops/chatcops 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 25/100
codercops/chatcops#546 · 6 条评论 ·
维护者通常 1 天内回复
-
help wanted widget
难度 4/5 3-5 天 新手友好度 52/100
codercops/chatcops#55 · 42 条评论 ·
维护者通常 1 天内回复
查看 codercops/chatcops 的全部 Issue
相似的 Issue
-
dependencies effort: small good first issue priority: low
难度 1/5 1-3 小时 新手友好度 88/100
TMHSDigital/screencast-mcp#509 ·
维护者通常 1 天内回复
-
from-review tech-debt testing
难度 2/5 1-3 小时 新手友好度 82/100
blamechris/chroxy#9520 ·
维护者通常 1 天内回复
-
area:web complexity:S priority:P2 type:chore
难度 2/5 1-3 小时 新手友好度 84/100
nahuelcostac/agent-hub#104 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
snaglet-org/snaglet#78 ·
维护者通常 1 天内回复
-
agent/guide documentation help wanted stage/010-actionable
难度 1/5 1 小时以内 新手友好度 82/100
kubestellar/console-marketplace#1101 ·
维护者通常 1 天内回复