Skip to content

Commit fea1afb

Browse files
committed
fixes
1 parent b9ec880 commit fea1afb

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

packages/core/src/queries/clickhouse/spans/fetchConversation.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ export async function fetchConversation({
6363
) AS total_tokens,
6464
sum(duration_ms) FILTER (WHERE type IN ('prompt', 'chat', 'external')) AS total_duration,
6565
sum(cost) AS total_cost,
66-
min(started_at) AS started_at,
67-
max(ended_at) AS ended_at,
66+
min(started_at) AS conversation_started_at,
67+
max(ended_at) AS conversation_ended_at,
6868
max(started_at) AS latest_started_at,
69-
anyLast(source) AS source,
70-
anyLast(commit_uuid) AS commit_uuid,
71-
anyLast(experiment_uuid) AS experiment_uuid
69+
anyLast(source) AS latest_source,
70+
anyLast(commit_uuid) AS latest_commit_uuid,
71+
anyLast(experiment_uuid) AS latest_experiment_uuid
7272
FROM ${SPANS_TABLE}
7373
WHERE ${conditions.join(' AND ')}
7474
GROUP BY document_log_uuid
@@ -85,12 +85,12 @@ export async function fetchConversation({
8585
total_tokens: string
8686
total_duration: string
8787
total_cost: string
88-
started_at: string
89-
ended_at: string
88+
conversation_started_at: string
89+
conversation_ended_at: string
9090
latest_started_at: string
91-
source: string
92-
commit_uuid: string
93-
experiment_uuid: string | null
91+
latest_source: string
92+
latest_commit_uuid: string
93+
latest_experiment_uuid: string | null
9494
}>()
9595

9696
if (rows.length === 0) {
@@ -106,11 +106,11 @@ export async function fetchConversation({
106106
totalTokens: Number(row.total_tokens),
107107
totalDuration: Number(row.total_duration),
108108
totalCost: Number(row.total_cost),
109-
startedAt: row.started_at,
110-
endedAt: row.ended_at,
109+
startedAt: row.conversation_started_at,
110+
endedAt: row.conversation_ended_at,
111111
latestStartedAt: row.latest_started_at,
112-
source: row.source as LogSources | null,
113-
commitUuid: row.commit_uuid,
114-
experimentUuid: row.experiment_uuid,
112+
source: row.latest_source as LogSources | null,
113+
commitUuid: row.latest_commit_uuid,
114+
experimentUuid: row.latest_experiment_uuid,
115115
}
116116
}

packages/core/src/queries/clickhouse/spans/fetchConversations.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ export async function fetchConversations({
115115
) AS total_tokens,
116116
sum(duration_ms) FILTER (WHERE type IN ('prompt', 'chat', 'external')) AS total_duration,
117117
sum(cost) AS total_cost,
118-
min(started_at) AS started_at,
119-
max(ended_at) AS ended_at,
118+
min(started_at) AS conversation_started_at,
119+
max(ended_at) AS conversation_ended_at,
120120
max(started_at) AS latest_started_at,
121-
anyLast(source) AS source,
122-
anyLast(commit_uuid) AS commit_uuid,
123-
anyLast(experiment_uuid) AS experiment_uuid
121+
anyLast(source) AS latest_source,
122+
anyLast(commit_uuid) AS latest_commit_uuid,
123+
anyLast(experiment_uuid) AS latest_experiment_uuid
124124
FROM ${SPANS_TABLE}
125125
WHERE ${conditions.join(' AND ')}
126126
GROUP BY document_log_uuid
@@ -138,12 +138,12 @@ export async function fetchConversations({
138138
total_tokens: string
139139
total_duration: string
140140
total_cost: string
141-
started_at: string
142-
ended_at: string
141+
conversation_started_at: string
142+
conversation_ended_at: string
143143
latest_started_at: string
144-
source: string
145-
commit_uuid: string
146-
experiment_uuid: string | null
144+
latest_source: string
145+
latest_commit_uuid: string
146+
latest_experiment_uuid: string | null
147147
}>()
148148

149149
const hasMore = rows.length > limit
@@ -156,12 +156,12 @@ export async function fetchConversations({
156156
totalTokens: Number(row.total_tokens),
157157
totalDuration: Number(row.total_duration),
158158
totalCost: Number(row.total_cost),
159-
startedAt: row.started_at,
160-
endedAt: row.ended_at,
159+
startedAt: row.conversation_started_at,
160+
endedAt: row.conversation_ended_at,
161161
latestStartedAt: row.latest_started_at,
162-
source: row.source as LogSources | null,
163-
commitUuid: row.commit_uuid,
164-
experimentUuid: row.experiment_uuid,
162+
source: row.latest_source as LogSources | null,
163+
commitUuid: row.latest_commit_uuid,
164+
experimentUuid: row.latest_experiment_uuid,
165165
}))
166166

167167
const lastItem = items.length > 0 ? items[items.length - 1] : null

0 commit comments

Comments
 (0)