Skip to content

fix(web): 补全日志页模型厂商规则(Cloudflare clef、NVIDIA 家族) - #7840

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
xuu1998:feat/log-model-provider-icons
Oct 17, 2026
Merged

seefs001 merged 1 commit into
QuantumNous:mainfrom
xuu1998:feat/log-model-provider-icons

Conversation

@xuu1998

@xuu1998 xuu1998 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Agent

  • Tool: Hermes Agent
  • Tool version: v0.22.0 (2026.9.24, git e06df9c2eae6)
  • Model (full id): deepseek-v4-flash
  • Host: other — CLI agent on a self-hosted server, replies delivered through a messaging front-end
  • Date (UTC): 2026-10-16

Links

User request

  • Verbatim:
    「别的模型都显示图标,为什么这个不显示」
    「这个应该是配置厂商就行吧」
    「提 PR」
  • Later constraints or corrections from the user (quote, or none): 无

Out of scope — refuse

  • Matched: no

Open gate — do not open unless all are satisfied

  • Out of scope (including pass-through-only forwarding): no
  • Usage / configuration / integration (answered instead of opening): no
  • Required issue facts present without invention: yes
  • Verification is actual commands or steps and observed results, not only go build or tests passed: yes
  • Body is short and factual; no unfiltered AI-generated text: yes
  • Open: yes

Kind

  • Bug fix

Issue facts

  • Actual behavior: 日志页(/usage-logs/common)模型徽标对 clef:27b、nv-embed-v1、riva-translate-4b-instruct-v2 只渲染彩色圆点,同页其它模型正常显示厂商图标
  • Impact: 日志列表无法按厂商识别这些模型;不影响调用、计费、路由
  • Frequency: 稳定复现,取决于模型名是否命中规则表
  • Evidence that the problem is in new-api rather than the client or upstream: 徽标来源是 resolveModelProvider(modelName),未命中即 showDot;未命中时无任何报错
  • Applicable types and their fields: frontend(/usage-logs/common 模型徽标 → web/src/lib/model-provider.ts);relay / billing / deployment 不适用

Change

  • web/src/lib/model-provider.ts
    • NVIDIA 规则新增关键词 nv-embed、nv-rerank、riva-、parakeet-、canary-、nemoretriever:这些 NVIDIA 家族不带 nvidia 前缀,此前落到“未命中 → 圆点”分支
    • 新增 Cloudflare 规则:icon: 'Cloudflare.Color',关键词 clef(clef 是 Cloudflare 的模型,ollama.com/library/clef 页面标注 by Cloudflare)
    • 新规则放在 NVIDIA 之后、OpenAI 之前。两组关键词都不与既有规则重叠,既有命中行为不变
  • web/src/lib/__tests__/model-provider.test.ts(新增):clef 家族 → Cloudflare;NVIDIA 无前缀家族 → NVIDIA;既有命中(deepseek / gpt / glm / nvidia/)不变;未知模型仍为 null

规则表按顺序先到先得,clef、nv-embed、nv-rerank、riva-、parakeet-、canary-、nemoretriever 均未出现在其它厂商的规则关键词中,因此不需要调整现有条目的顺序。

Research

Duplicate / prior art

Docs and code

  • https://docs.newapi.ai/ : 检索「模型图标 / icon / provider」——可配置的 icon 只有任务插件清单字段(LobeHub 图标名),没有日志页模型徽标的图标配置项
  • https://deepwiki.com/QuantumNous/new-api : 本机网络无法打开(域名被代理解析为私有地址),未取得内容
  • README / repo docs: 无 model-provider / 模型徽标图标相关说明
  • Code paths and what they imply for this change: web/src/lib/model-provider.ts(规则表与 resolveModelProvider)、web/src/features/usage-logs/components/model-badge.tsx:48,55(徽标取值与 showDot 分支)、web/src/features/channels/lib/model-categories.ts:23(同一函数用于渠道页厂商归类)。结论:图标完全由该硬编码表决定,补条目即可修复

