refactor: add email masking function and enhance RelayInfo logging

This commit introduces a new function, MaskEmail, to mask user email addresses in logs, preventing PII leakage. Additionally, the RelayInfo logging has been updated to utilize this new masking function, ensuring sensitive information is properly handled. The channel test logic has also been improved to dynamically determine the relay format based on the request path.
This commit is contained in:
CaIon
2025-08-15 12:50:27 +08:00
parent 013b30c228
commit dba74e5b05
4 changed files with 29 additions and 4 deletions

View File

@@ -134,7 +134,13 @@ func testChannel(channel *model.Channel, testModel string) testResult {
}
request := buildTestRequest(testModel)
info, err := relaycommon.GenRelayInfo(c, types.RelayFormatOpenAI, request, nil)
// Determine relay format based on request path
relayFormat := types.RelayFormatOpenAI
if c.Request.URL.Path == "/v1/embeddings" {
relayFormat = types.RelayFormatEmbedding
}
info, err := relaycommon.GenRelayInfo(c, relayFormat, request, nil)
if err != nil {
return testResult{