fix(server): improve ai generation analytics correlation
This commit is contained in:
@@ -108,10 +108,15 @@ describe('useAnalytics conversation product events', () => {
|
||||
$ai_total_tokens: 20,
|
||||
$insert_id: 'ai-generation:round-1',
|
||||
app_surface: 'web',
|
||||
capture_surface: 'client',
|
||||
conversation_id: 'session-1',
|
||||
conversation_id_source: 'client_runtime',
|
||||
round_id: 'round-1',
|
||||
provider_type: 'custom',
|
||||
usage_source: 'reported',
|
||||
token_usage_available: true,
|
||||
cost_usd_source: 'unavailable',
|
||||
cost_usd_known: false,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -135,10 +140,15 @@ describe('useAnalytics conversation product events', () => {
|
||||
$ai_provider: 'ollama',
|
||||
$insert_id: 'ai-generation:round-2',
|
||||
app_surface: 'web',
|
||||
capture_surface: 'client',
|
||||
conversation_id: 'session-1',
|
||||
conversation_id_source: 'client_runtime',
|
||||
round_id: 'round-2',
|
||||
provider_type: 'custom',
|
||||
usage_source: 'unavailable',
|
||||
token_usage_available: false,
|
||||
cost_usd_source: 'unavailable',
|
||||
cost_usd_known: false,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -429,10 +429,15 @@ export function useAnalytics() {
|
||||
...(totalTokens != null && { $ai_total_tokens: totalTokens }),
|
||||
$insert_id: `ai-generation:${properties.round_id}`,
|
||||
app_surface: getConversationAnalyticsSurface(),
|
||||
capture_surface: 'client',
|
||||
conversation_id: properties.conversation_id,
|
||||
conversation_id_source: 'client_runtime',
|
||||
round_id: properties.round_id,
|
||||
provider_type: properties.provider_type,
|
||||
usage_source: properties.usage_source,
|
||||
token_usage_available: properties.usage_source !== 'unavailable',
|
||||
cost_usd_source: 'unavailable',
|
||||
cost_usd_known: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user