Alternatives considered

  • Option A: 让徽标优先读取模型元数据里的图标(可覆盖任意厂商)——属前端数据流的方向性改动,超出本次 bug 修复范围
  • Option B: 只补 Cloudflare —— 仍会漏掉 NVIDIA 的无前缀家族(nv-embed-v1、riva-translate-* 在本环境日志中同样退化为圆点)
  • Why this approach: 与现有规则表设计一致,改动最小且可测

Files

Path Why
web/src/lib/model-provider.ts 新增 Cloudflare 规则;补全 NVIDIA 关键词
web/src/lib/__tests__/model-provider.test.ts 新增单元测试(clef / NVIDIA 家族 / 既有命中 / 未知模型)

Behavior

  • Before: clef 家族、nv-embed-v1、riva-translate-* 等模型的日志徽标为彩色圆点
  • After: 分别显示 Cloudflare、NVIDIA 厂商图标
  • Explicit non-goals / leftover work: 未改动徽标的数据来源(仍然不读模型元数据,那是另一个方向性决定);未新增 Sakana(@lobehub/icons 5.22.0 有该家族图标,但其模型命名约定未经验证)、Inception(图标存在,同样无命名证据)等规则;Sarvam、Thinking Machines 在锁定的图标包中无对应图标,暂时无法添加

Verification

  • Commands and results:
    • bun install --frozen-lockfile(web/)→ 1200 packages installed,exit 0
    • bun run test src/lib/__tests__/model-provider.test.ts → Test Files 1 passed (1),Tests 4 passed (4)
    • ./node_modules/.bin/oxlint -c .oxlintrc.json src/lib/model-provider.ts src/lib/__tests__/model-provider.test.ts → 无输出(通过)
    • ./node_modules/.bin/oxfmt -c .oxfmtrc.json --check 同上两个文件 → All matched files use the correct format
    • 图标键存在性:仓库锁定的 @lobehub/icons@5.22.0 中,es/Cloudflare/index.d.ts 与 es/Nvidia/index.d.ts 均导出 Color,因此 Cloudflare.Color / Nvidia.Color 可渲染
  • Manual steps and observed result: 在报告者的实例(v1.0.0-rc.44)上,同一日志列表里 deepseek-flash 行显示厂商图标、clef:27b 行为彩色圆点;该对比与 resolveModelProvider('clef:27b') === null(新增测试复现)一致
  • UI: 无截图。该实例属报告者、本机无登录态,未做 UI 复核;改动是纯映射函数,以单元测试 + 图标键存在性检查作为验证
  • Tests added or updated: 新增 web/src/lib/__tests__/model-provider.test.ts(4 个用例)
  • Databases / providers / platforms exercised: 无(纯前端映射,不涉及数据库、模型 provider 或平台)
  • Not verified: 浏览器实测;sqlite / mysql 部署;deepwiki

Risks

  • Failure modes: 关键词过宽导致误判。clef、nv-embed、nv-rerank、riva-、parakeet-、nemoretriever 都足够具体;canary- 相对宽一些,若将来出现非 NVIDIA 的同名家族需要再收窄
  • Billing / quota / auth impact: 无(仅展示层)
  • Follow-ups: 徽标是否改为优先读模型元数据图标,留待维护者决定

Scope check

  • Single focused change: yes
  • Secrets included: no
  • Out of scope (Coding Plan / reverse-engineered channel / third-party wrapper / Codex / pass-through-only forwarding): no

Summary by CodeRabbit

  • Improvements
    • Expanded automatic provider recognition for additional NVIDIA model names, including embedding, reranking, speech, and retrieval models.

… rules

The usage-log model badge resolves its icon from MODEL_PROVIDER_RULES by model
name only. clef (Cloudflare) and the NVIDIA families without an nvidia prefix
(nv-embed, nv-rerank, riva-, parakeet-, canary-, nemoretriever) matched no rule
and fell back to the plain dot.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 670cbc14-26df-4a81-aac0-1ee97c09022f
📥 Commits

Reviewing files that changed from the base of the PR and between 45fbb14 and aa8f23c.

