Skip to content

feat(b2c): usage-logs ratio cleanup + playground empty state - #5

Merged
hades217 merged 1 commit into
mainfrom
feat/logs-playground-b2c
May 16, 2026
Merged

feat(b2c): usage-logs ratio cleanup + playground empty state#5
hades217 merged 1 commit into
mainfrom
feat/logs-playground-b2c

Conversation

@hades217

Copy link
Copy Markdown

Summary

Sprint 2 — 给已经走通 funnel 的用户做质量/正确性补救。

5.A Usage Logs B2C 改造

  • 调用日志 Token 列副标题里的"5x"倍率,只 admin 看得到(非 admin 完全不显示 group + ratio)
  • 详情弹窗里"Group Ratio"那行也对非 admin 隐藏,但最终扣费的金额行保留
  • 侧边栏 "Usage Logs" 改 "Call history" / "调用记录",对终端用户更友好

5.B Playground 空状态

Test plan

  • bun run typecheck 通过
  • bunx eslint 通过
  • 普通用户 /usage-logs/common:每行 Token 名下面没有"5x",点详情看到 cost 但看不到 Group Ratio 行
  • Admin 用户:仍能看到全部
  • 侧边栏第二块 console 区显示"调用记录"
  • /playground 空状态:6 张建议卡片
  • 点其中一张:消息发出去,对话开始

文件

修改:

  • web/default/src/features/usage-logs/components/columns/common-logs-columns.tsx — useIsAdmin gate
  • web/default/src/features/usage-logs/components/dialogs/details-dialog.tsx — Group Ratio gate
  • web/default/src/hooks/use-sidebar-data.ts — label
  • web/default/src/features/playground/index.tsx — empty state branch
  • web/default/src/i18n/locales/{en,zh}.json — 15 keys

新增:

  • web/default/src/features/playground/components/playground-empty-state.tsx

🤖 Generated with Claude Code

5.A — Usage Logs B2C transformation:
- Hide group/ratio metadata from per-row Token column for non-admin
  users. Operators get full breakdown (group + Nx); non-admin sees just
  the token name. Previously "5x" ratio leaked into all users' sub-
  label rows.
- In the per-request Detail dialog, gate the "Group Ratio" /
  "User Exclusive Ratio" rows by isAdmin. Final cost row stays visible
  so users still understand what they were charged.
- Sidebar nav: "Usage Logs" → "Call history" — friendlier, matches
  what end users mentally call it.

5.B — Playground empty state:
- New PlaygroundEmptyState component with 6 click-to-send suggestion
  chips (Say hello / Translate / Write code / Brainstorm / etc).
  Renders when messages.length === 0 instead of the blank chat
  scroller. Casual persona (which lands here from PR #3's default
  route) gets a clear "what can I help with" affordance instead of
  staring at an empty void.
- Click → handleSendMessage(prompt). No input pre-fill; matches
  modern chat-UI conventions (ChatGPT, Claude.ai, Cursor all do this).

15 new en + zh i18n keys.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@hades217
hades217 merged commit 0855892 into main May 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant