This commit is contained in:
greeneclipse committed 2026-10-16 00:34:06 +02:00
1 parent 6586722652
commit 1e7c7bbfbb
65 files changed
+1345 -640

No files matched your search

@@ -172,7 +172,7 @@ func (s *Server) scanCostGroup(ctx context.Context, group costGroup, whereSQL st
COALESCE(sum(u.cost_micros),0)
FROM ai_usage_daily u
LEFT JOIN companies c ON c.id = u.company_id
WHERE ` + whereSQL + `
WHERE ` + strings.ReplaceAll(whereSQL, "company_id =", "u.company_id =") + `
GROUP BY u.company_id, c.name
ORDER BY COALESCE(sum(u.cost_micros),0) DESC
LIMIT ` + strconv.Itoa(adminAICostsMaxRows)
@@ -186,7 +186,7 @@ func (s *Server) scanCostGroup(ctx context.Context, group costGroup, whereSQL st
FROM ai_usage_daily u
LEFT JOIN users usr ON usr.id = u.user_id
LEFT JOIN companies c ON c.id = u.company_id
WHERE ` + whereSQL + `
WHERE ` + strings.ReplaceAll(whereSQL, "company_id =", "u.company_id =") + `
GROUP BY u.user_id, usr.email, u.company_id, c.name
ORDER BY COALESCE(sum(u.cost_micros),0) DESC
LIMIT ` + strconv.Itoa(adminAICostsMaxRows)
@@ -198,7 +198,7 @@ func (s *Server) scanCostGroup(ctx context.Context, group costGroup, whereSQL st
COALESCE(sum(u.completion_tokens),0), COALESCE(sum(u.total_tokens),0),
COALESCE(sum(u.cost_micros),0)
FROM ai_usage_daily u
WHERE ` + whereSQL + `
WHERE ` + strings.ReplaceAll(whereSQL, "company_id =", "u.company_id =") + `
GROUP BY u.model
ORDER BY COALESCE(sum(u.cost_micros),0) DESC
LIMIT ` + strconv.Itoa(adminAICostsMaxRows)