From cffaf0d636fdb85441fb35db3584b25fb8122adc Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Sat, 21 Dec 2024 20:24:22 +0800 Subject: [PATCH] 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. --- service/{log.go => log_info_generate.go} | 1 + web/src/components/LogsTable.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) rename service/{log.go => log_info_generate.go} (98%) diff --git a/service/log.go b/service/log_info_generate.go similarity index 98% rename from service/log.go rename to service/log_info_generate.go index 4372130c..08092cc8 100644 --- a/service/log.go +++ b/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") diff --git a/web/src/components/LogsTable.js b/web/src/components/LogsTable.js index f27a7fd4..e391253d 100644 --- a/web/src/components/LogsTable.js +++ b/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 ( + + {' '} + {other.group}{' '} + + ); + } else { + return <>; + } + } else { + return <>; + } + }, + }, { title: t('类型'), dataIndex: 'type',