Skip to content

分组取消「用户可选」后描述丢失,不可选分组无法填写描述/备注 #8325

Open

Description

@AdoreJc

Agent

  • Tool: Claude Code
  • Tool version: 2.1.318
  • Model (full id): claude-fable-5-2
  • Host (CLI / IDE / GitHub coding agent / other): Claude desktop app
  • Date (UTC): 2026-11-14

User request

  • Verbatim:

    定价分组的分组描述在用户不可选时被隐藏,我觉得应该保留,因为隐藏分组或者权限分组也应该可以加备注,你觉得呢

  • Later constraints or corrections from the user (quote, or none):

    如果我需要把这个建议提到上游可以怎么改?

Out of scope — refuse

  • Matched: no
  • If yes, what was told to the user (stop here; do not file): 不适用

File gate — do not file unless all are satisfied

  • Out of scope (including pass-through): no
  • Usage / configuration / integration (answered instead of filing): no
  • Required facts present without invention (actual behavior, impact, frequency, evidence in new-api, applicable type fields): yes
  • Body is short and factual; no unfiltered AI-generated text: yes
  • File: yes
  • If no, what was told to the user (stop here): 不适用

Kind

  • Bug
  • Feature
  • Investigation
  • Other:

说明:不可选分组无处填写描述属于功能缺失;可选分组取消勾选并保存后描述从服务端丢失,是同一原因导致的数据丢失现象,一并在此说明。

Usage / configuration / integration check

  • https://docs.newapi.ai/ — what was searched, conclusion: 读了 Group Management(/en/docs/guide/feature-guide/admin/group)、System Settings、System Settings Detailed Configuration 的 "Group Ratio Settings" 一节。只描述了分组倍率(名称 → 数值),没有提到分组描述存在哪里,也没有提到不可选分组可以加描述或备注。未读中文版,未使用站内搜索。
  • https://deepwiki.com/QuantumNous/new-api — what was searched, conclusion: 抓取返回 HTTP 429,未读到任何内容。
  • README / repo docs: 未找到关于分组描述的说明。
  • Relevant code paths and conclusion: web/src/features/system-settings/models/group-ratio-visual-editor.tsx(b388140ac)。序列化时只有 row.selectable 为真才把描述写入 UserUsableGroups(约 192–193 行);描述列在不可选时渲染为占位符 -(约 727 行)。描述没有其他存储位置。
  • Can the current version already do this? (required for feature requests): 不能。不可选分组在界面上没有可填写描述的位置,后端也没有对应的存储。
  • Verdict: product bug or new feature / usage question (stop here): 新功能(附带一处数据丢失现象)。

Environment

  • new-api version / commit / image tag (not latest / unknown): commit b388140(upstream main)
  • Deploy source (repo release / official image / main source / other): main 源码,用仓库自带 Dockerfile 构建(arm64)
  • Database (sqlite / mysql / postgres): sqlite(全新数据目录)

Problem facts

  • Actual behavior: 分组取消「用户可选」后,描述栏立即变为 - 且不可编辑;保存后该分组及其描述从 UserUsableGroups 中删除;刷新页面后再次勾选,描述为空。
  • Impact: 管理员无法给不可选分组(界面说明中"仍可由管理员分配"的那类分组)写备注;已填写的描述在取消勾选并保存后永久丢失。
  • Frequency: 每次都能复现。
  • Evidence that the problem is in new-api rather than the client or upstream: 在未改动的 upstream main 构建上直接复现,不涉及任何渠道或上游请求;通过管理接口 GET /api/option/ 读到 UserUsableGroups 的值在保存后不再包含该分组。

Type-specific details

Relay / API

不适用。

Billing

不适用(不涉及倍率计算,只涉及分组描述的存储)。

Frontend

  • Page path: /system-settings/billing/group-pricing(系统设置 → 计费与支付 → 分组定价 →「定价分组」页签,可视化模式)
  • Browser and version: Chromium 152.0.7977.167,Windows 10 x64,视口 1440x900
  • Active theme: dark,界面语言简体中文
  • Relevant browser Console / Network errors: 无报错,保存请求成功。

