Просмотр исходного кода

🐛 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
t0ng7u 7 месяцев назад
Родитель
Сommit
52fe92ed7f
2 измененных файлов с 19 добавлено и 33 удалено
  1. 17 32
      web/src/components/table/LogsTable.js
  2. 2 1
      web/src/i18n/locales/en.json

+ 17 - 32
web/src/components/table/LogsTable.js

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

+ 2 - 1
web/src/i18n/locales/en.json

@@ -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"
 }
 }