Skip to content

fix(providers): accept Grok auth record imports - #679

Merged
ymkiux merged 3 commits into
mainfrom
fix/grok-provider-import-empty-cpa
Jul 15, 2026
Merged

fix(providers): accept Grok auth record imports#679
ymkiux merged 3 commits into
mainfrom
fix/grok-provider-import-empty-cpa

Conversation

@awsl233777

@awsl233777 awsl233777 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • allow Grok import to accept direct CPA xAI credential JSON, CLIProxyAPI auth records with credentials under metadata, and Maxx exported Grok provider payloads under config.grok
  • preserve validation for xAI/oauth credentials and required access/refresh tokens
  • keep the client-route available-provider bulk action bar sticky inside the available providers section so long provider lists do not hide the add/clear actions while scrolling
  • expose the existing 429 rate-limit fallback cooldown setting in Settings, with 1-86400 second validation and Retry-After precedence copy
  • add regression coverage for all three supported Grok import shapes
  • update provider type order test expectation to include Grok

Verification

  • cd web && pnpm test -- grok-token-import.test.ts (17 files / 81 tests passed)
  • cd web && pnpm typecheck
  • git diff --check
  • cd web && pnpm exec prettier --check src/pages/settings/index.tsx src/locales/zh.json src/locales/en.json
  • cd web && pnpm exec prettier --check src/components/routes/ClientTypeRoutesContent.tsx src/pages/providers/components/grok-token-import.tsx src/pages/providers/components/grok-token-import.test.ts src/pages/providers/types.test.ts
  • go test ./internal/executor ./internal/service

Notes

  • cd web && pnpm format:check still reports pre-existing formatting drift across unrelated files; only the touched files were formatted for this PR.

Summary by CodeRabbit

  • 新功能

    • Grok 凭据导入现支持多种来源格式,并自动统一配置字段。
    • 支持保留凭据的禁用状态等配置属性。
    • 提供方分组页面的批量操作栏现会固定在顶部,滚动时更易访问。
  • 测试

    • 新增 Grok 凭据格式转换及提供方类型排序的覆盖测试。

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

扩展 Grok 凭据导入以兼容 xAI CPA、CLIProxyAPI 和 Maxx 导出格式,并新增归一化测试;同时将 Provider 批量操作栏改为顶部 sticky 布局,更新 grok 类型覆盖测试。

Changes

Provider 导入与界面更新

Layer / File(s) Summary
Grok 凭据格式归一化
web/src/pages/providers/components/grok-token-import.tsx, web/src/pages/providers/components/grok-token-import.test.ts
支持多种 Grok 导入载荷,统一 snake_case/camelCase 字段、元数据和禁用状态,并覆盖三类输入测试。
Provider 类型与批量操作栏
web/src/components/routes/ClientTypeRoutesContent.tsx, web/src/pages/providers/types.test.ts, web/src/pages/providers/components/grok-token-import.tsx
将 grok 加入 Provider 类型断言,并将批量操作区域调整为带背景模糊效果的顶部 sticky 容器。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Poem

小兔拎来 Grok 票,
CPA、Maxx 都能找。
归一字段排成行,
Sticky 控件稳稳跳。
测试胡萝卜咔嚓响!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了此次为 Grok 导入支持 auth record 的主要变更。
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/grok-provider-import-empty-cpa

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.

@ymkiux
ymkiux merged commit aa6dcdb into main Jul 15, 2026
5 checks passed
@ymkiux
ymkiux deleted the fix/grok-provider-import-empty-cpa branch July 15, 2026 08:18
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