Fix issue with duplicate tasks (#64)

* Fix issue with duplicate tasks

* PR feedback
This commit is contained in:
Matt Rubens 2025-06-02 09:43:49 -04:00 committed by GitHub
parent e4a69574ad
commit 692a8ff31e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -267,8 +267,8 @@ export const getTasks = async ({
SELECT
e.taskId,
e.userId,
e.apiProvider AS provider,
e.modelId as model,
argMin(e.apiProvider, e.timestamp) AS provider,
argMin(e.modelId, e.timestamp) as model,
any(fm.mode) AS mode,
MAX(CASE WHEN e.type = 'Task Completed' THEN 1 ELSE 0 END) AS completed,
SUM(CASE WHEN e.type = 'LLM Completion' THEN COALESCE(e.inputTokens, 0) + COALESCE(e.outputTokens, 0) ELSE 0 END) AS tokens,
@ -280,7 +280,7 @@ export const getTasks = async ({
WHERE
e.orgId = {orgId: String}
AND e.type IN ({types: Array(String)})
GROUP BY 1, 2, 3, 4
GROUP BY 1, 2
ORDER BY timestamp DESC
`,
format: 'JSONEachRow',