feat(onboarding): trial credit + client tutorials + wallet B2C hints - #4
Merged
Conversation
Closes the three biggest gaps between signup and first-successful-call identified in the user-journey audit. Existing PRs (#1–#3) shipped the end-user-facing surfaces; this PR closes the funnel. 4.B — Trial credit on signup: - All the wiring already existed (model/user.go:410 sets `user.Quota = common.QuotaForNewUser` inside Insert, line 441 logs "新用户注册赠送" when QuotaForNewUser > 0). The default was 0. - Bump common.QuotaForNewUser from 0 → 500_000 (= $1 USD = ~500K tokens ≈ 200 chats of average cost). Operators who don't want trial credits can override to 0 in System Settings → Operations, same as today. - No new endpoint, no migration. Comment explains the rationale. 4.A — Client tutorial pages at /onboarding/{slug}: - The Key creation Success Dialog (shipped in PR #2) links 6 client chips to /onboarding/{cherry-studio,chatbox,lobechat,cursor, claude-code,code} — those routes 404'd. Users got a key and got stuck. - New dynamic route `/onboarding/$slug` + new feature dir `features/onboarding/` with 6 tutorial modules. Each tutorial is a TS module exposing a per-language markdown body (en + zh) so we can interpolate the current base URL + recommended model name at render time. - Page layout: breadcrumb back to /keys, header card (icon + label + description + "Try in Playground" CTA + "Recommended" badge for Cherry Studio), top-of-page Base URL + Model copy block, then the markdown body via the existing components/ui/markdown.tsx renderer (react-markdown + remarkGfm + rehypeRaw). - All 6 tutorials ship text-only steps. Screenshots are tagged as a follow-up for platform team — markdown is the single source of truth so they slot in without code changes. 4.C — Wallet / topup B2C hints: - New lib/usage-estimate.ts: estimateChats/estimateImages/ estimateVideoClips/estimateAudioMinutes — quota→human-friendly counts using mid-tier-model averages. Marketing-grade estimates, not billing-grade. - WalletStatsCard: "Current Balance" sub-label changed from "Remaining quota" to "≈ 200 chats remaining". Zero-balance state shows "Top up to start using AI models". - RechargeFormCard preset buttons get a third line: "≈ 6k chats" derived from preset.value. Helps non-tech users gauge value at a glance. - Wallet page hero description rewritten to mention trial credit. i18n: 17 new en + zh keys for tutorial framing, recharge hints, and balance descriptions. Auto-sorted alphabetically. Reuse (no duplication): - components/ui/markdown.tsx::Markdown - routes/about/ pattern (single-file route → feature component) - lib/format.ts::formatQuota for currency display Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
7 tasks
hades217
added a commit
that referenced
this pull request
May 16, 2026
Sprint 3 — final B2C polish on the three remaining surfaces.
6.B Pricing page ratio cleanup:
- Hide `{ratio}x` multipliers from the per-group pricing table and
pricing breakdown for non-admin users (features/pricing/components/
model-details.tsx). Same useIsAdmin gate pattern as Create Key form
+ Usage Logs. Final per-token prices stay visible — only the
multiplier (operator concept) is hidden.
- pricing-sidebar.tsx filter chips no longer append "x1.2" suffixes
to group names for non-admin viewers.
6.A Dashboard hero:
- summary-cards.tsx hero block: title "Usage at a glance" → "Your AI
usage"; description rewritten in plain language. Credit-remaining
card replaces "Displayed in CNY" technical sub-label with friendly
"≈ 200 chats remaining" estimate (or "Top up to start using AI
models." when balance is zero). Math is inlined since this PR is
branched independently of PR #4's lib/usage-estimate.ts — they'll
produce identical content when both merge.
6.D First-call celebration:
- Pure frontend, no backend `first_call_at` field needed. SummaryCards
useEffect watches user.request_count; when it flips from 0 to 1+ on
any dashboard mount, fires a single sonner toast "🎉 Your first API
call worked!" + sets localStorage flag `dr_first_call_celebrated`
so it never repeats per browser.
- Acknowledges the magic moment regardless of where the user made
the call (Cherry Studio, Cursor, curl, Playground).
6.C Recharge history polish:
- billing-history-dialog.tsx empty state copy differentiates "no
search results" (keyword present) from "you haven't recharged yet"
(first-time user). Friendlier than the generic "No billing records
found".
i18n: 8 new en + zh keys.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
打通 B2C funnel 的 3 个最大堵点(注册 → 充值 → 创建 Key → 接入客户端 → 首次成功调用)。PR #1-#3 收口了已有界面;这个 PR 补完后续步骤。
4.B 注册赠送试用额度(半天)
机制其实已经全部存在 ——
model/user.go:410在 Insert 里设置user.Quota = common.QuotaForNewUser,line 441 也已经写好"新用户注册赠送 ¥X"日志。唯一缺的就是默认值 0。把
common.QuotaForNewUser默认从0改成500_000(= $1 USD ≈ 500K token ≈ 200 次平均对话)。运营可以在 System Settings → Operations 改回 0。4.A 客户端教程页(4 天)
PR #2 的 Success Dialog 里 6 个 chip 链向
/onboarding/{cherry-studio,chatbox,lobechat,cursor,claude-code,code}这些路由根本不存在,用户拿到 key 立刻 404。新增:
/onboarding/$slugfeatures/onboarding/目录 + 6 个 TS 教程模块(每个都是 en+zh markdown body 函数,渲染时插入当前 base URL 和推荐模型名)components/ui/markdown.tsx)4.C 钱包 / 充值 B2C 提示(3 天)
lib/usage-estimate.ts:estimateChats / estimateImages / estimateVideoClips / estimateAudioMinutes—— quota → "约能聊 N 次"友好换算(基于中等模型均价,营销级而非账单级精度)i18n: 17 个新 en + zh key。
Test plan
bun run typecheck通过bunx eslint <touched>0 error / 0 warning文件清单
修改(7 file):
common/constants.go—QuotaForNewUser = 500_000web/default/src/features/wallet/index.tsx— hero descriptionweb/default/src/features/wallet/components/wallet-stats-card.tsx— chats-remaining 副标题web/default/src/features/wallet/components/recharge-form-card.tsx— preset 第三行web/default/src/i18n/locales/{en,zh}.json— 17 keysweb/default/src/routeTree.gen.ts— TanStack Router regen新增(10 file):
web/default/src/lib/usage-estimate.tsweb/default/src/features/onboarding/index.tsxweb/default/src/features/onboarding/tutorials/registry.tsweb/default/src/features/onboarding/tutorials/{cherry-studio,chatbox,lobechat,cursor,claude-code,code}.tsweb/default/src/routes/onboarding/\$slug.tsx17 files changed.
🤖 Generated with Claude Code