feat: track copilot events (#13342)

This commit is contained in:
Shivam Mishra
2026-01-22 18:38:04 +05:30
committed by GitHub
parent 75f75ce786
commit 8eb6fd1bff
6 changed files with 146 additions and 61 deletions

View File

@@ -7,10 +7,9 @@ import {
import { useAccount } from 'dashboard/composables/useAccount';
import { useConfig } from 'dashboard/composables/useConfig';
import { useCamelCase } from 'dashboard/composables/useTransformKeys';
import { useAlert, useTrack } from 'dashboard/composables';
import { useAlert } from 'dashboard/composables';
import { useI18n } from 'vue-i18n';
import { FEATURE_FLAGS } from 'dashboard/featureFlags';
import { OPEN_AI_EVENTS } from 'dashboard/helper/AnalyticsHelper/events';
import TasksAPI from 'dashboard/api/captain/tasks';
export function useCaptain() {
@@ -79,23 +78,6 @@ export function useCaptain() {
useAlert(errorMessage);
};
// === Analytics ===
/**
* Records analytics for AI-related events.
* @param {string} type - The type of event.
* @param {Object} payload - Additional data for the event.
* @returns {Promise<void>}
*/
const recordAnalytics = async (type, payload) => {
const event = OPEN_AI_EVENTS[type.toUpperCase()];
if (event) {
useTrack(event, {
type,
...payload,
});
}
};
// === Task Methods ===
/**
* Rewrites content with a specific operation.
@@ -234,8 +216,5 @@ export function useCaptain() {
getReplySuggestion,
followUp,
processEvent,
// Analytics
recordAnalytics,
};
}