forked from zsio/claude-code-hub
-
Notifications
You must be signed in to change notification settings - Fork 142
release v0.4.3 #628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ding113
wants to merge
22
commits into
main
Choose a base branch
from
dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
release v0.4.3 #628
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4dad830
fix: 清理 usage-doc / big-screen i18n 硬编码 + 修复 Next.js params Promise 报错
YangQing-Lin 84c8ce6
feat(leaderboard): add user tag and group filters for user ranking (#…
ding113 58c262b
feat(leaderboard): add tag/group suggestions dropdown for better UX
ding113 6a9e51d
docs: update Privnode offer details in README files
ding113 c9f3a3a
fix: 修复 1M 上下文标头兼容问题
ding113 ac92b09
fix: resolve container name conflicts in multi-user environments (#625)
SaladDay 472cfd4
feat(dashboard): improve user management, statistics reset, and i18n …
miraserver 745df9b
feat(my-usage): cache statistics and timezone fixes (#623)
miraserver 1cd0877
fix: Set HOSTNAME environment variable in Dockerfile (#622)
yllhwa 09901db
fix: inherit 1M flag from client
ding113 24aa513
fix(my-usage): make date range DST-safe
ding113 2305736
test(api): cover leaderboard comma-list parsing
ding113 e37b8d3
fix(auth): avoid hardcoded server error fallback
ding113 b72edd7
fix(actions): localize key quota permission errors
ding113 af4a08d
docs: clarify context 1M inherit behavior
ding113 62e0c69
test(settings): fix model multi-select messages loader
ding113 8884820
test(dashboard): provide QueryClientProvider in edit key form test
ding113 f625975
chore(scripts): avoid hardcoded docker container names
ding113 17fad8b
fix(i18n): replace fullwidth parentheses in ja dashboard
ding113 dab9b50
fix(ui): add a11y label and clean up dialog styles
ding113 4279202
chore: ignore tmp scratch directory
ding113 d9e85ac
feat: Dashboard Logs:秒级时间筛选 + Session ID 精确筛选/联想/展示(含回归修复) (#611)
YangQing-Lin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # Dashboard Logs(Usage Logs)入口与调用链盘点 | ||
|
|
||
| 本文用于锁定 `/dashboard/logs` 的真实入口与关键调用链边界,避免后续需求实现与验收口径跑偏。 | ||
|
|
||
| ## 1) 路由入口(Server) | ||
|
|
||
| - 路由:`/dashboard/logs` | ||
| - 入口页面:`src/app/[locale]/dashboard/logs/page.tsx` | ||
| - 登录态校验:`getSession()`(未登录重定向到 `/login`) | ||
| - 数据区块入口:`UsageLogsDataSection`(`src/app/[locale]/dashboard/logs/_components/usage-logs-sections.tsx`) | ||
|
|
||
| ## 2) 真实渲染链路(Client) | ||
|
|
||
| 当前页面实际使用“虚拟列表”链路: | ||
|
|
||
| - 虚拟列表入口:`UsageLogsViewVirtualized`(`src/app/[locale]/dashboard/logs/_components/usage-logs-view-virtualized.tsx`) | ||
| - URL -> filters 解析:`parseLogsUrlFilters()`(`src/app/[locale]/dashboard/logs/_utils/logs-query.ts`) | ||
| - filters -> URL 回填:`buildLogsUrlQuery()`(`src/app/[locale]/dashboard/logs/_utils/logs-query.ts`) | ||
| - Filters 面板:`UsageLogsFilters` | ||
| - 列表:`VirtualizedLogsTable` | ||
| - 统计面板:`UsageLogsStatsPanel` | ||
|
|
||
| 仓库内仍存在“非虚拟表格”实现(目前不被路由引用,属于历史/备用路径): | ||
|
|
||
| - `UsageLogsView`(`src/app/[locale]/dashboard/logs/_components/usage-logs-view.tsx`) | ||
| - `UsageLogsTable`(`src/app/[locale]/dashboard/logs/_components/usage-logs-table.tsx`) | ||
|
|
||
| ## 3) 过滤器 / URL / 时间语义 | ||
|
|
||
| - URL 参数解析/构建(统一入口):`src/app/[locale]/dashboard/logs/_utils/logs-query.ts` | ||
| - `sessionId`:字符串(trim 后空值不落盘) | ||
| - `startTime/endTime`:毫秒时间戳 | ||
| - 秒级时间工具:`src/app/[locale]/dashboard/logs/_utils/time-range.ts` | ||
| - UI endTime 为“包含式”秒;对后端转换为“排他上界”(`endExclusive = endInclusive + 1s`) | ||
| - 后端查询语义保持:`created_at >= startTime` 且 `created_at < endTime` | ||
|
|
||
| ## 4) 数据获取链路(Actions -> Repository) | ||
|
|
||
| ### 列表(无限滚动) | ||
|
|
||
| - Action:`src/actions/usage-logs.ts#getUsageLogsBatch` | ||
| - Repo:`src/repository/usage-logs.ts#findUsageLogsBatch` | ||
|
|
||
| ### 统计(折叠面板按需加载) | ||
|
|
||
| - Action:`src/actions/usage-logs.ts#getUsageLogsStats` | ||
| - Repo:`src/repository/usage-logs.ts#findUsageLogsStats` | ||
|
|
||
| ### 导出 CSV | ||
|
|
||
| - Action:`src/actions/usage-logs.ts#exportUsageLogs` | ||
| - Repo:`src/repository/usage-logs.ts#findUsageLogsWithDetails` | ||
| - CSV 生成:`src/actions/usage-logs.ts#generateCsv` | ||
|
|
||
| ### Session ID 联想(候选查询) | ||
|
|
||
| - Action:`src/actions/usage-logs.ts#getUsageLogSessionIdSuggestions` | ||
| - Repo:`src/repository/usage-logs.ts#findUsageLogSessionIdSuggestions` | ||
|
|
||
| #### 匹配语义与边界(2026-01-15 更新) | ||
|
|
||
| - **前端约束**: | ||
| - 最小长度:`SESSION_ID_SUGGESTION_MIN_LEN`(`src/lib/constants/usage-logs.constants.ts`) | ||
| - 最大长度截断:`SESSION_ID_SUGGESTION_MAX_LEN`(`src/actions/usage-logs.ts` 内对输入 trim 后截断) | ||
| - 每次返回数量:`SESSION_ID_SUGGESTION_LIMIT` | ||
| - **后端匹配**: | ||
| - 语义:仅支持「字面量前缀匹配」(`term%`),不再支持包含匹配(`%term%`) | ||
| - 安全:输入中的 `%` / `_` / `\\` 会被统一转义,避免被当作 LIKE 通配符 | ||
| - SQL(核心条件):`session_id LIKE '<escapedTerm>%' ESCAPE '\\'` | ||
| - 转义实现:`src/repository/_shared/like.ts#escapeLike` | ||
| - **行为变更示例**: | ||
| - 之前:输入 `abc` 可能命中 `xxxabcxxx`(包含匹配) | ||
| - 之后:仅命中 `abc...`(前缀匹配) | ||
| - 之前:输入 `%` / `_` 可主动触发通配 | ||
| - 之后:`%` / `_` 按字面量处理(例如输入 `%a` 只匹配以 `%a` 开头的 session_id) | ||
|
|
||
| #### 索引与迁移(前缀匹配性能) | ||
|
|
||
| - 已有索引:`idx_message_request_session_id`(`message_request.session_id`,partial: `deleted_at IS NULL`) | ||
| - 新增索引(前缀匹配):`idx_message_request_session_id_prefix` | ||
| - opclass:`varchar_pattern_ops` | ||
| - partial:`deleted_at IS NULL AND (blocked_by IS NULL OR blocked_by <> 'warmup')` | ||
| - 迁移文件:`drizzle/0055_neat_stepford_cuckoos.sql` | ||
|
|
||
| ## 5) 本需求相关影响面(文件/符号清单) | ||
|
|
||
| **前端(logs 页面内聚)**: | ||
|
|
||
| - URL/过滤器:`src/app/[locale]/dashboard/logs/_utils/logs-query.ts` | ||
| - 秒级时间:`src/app/[locale]/dashboard/logs/_utils/time-range.ts` | ||
| - 过滤器 UI:`src/app/[locale]/dashboard/logs/_components/usage-logs-filters.tsx` | ||
| - 虚拟列表:`src/app/[locale]/dashboard/logs/_components/virtualized-logs-table.tsx` | ||
| - 非虚拟表格:`src/app/[locale]/dashboard/logs/_components/usage-logs-table.tsx` | ||
| - 统计面板:`src/app/[locale]/dashboard/logs/_components/usage-logs-stats-panel.tsx` | ||
|
|
||
| **后端(Actions/Repo)**: | ||
|
|
||
| - Actions:`src/actions/usage-logs.ts` | ||
| - `getUsageLogsBatch/getUsageLogsStats/exportUsageLogs/getUsageLogSessionIdSuggestions` | ||
| - Repo:`src/repository/usage-logs.ts` | ||
| - `findUsageLogsBatch/findUsageLogsWithDetails/findUsageLogsStats/findUsageLogSessionIdSuggestions` | ||
|
|
||
| **i18n(用户可见文案)**: | ||
|
|
||
| - `messages/*/dashboard.json`(`dashboard.logs.filters.*` / `dashboard.logs.columns.*`) | ||
|
|
||
| ## 6) 边界说明(在范围内 / 不在范围内) | ||
|
|
||
| 在范围内(本次需求直接相关): | ||
|
|
||
| - `sessionId` 精确筛选 + URL 回填 + UI 展示(列/复制/tooltip) | ||
| - 秒级时间输入与 `endExclusive` 语义对齐(`< endTime`) | ||
| - Session ID 联想(最小成本:minLen + debounce + limit) | ||
|
|
||
| 不在范围内(需另开 issue/评审确认后再做): | ||
|
|
||
| - 针对联想查询的索引/物化/离线表(优化类工程) | ||
| - 大规模改动数据库 schema 或重建索引策略(例如 CONCURRENTLY/离线重建) | ||
| - Logs 页面其它过滤项语义调整(非本需求验收口径) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Error Session ID Guide | ||
|
|
||
| When reporting an API error, include the CCH session id so maintainers can locate the exact request. | ||
|
|
||
| ## Where to find it | ||
|
|
||
| 1. **Preferred**: response header `x-cch-session-id` | ||
| 2. **Fallback**: `error.message` suffix `cch_session_id: <id>` | ||
|
|
||
| If the response does not include a session id, the server could not determine it for that request. | ||
|
|
||
| ## Example (curl) | ||
|
|
||
| ```bash | ||
| curl -i -sS \\ | ||
| -H "Authorization: Bearer <your-key>" \\ | ||
| -H "Content-Type: application/json" \\ | ||
| -d '{"model":"gpt-4.1-mini","messages":[{"role":"user","content":"hi"}]}' \\ | ||
| http://localhost:13500/v1/chat/completions | ||
| ``` | ||
|
|
||
| In the response: | ||
|
|
||
| - Check header: `x-cch-session-id: ...` | ||
| - If missing, check JSON: `{"error":{"message":"... (cch_session_id: ...)"} }` | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| CREATE INDEX IF NOT EXISTS "idx_message_request_session_id_prefix" ON "message_request" USING btree ("session_id" varchar_pattern_ops) WHERE "message_request"."deleted_at" IS NULL AND ("message_request"."blocked_by" IS NULL OR "message_request"."blocked_by" <> 'warmup'); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.