[Desktop] Report completed generation status (#2279)

This commit is contained in:
Chenlei Hu
2025-01-17 17:36:46 -05:00
committed by GitHub
parent d503873980
commit af26b9ad6d
2 changed files with 26 additions and 0 deletions

View File

@@ -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(

View File

@@ -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)
}
}
};`