mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-14 01:02:32 +00:00
fix(seeder): improve key idempotency and log names
Trim whitespace in provider model lists, format provider names as `group#keyID` to match DP logs, and skip existing API keys during seeding (deleting on reset) to keep runs idempotent and summaries accurate
This commit is contained in:
@@ -407,14 +407,20 @@ func (g *Generator) GenerateUsageSamples(ctx UsageSampleContext) []LogRequest {
|
||||
// For historical data, we would need direct DB access.
|
||||
// Current implementation creates logs at "now" time.
|
||||
|
||||
// Format provider_name as group#keyID to match DP log format
|
||||
providerName := group.Name
|
||||
if providerID > 0 {
|
||||
providerName = fmt.Sprintf("%s#%d", group.Name, providerID)
|
||||
}
|
||||
|
||||
result = append(result, LogRequest{
|
||||
Group: master.Group,
|
||||
MasterID: master.ID,
|
||||
KeyID: keyID,
|
||||
Model: modelName, // Fixed: use Model not ModelName
|
||||
ProviderID: providerID, // Fixed: use APIKey ID not group ID
|
||||
Model: modelName,
|
||||
ProviderID: providerID,
|
||||
ProviderType: group.Type,
|
||||
ProviderName: group.Name,
|
||||
ProviderName: providerName,
|
||||
StatusCode: statusCode,
|
||||
LatencyMs: latencyMs,
|
||||
TokensIn: tokensIn,
|
||||
|
||||
Reference in New Issue
Block a user