🐛 fix: Ensure channel tooltip displays correctly in LogsTable

* Refactored the render logic of the **Channel** column
  * Wrapped tooltip around the first `Tag` only to restore hover behavior when multi-key mode is enabled
  * Added i18n-friendly fallback (`t('未知渠道')`) for cases where `channel_name` is missing
* Improves user experience for administrators by reliably showing channel names even with multiple keys
This commit is contained in:
t0ng7u
2025-07-14 13:12:40 +08:00
parent 0d005df463
commit 52fe92ed7f
2 changed files with 19 additions and 33 deletions

View File

@@ -367,38 +367,23 @@ const LogsTable = () => {
} }
} }
return isAdminUser ? ( return isAdminUser && (record.type === 0 || record.type === 2 || record.type === 5) ? (
record.type === 0 || record.type === 2 || record.type === 5 ? (
<>
{
<Tooltip content={record.channel_name || '[未知]'}>
<Space> <Space>
<Tooltip content={record.channel_name || t('未知渠道')}>
<Tag <Tag
color={colors[parseInt(text) % colors.length]} color={colors[parseInt(text) % colors.length]}
shape='circle' shape='circle'
> >
{text} {text}
</Tag> </Tag>
{ </Tooltip>
isMultiKey && ( {isMultiKey && (
<Tag <Tag color='white' shape='circle'>
color={'white'}
shape='circle'
>
{multiKeyIndex} {multiKeyIndex}
</Tag> </Tag>
) )}
}
</Space> </Space>
</Tooltip> ) : null;
}
</>
) : (
<></>
)
) : (
<></>
);
}, },
}, },
{ {

View File

@@ -1773,5 +1773,6 @@
"请上传密钥文件": "Please upload the key file", "请上传密钥文件": "Please upload the key file",
"请填写部署地区": "Please fill in the deployment region", "请填写部署地区": "Please fill in the deployment region",
"请输入部署地区例如us-central1\n支持使用模型映射格式\n{\n \"default\": \"us-central1\",\n \"claude-3-5-sonnet-20240620\": \"europe-west1\"\n}": "Please enter the deployment region, for example: us-central1\nSupports using model mapping format\n{\n \"default\": \"us-central1\",\n \"claude-3-5-sonnet-20240620\": \"europe-west1\"\n}", "请输入部署地区例如us-central1\n支持使用模型映射格式\n{\n \"default\": \"us-central1\",\n \"claude-3-5-sonnet-20240620\": \"europe-west1\"\n}": "Please enter the deployment region, for example: us-central1\nSupports using model mapping format\n{\n \"default\": \"us-central1\",\n \"claude-3-5-sonnet-20240620\": \"europe-west1\"\n}",
"其他": "Other" "其他": "Other",
"未知渠道": "Unknown channel"
} }