📒 Files selected for processing: 2
  • web/src/lib/__tests__/model-provider.test.ts
  • web/src/lib/model-provider.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The provider resolver adds Cloudflare mappings for clef variants and expands NVIDIA matching to additional model-name families. New tests cover these mappings, existing provider matches, and the null result for an unknown model.

Changes

Provider mapping

Layer / File(s) Summary
Provider rules and coverage
web/src/lib/model-provider.ts, web/src/lib/__tests__/model-provider.test.ts
The NVIDIA rule adds six model-name keywords. Tests cover Cloudflare clef variants, these NVIDIA matches, existing provider results, and an unknown model.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to aa8f2

The added model-name mappings and tests present no identified merge-blocking risk. Merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main changes: completing the model-provider rules for Cloudflare clef models and the NVIDIA family.
Linked Issues check Passed Issue #7839 requires Cloudflare resolution for the clef family, NVIDIA resolution for nv-embed, nv-rerank, riva-, parakeet-, canary-, and nemoretriever, unchanged existing matches, `null…
Out of Scope Changes check Passed The pull request changes only the provider rule table and its unit tests. These changes directly implement issue #7839. The tests are supporting evidence. No unrelated relay, billing, routing, metadat…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving 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.

❤️ Share

I’m a rabbit; I hop through the rules,
Cloudflare’s clef now joins the icons’ parade.
NVIDIA names find their proper match,
Old provider checks still stand in line,
And unknown names rest as null in the shade.

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

@xuu1998

xuu1998 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

补充验证(本机,非 CI;web/ 执行 bun install --frozen-lockfile 之后):

./node_modules/.bin/vitest run → Test Files 193 passed (193)、Tests 2293 passed (2293),exit 0,耗时 626s。

仅此一项;未做浏览器实测(本机没有可登录的对应实例)。

