Skip to content

Work - #5972

Closed
zhaibingye wants to merge 8 commits into
QuantumNous:mainfrom
zhaibingye:work
Closed

Work#5972
zhaibingye wants to merge 8 commits into
QuantumNous:mainfrom
zhaibingye:work

Conversation

@zhaibingye

@zhaibingye zhaibingye commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • New Features

    • Added a credits/usage page endpoint and dashboard support for viewing quota in credits.
    • Improved Gemini model listing so model details appear in a more complete, native format.
    • Added time-range controls and per-user saved preferences in the dashboard.
  • Bug Fixes

    • Fixed models endpoint handling for Gemini requests.
    • Improved dashboard data refresh behavior when changing time granularity.
  • Documentation

    • Updated README files and installation notes for the forked project and new startup instructions.

@zhaibingye zhaibingye closed this Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f905dc8b-10b3-4ab3-b447-b606e5546af0

📥 Commits

Reviewing files that changed from the base of the PR and between becc18e and 3d557b5.

📒 Files selected for processing (31)
  • .github/workflows/docker-build.yml
  • .github/workflows/docker-hub-user.yml
  • .github/workflows/docker-image-branch.yml
  • .github/workflows/electron-build.yml
  • .github/workflows/pr-check.yml
  • .github/workflows/release.yml
  • AGENTS.md
  • README.en.md
  • README.fr.md
  • README.ja.md
  • README.md
  • README.zh_CN.md
  • README.zh_TW.md
  • controller/billing.go
  • controller/billing_test.go
  • controller/channel-billing.go
  • controller/model.go
  • controller/model_list_test.go
  • docker-compose.yml
  • docs/installation/BT.md
  • dto/pricing.go
  • middleware/auth.go
  • relay/channel/gemini/relay-gemini.go
  • router/dashboard.go
  • router/relay-router.go
  • web/classic/rsbuild.config.ts
  • web/classic/src/components/dashboard/DashboardHeader.jsx
  • web/classic/src/components/dashboard/index.jsx
  • web/classic/src/helpers/dashboard.jsx
  • web/classic/src/hooks/dashboard/useDashboardCharts.jsx
  • web/classic/src/hooks/dashboard/useDashboardData.js

Walkthrough

This PR replaces CI release workflows with a Docker Hub publishing workflow, rebrands documentation and the Docker Compose image toward a fork repository, adds a /v1/credits billing endpoint, reworks Gemini model list construction/routing, and adds user-scoped dashboard time-granularity persistence with matching frontend wiring.

Changes

CI Workflow and Repo Tooling Docs

Layer / File(s) Summary
New Docker Hub user image workflow
.github/workflows/docker-build.yml, .github/workflows/docker-image-branch.yml, .github/workflows/electron-build.yml, .github/workflows/pr-check.yml, .github/workflows/release.yml, .github/workflows/docker-hub-user.yml
Removes multiple release/build/PR-check workflows and adds a new docker-hub-user.yml workflow that builds and pushes a multi-arch image to Docker Hub tagged latest and by commit SHA.
CodeGraph guidance in AGENTS.md
AGENTS.md
Adds a CodeGraph section describing exploration tooling usage and fallback when unavailable.

Fork Branding Documentation and Compose Image

Layer / File(s) Summary
README fork sections across languages
README.md, README.en.md, README.fr.md, README.ja.md, README.zh_CN.md, README.zh_TW.md
Adds "This Fork" quick-start subsections and updates Star History charts/captions to reference the fork repository.
Docker Compose image and BT panel install docs
docker-compose.yml, docs/installation/BT.md
Switches the compose image to the fork image and adds fork image references/links in BT.md.

Billing Credits Endpoint

Layer / File(s) Summary
Credits response contract
controller/channel-billing.go
Adds OpenAICreditsResponse/OpenAICreditsData structs.
GetCredits handler and route wiring
controller/billing.go, router/dashboard.go
Adds GetCredits handler converting token/user quota via GetQuotaDisplayType() and registers GET /v1/credits.
Credits endpoint tests
controller/billing_test.go
Adds tests validating credits are sourced from token or user quota depending on config.

Gemini Model List Normalization

Layer / File(s) Summary
GeminiModel field type contract
dto/pricing.go
Changes GeminiModel fields to typed values with omitempty JSON tags.
buildGeminiModel and ListModels wiring
controller/model.go
Adds buildGeminiModel helper and uses it in ListModels's Gemini branch; nextPageToken becomes empty string.
FetchGeminiModels fix and router/middleware wiring
relay/channel/gemini/relay-gemini.go, router/relay-router.go, middleware/auth.go
Trims model names instead of type-asserting, routes Gemini /v1/models through ListModels, and extends TokenAuth path matching.
Gemini model list tests
controller/model_list_test.go
Adds decoding helpers and a test asserting the native Gemini model list shape.

Dashboard Time-Granularity Feature

Layer / File(s) Summary
User-scoped default-time storage helpers
web/classic/src/helpers/dashboard.jsx
Adds getDashboardStorageUserKey and user-scoped getDefaultTime/saveDefaultTime/getInitialTimestamp.
useDashboardData time-aware state and granularity handling
web/classic/src/hooks/dashboard/useDashboardData.js
Adds handleGranularityChange, threads defaultTime through data loading, and resets time state on user change.
useDashboardCharts defaultTime propagation
web/classic/src/hooks/dashboard/useDashboardCharts.jsx
Adds optional defaultTime to updateChartData/updateUserChartData.
DashboardHeader selector and Dashboard wiring
web/classic/src/components/dashboard/DashboardHeader.jsx, web/classic/src/components/dashboard/index.jsx
Adds a time-granularity selector UI and threads defaultTime through Dashboard handlers.

Build Config Date-fns Alias

Layer / File(s) Summary
date-fns alias resolution
web/classic/rsbuild.config.ts
Adds a resolve.alias entry mapping date-fns to the version bundled with @douyinfe/semi-foundation.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Router as router.dashboard
  participant Controller as controller.GetCredits
  participant Model as model (Token/User)
  Client->>Router: GET /v1/credits
  Router->>Controller: GetCredits(c)
  Controller->>Model: fetch remaining quota (token or user)
  Model-->>Controller: quota value
  Controller->>Controller: convert via GetQuotaDisplayType()
  Controller-->>Client: OpenAICreditsResponse{total_usage}
Loading
sequenceDiagram
  participant Header as DashboardHeader
  participant Dashboard as Dashboard/index.jsx
  participant DataHook as useDashboardData
  participant ChartsHook as useDashboardCharts
  Header->>Dashboard: onGranularityChange(defaultTime)
  Dashboard->>DataHook: handleGranularityChange(defaultTime)
  DataHook->>DataHook: saveDefaultTime(userKey, defaultTime)
  Dashboard->>DataHook: refresh(defaultTime)
  DataHook-->>Dashboard: quota data
  Dashboard->>ChartsHook: updateChartData(data, defaultTime)
  Dashboard->>Dashboard: loadUserData(defaultTime)
Loading

Possibly related PRs

Suggested reviewers: Calcium-Ion, creamlike1024

Poem

A rabbit hops through forks anew,
Credits counted, models too,
Time-granularity, click and spin,
Docker builds now streamlined in,
Hop hop hooray, the PR's through! 🐰✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch, ai_padded_prose). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@zhaibingye
zhaibingye deleted the work branch July 7, 2026 06:56
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.

2 participants