mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-02 00:30:32 +00:00
fix(monitor-ui): localize the "quota" placeholder model across monitor views
纯配额模式的主模型存储值是占位符 "quota"(数据源是关联账号而非模型), 此前在管理列表主模型列、用户端监控卡片、用户端详情弹窗、运行结果弹窗 四处被当作真实模型名直接渲染,读起来像假模型。 新增 useChannelMonitorFormat.formatMonitorModel:占位符替换为本地化 「配额」标签(复用既有 monitorCommon.checkMode.quota,零新增 i18n 键), quota_probe/probe 的真实模型名不受影响;纯匹配逻辑(如 15d/30d 可用率 按模型名回查 detail)仍用原始值。 问题定位备注:另一反馈「设置页看不到 channel_monitor_show_quota 开关」 经查为部署镜像过旧(开关随 #5761 于 08-18 合入,反馈环境容器构建于 08-15),上游代码中开关完整存在,更新镜像即可,无需改码。
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
:key="m.model"
|
||||
class="border-b border-gray-100 dark:border-dark-800"
|
||||
>
|
||||
<td class="py-2 pr-3 font-medium text-gray-900 dark:text-gray-100">{{ m.model }}</td>
|
||||
<td class="py-2 pr-3 font-medium text-gray-900 dark:text-gray-100">{{ formatMonitorModel(m.model) }}</td>
|
||||
<td class="py-2 pr-3">
|
||||
<span
|
||||
class="inline-flex items-center rounded-full px-2 py-0.5 text-[11px]"
|
||||
@@ -83,7 +83,7 @@ defineEmits<{
|
||||
|
||||
const { t } = useI18n()
|
||||
const appStore = useAppStore()
|
||||
const { statusLabel, statusBadgeClass, formatLatency, formatPercent } = useChannelMonitorFormat()
|
||||
const { statusLabel, statusBadgeClass, formatLatency, formatPercent, formatMonitorModel } = useChannelMonitorFormat()
|
||||
|
||||
const detail = ref<UserMonitorDetail | null>(null)
|
||||
const loading = ref(false)
|
||||
|
||||
@@ -88,4 +88,16 @@ describe('MonitorCard quota snapshot visibility', () => {
|
||||
const wrapper = mountCard(makeItem())
|
||||
expect(wrapper.find('[data-testid="monitor-quota-view"]').exists()).toBe(false)
|
||||
})
|
||||
|
||||
// 占位符 "quota" 是主模型存储值,不得作为假模型名直接透出到用户端。
|
||||
it('shows the localized quota label instead of the raw placeholder model', () => {
|
||||
const wrapper = mountCard(makeItem())
|
||||
expect(wrapper.text()).toContain('monitorCommon.checkMode.quota')
|
||||
})
|
||||
|
||||
it('keeps the real model name for probe monitors', () => {
|
||||
const wrapper = mountCard(makeItem({ primary_model: 'claude-sonnet-4-5' }))
|
||||
expect(wrapper.text()).toContain('claude-sonnet-4-5')
|
||||
expect(wrapper.text()).not.toContain('monitorCommon.checkMode.quota')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
>
|
||||
{{ providerLabel(item.provider) }}
|
||||
</span>
|
||||
<!-- 纯配额模式主模型是占位符 "quota",展示层替换为本地化「配额」标签 -->
|
||||
<span class="font-mono text-xs truncate text-gray-500 dark:text-gray-400">
|
||||
{{ item.primary_model }}
|
||||
{{ formatMonitorModel(item.primary_model) }}
|
||||
</span>
|
||||
<span
|
||||
v-if="item.group_name"
|
||||
@@ -120,6 +121,7 @@ const {
|
||||
providerLabel,
|
||||
providerBadgeClass,
|
||||
formatLatency,
|
||||
formatMonitorModel,
|
||||
} = useChannelMonitorFormat()
|
||||
|
||||
const providerTintClass = computed(() =>
|
||||
|
||||
Reference in New Issue
Block a user