@seefs001
seefs001 merged commit f92c576 into QuantumNous:main Oct 17, 2026
1 check passed
shirosoralumie648 added a commit to shirosoralumie648/newapi-rev that referenced this pull request Oct 17, 2026
Sync 54 upstream commit(s) via merge (fork history preserved).
Behavior changes from upstream:
- 4013729 fix: disable sensitive word filtering by default and clear the default word list (QuantumNous#7814)

Upstream commits:
- 5e95951 feat(channels): add drag mode for channel priority ordering
- 5a59d69 fix(pricing): hide task prices left at zero when another price is set
- 3e2ce2c fix: align model card summary with status bar hours (QuantumNous#7847)
- b0a98ac fix(web): apply theme class before first paint so Dark Reader detects dark mode (QuantumNous#7571)
- f92c576 fix(web): cover Cloudflare clef and NVIDIA model families in provider rules (QuantumNous#7840)
- ff36846 fix(relayconvert): 保留 Chat/Claude → Responses 转换中 input_image 的 detail 字段 (QuantumNous#7855)
- 09109ec fix(middleware): 过载哨兵改用容器口径并加入连续性与新鲜度判定 (QuantumNous#7317)
- d032204 feat(aws): add Mantle Messages API support
- ca2cae6 fix(relaykit): emit summary on reasoning items announced without one (QuantumNous#7833)
- 45fbb14 fix(rate-limit): count each group with its own limit separately
- 6549a17 fix(dashboard): draw flow chart labels in the theme text color (QuantumNous#7821)
- c9179d3 fix(playground): support the reasoning field in chat responses (QuantumNous#7831)
- 908f94d fix(web): hide pages the user cannot open from console search
- 19d435e fix(relay): mask only the custom upstream address in error messages (QuantumNous#7822)
- 718a4e7 fix(vertex): use the multi-region hostnames for us and eu
- f196934 feat(plugins): bind Hailuo, Vidu and Veo plugins to New API channels
- bfdad29 fix(vidu): bill the model, duration and resolution Vidu generates
- 150ab3c chore(licenses): refresh the third-party dependency inventory
- 76cd511 build: upgrade moejs to v0.1.0-alpha.7
- 1b63c28 fix(claude): preserve explicit zero usage and cache-only billing (QuantumNous#7816)
- c9f7b62 fix(web): sort pricing models by input, output and per-request price (QuantumNous#7813)
- a0bf6a8 fix(vertex): pass project_id in API Key mode to avoid 404 on official endpoints (QuantumNous#6330)
- 4013729 fix: disable sensitive word filtering by default and clear the default word list (QuantumNous#7814)
- 7de10f2 feat(token): let an API key read its owner's quota
- ef60ef2 fix(relay): keep the cause of a failed body read for every later reader
- d10eafb fix(relay): report the real cause when a request body cannot be read
- 63cecab feat(channel): support Sub2API balance queries (QuantumNous#7749)
- b4be2a7 feat(ui): show newly added pricing groups at the top (QuantumNous#7782)
- 633b4c5 feat(logs): export usage logs from the common log page (QuantumNous#7774)
- dd59854 chore(deps-dev): bump undici from 6.28.0 to 6.29.0 in /electron (QuantumNous#7624)
- 93cf4ba chore(deps-dev): bump js-yaml from 4.3.1 to 4.3.2 in /electron (QuantumNous#7327)
- 3c9fb2a chore(deps-dev): bump brace-expansion from 1.1.16 to 1.1.21 in /electron (QuantumNous#7623)
- 9f04810 chore(deps): bump ai from 7.0.31 to 7.0.136 in /web (QuantumNous#7767)
- 3fe394c chore(deps): bump github.com/gorilla/websocket from 1.5.0 to 1.5.3 (QuantumNous#7001)
- 1c58f3d chore(deps-dev): bump fast-uri from 3.1.5 to 3.1.7 in /electron (QuantumNous#7169)
- 7f51a97 chore(deps-dev): bump js-yaml from 4.3.1 to 4.3.2 in /electron (QuantumNous#7327)
- 7e25797 chore(deps-dev): bump electron from 39.8.10 to 41.10.6 in /electron (QuantumNous#7625)
- bf4e1eb build(deps-dev): bump oxfmt from 0.57.0 to 0.72.0 in /web (QuantumNous#7766)
- 82306b3 build(deps-dev): bump @tanstack/router-plugin in /web (QuantumNous#7768)
- c730add build(deps): bump stream-markdown-parser from 1.1.3 to 1.2.18 in /web (QuantumNous#7769)
- b8c2dc1 build(deps): bump yace from 1.1.0 to 1.1.1 in /web (QuantumNous#7770)
- ba29f06 chore(deps-dev): bump @xmldom/xmldom from 0.8.13 to 0.8.15 in /electron (QuantumNous#7187)
- 767a82b fix(claude): forward thinking.block_binding and every anthropic-beta value (QuantumNous#7732)
- 2b85a8f fix(auth): show legal consent warning on password login (QuantumNous#7771)
- 2ed0587 fix(ci): stabilize checks and configure Bun dependency updates (QuantumNous#7765)
- 9948b1e fix(pricing): accept declared endpoint arrays in pricing conversion (QuantumNous#7724)
- 4bfcf28 chore(web): bump @lobehub/icons to 5.22.0 (QuantumNous#7764)
- fc08b76 fix(web): preserve recorded billing tiers in usage log previews (QuantumNous#7763)
- ba0e478 fix(relaykit): preserve assistant text with tool calls (QuantumNous#6871)
- 34b1942 fix(pricing): allow root access when the model square is disabled (QuantumNous#7761)
- b22a43b fix: mark task settlement logs with is_task for tiered billing display (QuantumNous#7446)
- bbf60b4 fix(logs): vertically align billing source icons on mobile (QuantumNous#7760)
- 3f926c3 fix(metrics): count completed streams after context cancellation (QuantumNous#7638)
- 3827fd8 fix(web): show cache read price on expression model cards (QuantumNous#7757)

Local tests not run (CI-only).
jahnli pushed a commit to jahnli/new-api that referenced this pull request Oct 17, 2026
Upstream scope: 22 commits / 123 files since the last sync (ef60ef2). 19 conflicted files were resolved one by one with explicit confirmation: 9 manual merges, 3 files taken from upstream (console search refactor plus its new test), and key-set unions in all 7 locale files. Every auto-merged file was reviewed one by one and both sides' changes are preserved (line-level check: no local line and no upstream line lost). No upstream deletions.

Local behavior kept: QuantumNous#2 AIGatewayError naming across relaykit and host error paths, QuantumNous#23/QuantumNous#24 LDAP login and LDAP default login, QuantumNous#27 avatar_url, QuantumNous#29/QuantumNous#31 removed OAuth providers, QuantumNous#37 subscription and violation fee flow, QuantumNous#39 user management table, QuantumNous#45/QuantumNous#69/QuantumNous#71 data overview access and BP roles, QuantumNous#49 pricing currency, QuantumNous#51/QuantumNous#56/QuantumNous#65 profile, audit and demo mode, QuantumNous#54/QuantumNous#55/QuantumNous#57 pricing square and dashboard/four-token stats, QuantumNous#58 online image generation, QuantumNous#60 API key interactions, QuantumNous#61 auto subscribe, QuantumNous#62 admin entry permissions, QuantumNous#77 removed frontend update check, seven-locale custom copy, header-removal convention.

Upstream adopted: QuantumNous#7822 upstream address masking (upstreamURLs plumbing through relaykit error paths, task errors, WebSocket error events, playground/relay/gemini/chat_via_responses/violation fee), QuantumNous#7317 container cgroup overload sentinel with consecutive and freshness sampling, QuantumNous#7816 Claude explicit zero usage and cache-only billing, QuantumNous#7813 pricing sorts by input/output/per-request price, QuantumNous#7840 provider rules for Cloudflare and NVIDIA, QuantumNous#7814 sensitive word filtering off by default, AWS Mantle Messages API, Vertex multi-region hostnames and API key project_id, Hailuo/Vidu/Veo plugin channel bindings and Vidu billing, per-group rate limits, API key owner quota query, moejs v0.1.0-alpha.7, theme class applied before first paint, console search limited to sidebar pages.

Collateral decisions (user approved): removed local test web/src/components/__tests__/command-menu-permissions.test.tsx (superseded by upstream command-menu.test.tsx) and added the newly required allow_user_quota_query field to the web/src/features/keys/components/__tests__/api-key-timestamp-cell.test.tsx fixture.

Verification: go build ./... exit 0; GOWORK=off go build ./... in relaykit exit 0; gofmt clean on modified Go files; web bun run typecheck exit 0; oxlint clean on the 49 merged web files; bun run i18n:sync reports missingCount 0 and extrasCount 0 for all seven locales; no conflict markers left; every upstream commit's added lines are present.

Not verified: SQLite/MySQL/PostgreSQL migration matrix for the new tokens.allow_user_quota_query column, unit tests (not run per project rule), web production build, runtime manual checks.
lizhongyi1209 pushed a commit to lizhongyi1209/new-api that referenced this pull request Oct 28, 2026
… rules (QuantumNous#7840)

The usage-log model badge resolves its icon from MODEL_PROVIDER_RULES by model
name only. clef (Cloudflare) and the NVIDIA families without an nvidia prefix
(nv-embed, nv-rerank, riva-, parakeet-, canary-, nemoretriever) matched no rule
and fell back to the plain dot.

Co-authored-by: xuu1998 <xuu1998@users.noreply.github.com>
timwenx pushed a commit to timwenx/new-api that referenced this pull request Nov 18, 2026
… rules (QuantumNous#7840)

The usage-log model badge resolves its icon from MODEL_PROVIDER_RULES by model
name only. clef (Cloudflare) and the NVIDIA families without an nvidia prefix
(nv-embed, nv-rerank, riva-, parakeet-, canary-, nemoretriever) matched no rule
and fell back to the plain dot.

Co-authored-by: xuu1998 <xuu1998@users.noreply.github.com>
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.

日志页模型徽标缺少 Cloudflare(clef) 与 NVIDIA 若干家族的厂商图标规则

2 participants