update - #5143
Conversation
…Name Prevents model mapping info leak in classic UI table model column for non-admin users. renderModelName now accepts isAdminUser parameter and only shows upstream model popover when the user is an admin. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace upstream Calcium-Ion/new-api GitHub API URLs with Wischoicer-Xian/new-api in both classic and default frontend themes so the admin "Check for updates" feature queries our own fork. Files changed: - web/default/.../update-checker-section.tsx (API URL) - web/classic/.../OtherSetting.jsx (API URL + release page link + comment) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Classic theme: add response.ok check before JSON parsing to prevent crash when fork has no releases. Handle 404 with a clear message and validate tag_name before use. Fallback marked.parse to empty string when body is undefined. Default theme: distinguish 404 (no release yet) from other API errors with a specific user-facing message. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… error messages Previously the catch block always showed a generic '检查更新失败' message, overriding the 404/HTTP status errors thrown earlier in checkUpdate(). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- model/log.go: delete is_model_mapped and upstream_model_name in formatUserLogs() so USER /api/log/self no longer leaks mapping info - controller/task.go: clear UpstreamModelName in tasksToDto() when fillUser=false (USER /api/task/self path) - default/details-dialog.tsx: guard Model Mapping section with props.isAdmin condition - default/format.ts: add isAdmin param to formatModelName(), return actualModel only for admins - default/common-logs-columns.tsx: pass isAdmin to formatModelName() - classic/useUsageLogsData.jsx: add isAdminUser && guard to modelMapped check Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change GitHub API and release page URLs from Wischoicer-Xian/new-api to QuantumNous/new-api (the active upstream). Calcium-Ion/new-api returns 301 (renamed). Error handling from previous round preserved. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When model_mapping is active, the upstream provider returns the mapped model name (e.g. qwen3.5-plus). Callers now see their original requested model name (e.g. qwen3.6-flash) in all API response `model` fields. - Add relay/common/response_model_alias.go with GetCallerModelName, PatchTopLevelModelRaw, PatchResponsesEventModelRaw helpers - Patch all relay channels: OpenAI compatible/responses/chat-via-responses, Claude, xAI, Gemini, Ollama, Cloudflare, Cohere, Coze - Strip ETag/Content-MD5 headers when response body is rewritten Related: WIS-93 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…am handler isAudioModel was based on caller model name, causing false negatives under model mapping where the alias doesn't contain "audio" but the upstream model is audio-capable. This led to usage stats being computed via text estimation instead of the dedicated audio usage extraction path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review WalkthroughThis PR implements caller-visible model name aliasing across all relay handlers and redacts internal model mapping details from non-admin users. Backend relay handlers now preserve the caller's selected model name in responses instead of exposing upstream model names. User-facing logs and task DTOs hide model mapping fields for non-admin users. Frontend components restrict model mapping UI visibility to admins only. Web frontends also migrate GitHub release endpoints to a new repository. ChangesBackend model aliasing and visibility control
Frontend usage logs admin visibility gating
Frontend GitHub repository migration
Sequence Diagram(s)sequenceDiagram
participant Caller as API Caller
participant RelayHandler as Relay Handler<br/>(e.g., OaiStreamHandler)
participant Upstream as Upstream Service<br/>(OpenAI/Claude/etc)
participant CommonUtils as relaycommon
Caller->>RelayHandler: request with model="my-model"
RelayHandler->>CommonUtils: GetCallerModelName(ctx, info)
CommonUtils-->>RelayHandler: "my-model"
RelayHandler->>Upstream: forward request
Upstream->>RelayHandler: response with model="upstream-actual-model"
RelayHandler->>RelayHandler: preserve callerModel="my-model"<br/>(ignore upstream.model)
alt raw passthrough path
RelayHandler->>CommonUtils: PatchTopLevelModelRaw(body, "my-model")
CommonUtils-->>RelayHandler: patched body
end
RelayHandler->>Caller: response with model="my-model"
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
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. Comment |
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Improvements