diff --git a/src/views/GraphView.vue b/src/views/GraphView.vue index fadee3662..d80737bd7 100644 --- a/src/views/GraphView.vue +++ b/src/views/GraphView.vue @@ -77,6 +77,29 @@ watch( { immediate: true } ) +if (isElectron()) { + watch( + () => queueStore.tasks, + (newTasks, oldTasks) => { + // Report tasks that previously running but are now completed (i.e. in history) + const oldRunningTaskIds = new Set( + oldTasks.filter((task) => task.isRunning).map((task) => task.promptId) + ) + newTasks + .filter( + (task) => oldRunningTaskIds.has(task.promptId) && task.isHistory + ) + .forEach((task) => { + electronAPI().Events.incrementUserProperty( + `execution:${task.displayStatus.toLowerCase()}`, + 1 + ) + }) + }, + { deep: true } + ) +} + watchEffect(() => { const fontSize = settingStore.get('Comfy.TextareaWidget.FontSize') document.documentElement.style.setProperty( diff --git a/vite.electron.config.mts b/vite.electron.config.mts index 9e7404411..be09952ab 100644 --- a/vite.electron.config.mts +++ b/vite.electron.config.mts @@ -63,6 +63,9 @@ const mockElectronAPI: Plugin = { Events: { trackEvent: (event_name, event_data) => { console.log('trackEvent', event_name, event_data) + }, + incrementUserProperty: (property, value) => { + console.log('incrementUserProperty', property, value) } } };`