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

feat: Add log information generation and enhance LogsTable component

- Introduced `log_info_generate.go` to implement functions for generating various log information, including text, WebSocket, and audio details.
- Enhanced `LogsTable` component to display the 'group' information from the log data, improving the visibility of grouped logs in the UI.
CalciumIon 1 год назад
Родитель
Сommit
cffaf0d636
2 измененных файлов с 25 добавлено и 0 удалено
  1. 1 0
      service/log_info_generate.go
  2. 24 0
      web/src/components/LogsTable.js

+ 1 - 0
service/log.go → service/log_info_generate.go

@@ -12,6 +12,7 @@ func GenerateTextOtherInfo(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, m
 	other["group_ratio"] = groupRatio
 	other["completion_ratio"] = completionRatio
 	other["model_price"] = modelPrice
+	other["group"] = relayInfo.Group
 	other["frt"] = float64(relayInfo.FirstResponseTime.UnixMilli() - relayInfo.StartTime.UnixMilli())
 	adminInfo := make(map[string]interface{})
 	adminInfo["use_channel"] = ctx.GetStringSlice("use_channel")

+ 24 - 0
web/src/components/LogsTable.js

@@ -217,6 +217,30 @@ const LogsTable = () => {
         );
       },
     },
+    {
+      title: t('分组'),
+      dataIndex: 'group',
+      render: (text, record, index) => {
+        if (record.type === 0 || record.type === 2) {
+          let other = JSON.parse(record.other);
+          if (other === null) {
+            return <></>;
+          }
+          if (other.group !== undefined) {
+            return (
+              <Tag color='blue' size='large'>
+                {' '}
+                {other.group}{' '}
+              </Tag>
+            );
+          } else {
+            return <></>;
+          }
+        } else {
+          return <></>;
+        }
+      },
+    },
     {
       title: t('类型'),
       dataIndex: 'type',