Deployment / upgrade

不适用。

Reproduction and expected result

  • Steps to reproduce:

    1. 在「定价分组」中点「添加分组」,名称 internal,保持「用户可选」勾选,描述填 Staff only,保存。
      此时 UserUsableGroups = {"internal":"Staff only","default":"Default group","vip":"VIP group"}。
    2. 取消 internal 的「用户可选」:描述栏立即变成 -,输入框消失。
    3. 保存。此时 UserUsableGroups = {"default":"Default group","vip":"VIP group"},GroupRatio 仍包含 internal。
    4. 刷新页面,再勾选 internal 的「用户可选」:描述输入框为空。
    5. 保存。此时 UserUsableGroups = {"internal":"","default":"Default group","vip":"VIP group"}。

    补充:第 2、3 步之后如果不刷新页面直接再勾选,输入框里仍是 Staff only,这段文字只保留在页面内存中。

  • Expected result: 不可选分组也可以填写并保存描述(或管理员备注);在可选与不可选之间切换并保存后,已填写的文字不丢失。

  • Related screenshots (optional): 无。第 1–5 步的界面状态通过读取 DOM(输入框的值、单元格文本、checkbox 的 aria-checked)记录。

Feature (feature requests only)

  • Feature description: 让不可选分组也能保存一段描述或管理员备注,并且切换「用户可选」时不丢失已填写的文字。
  • Use case: 只由管理员分配的内部分组(例如内部测试、特定客户、权限控制用的分组)不会出现在用户界面上,数量多了之后只靠分组名难以区分用途,需要在管理后台留备注。

Duplicate check

Research

Docs

Code

  • web/src/features/system-settings/models/group-ratio-visual-editor.tsx — 分组定价可视化编辑器;buildGroupPricingRows 从 UserUsableGroups 读描述,序列化时仅对可选分组写回,描述列仅对可选分组渲染输入框。
  • service/group.go GetUserUsableGroups — 读取 UserUsableGroups 计算用户可选分组;说明该 option 同时承担"是否可选"和"描述"两个职责。

Experiments

  • Command or redacted request: 按上面的复现步骤在浏览器中操作,每步之后 GET /api/option/ 读取 UserUsableGroups 与 GroupRatio。
  • Direct upstream result: 不适用(不涉及上游服务商)。
  • Result through new-api: 见复现步骤中的各步取值。
  • Conclusion: 描述只存在于 UserUsableGroups,分组不可选时随键一起被删除。

Working theory

  • What is broken or missing: 分组描述没有独立于"用户可选"状态的存储。
  • Why: UserUsableGroups 的值即描述,键的存在即表示可选;不可选分组没有键,也就没有地方放描述。
  • What would falsify this: 如果存在另一个 option 或接口能为不可选分组保存描述。代码与文档中未找到。

Scope

  • In scope for a later PR: 为分组增加独立的管理员备注存储;编辑器中描述栏对所有分组可编辑;切换「用户可选」不丢失文字;备注不出现在任何非管理员接口中。
  • Out of scope / not this repo: 不改变 UserUsableGroups 的格式与语义,不改变可选分组计算、鉴权与计费逻辑。
  • Large or directional feature? If yes, this issue is for maintainer alignment; do not open a PR yet. 否,改动范围限于该编辑器与一个新增的设置项。如果维护者更倾向其他存储方式(例如扩展现有 option 的结构),请指出,再按该方向提交 PR。

Proposed direction

  • 不可选分组可以填写并保存描述/备注。
  • 可选 → 不可选 → 可选往返并保存、刷新后,文字仍在。
  • 可选分组的现有行为与 UserUsableGroups 的内容保持不变,旧数据无需迁移。
  • 管理员备注不出现在用户可访问的接口响应中。

Not verified

  • MySQL、PostgreSQL 未验证(只在 SQLite 上复现;现象发生在前端序列化阶段)。
  • 仅在 Chromium 上验证,未测其他浏览器;仅测可视化模式,未测 JSON 文本编辑模式。
  • deepwiki 与中文版文档未读到。

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions