Skip to content

01 - #5295

Closed
guygubaby wants to merge 18 commits into
QuantumNous:mainfrom
guygubaby:main
Closed

01#5295
guygubaby wants to merge 18 commits into
QuantumNous:mainfrom
guygubaby:main

Conversation

@guygubaby

@guygubaby guygubaby commented Jun 3, 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

  • Bug Fixes

    • Fixed Claude tool input schema handling for function parameter validation.
    • Fixed Gemini function parameter schema normalization to resolve validation issues.
    • Improved pricing group determination logic for guest users.
  • Tests

    • Added test coverage for guest pricing with empty selectable groups.
    • Added test coverage for JSON schema normalization.
  • Chores

    • Simplified Docker build workflow and removed legacy CI/CD pipelines.

@guygubaby guygubaby closed this Jun 3, 2026
@coderabbitai

coderabbitai Bot commented Jun 3, 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: 0a970e07-2306-4574-8879-e95a162a40f1

📥 Commits

Reviewing files that changed from the base of the PR and between b0ac042 and e608263.

📒 Files selected for processing (16)
  • .github/CODE_OF_CONDUCT.md
  • .github/FUNDING.yml
  • .github/ISSUE_TEMPLATE/config.yml
  • .github/workflows/docker-build.yml
  • .github/workflows/docker-image-alpha.yml
  • .github/workflows/docker-image-nightly.yml
  • .github/workflows/electron-build.yml
  • .github/workflows/pr-check.yml
  • .github/workflows/release.yml
  • .github/workflows/sync-to-gitee.yml
  • FORK_CHANGES.md
  • controller/pricing.go
  • controller/pricing_test.go
  • relay/channel/claude/relay-claude.go
  • relay/channel/gemini/relay-gemini.go
  • relay/channel/gemini/relay_gemini_usage_test.go

Walkthrough

This PR consolidates fork-specific customizations across three primary areas: GitHub Actions CI/CD infrastructure (simplifying Docker workflows and removing obsolete pipelines), pricing controller logic (extracting user group determination), and JSON Schema compatibility (normalizing required fields in Claude and Gemini relays).

Changes

Fork CI/CD Consolidation and Documentation

Layer / File(s) Summary
Docker Build Workflow Simplification
.github/workflows/docker-build.yml
The docker-build.yml workflow is simplified to remove nightly* tag exclusion, consolidate the multi-arch job from a matrix-based approach into a single build job, and target the guygubaby/new-api Docker Hub repository with fixed multi-arch support for linux/amd64 and linux/arm64.
Fork Customizations Documentation
FORK_CHANGES.md
New comprehensive documentation details all fork-specific modifications: Docker CI/CD consolidation, .dockerignore license file handling, GitHub metadata cleanup, JSON Schema required field normalization logic for Gemini/Claude, and step-by-step procedures for reapplying changes and syncing upstream updates.

Pricing User Group Extraction

Layer / File(s) Summary
User Group Helper Implementation and Tests
controller/pricing.go, controller/pricing_test.go
Introduces getPricingUserGroup() helper to centralize user group resolution from Gin context, with proper fallback to "default" for guests and empty string on cache miss. GetPricing() is refactored to use this helper for conditional group-ratio overrides. Test verifies the helper returns "default" when no selectable groups are configured.

JSON Schema Required Field Normalization

Layer / File(s) Summary
Claude Required Field Normalization
relay/channel/claude/relay-claude.go
Claude tool input schema construction now normalizes required: null to required: [], preventing schema validation failures from nil values while preserving non-nil arrays.
Gemini Required Field Normalization and Tests
relay/channel/gemini/relay-gemini.go, relay/channel/gemini/relay_gemini_usage_test.go
Adds normalizeRequiredArray() helper that recursively converts required: null to required: [] in JSON Schema objects and nested structures. Normalization is applied in both deep and shallow schema cleaning paths. Comprehensive table-driven tests cover nil inputs, nested schemas, and edge cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • QuantumNous/new-api#2011: Modifies the Docker alpha workflow file that this PR removes entirely, directly overlapping on CI/CD consolidation goals.
  • QuantumNous/new-api#4076: Adds or refines the PR check workflow that this PR removes, representing a direct CI configuration conflict.

Suggested reviewers

  • seefs001
  • creamlike1024

Poem

🐰 A fork now cleaned and clearly marked,
Docker streams simplified, schemas unmarked,
With pricing groups and required arrays bright,
Upstream syncs made oh-so-right!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch main

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 and usage tips.

Warning

⚠️ This pull request might be slop. It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

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