Files
ComfyUI_frontend/src/stores/aboutPanelStore.ts
Christian Byrne 5fa0295ff5 feat: update About panel (system stats and version info) to work on cloud (#6940)
## Summary

Updates the About Panel in the settings to work with the cloud-specific
`GET /system_stats` response schema.

| Before | After |
| ------ | ----- |
| <img width="1922" height="1436" alt="Selection_2392"
src="https://github.com/user-attachments/assets/3b97bf38-7eeb-4f46-9c59-eb681f5d7401"
/> | <img width="1922" height="1436" alt="Selection_2391"
src="https://github.com/user-attachments/assets/1d30e604-654a-4d48-ba05-4cac3b54c2ba"
/> |

## Screenshots (if applicable)

OSS version stays the same:

<img width="1922" height="1436" alt="Selection_2393"
src="https://github.com/user-attachments/assets/40e1eeeb-fc5a-4ad0-b37f-dc5d0374901e"
/>

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6940-feat-update-About-panel-system-stats-and-version-info-to-work-on-cloud-2b66d73d365081f69b6fedfe9507ba92)
by [Unito](https://www.unito.io)
2025-11-25 16:34:34 -07:00

56 lines
1.8 KiB
TypeScript

import { defineStore } from 'pinia'
import { computed } from 'vue'
import { useExternalLink } from '@/composables/useExternalLink'
import { isCloud } from '@/platform/distribution/types'
import type { AboutPageBadge } from '@/types/comfy'
import { electronAPI, isElectron } from '@/utils/envUtil'
import { formatCommitHash } from '@/utils/formatUtil'
import { useExtensionStore } from './extensionStore'
import { useSystemStatsStore } from './systemStatsStore'
export const useAboutPanelStore = defineStore('aboutPanel', () => {
const frontendVersion = __COMFYUI_FRONTEND_VERSION__
const extensionStore = useExtensionStore()
const systemStatsStore = useSystemStatsStore()
const { staticUrls } = useExternalLink()
const coreVersion = computed(
() => systemStatsStore?.systemStats?.system?.comfyui_version ?? ''
)
const coreBadges = computed<AboutPageBadge[]>(() => [
// In electron, the ComfyUI is packaged without the git repo,
// so the python server's API doesn't have the version info.
{
label: `ComfyUI ${
isElectron()
? 'v' + electronAPI().getComfyUIVersion()
: formatCommitHash(coreVersion.value)
}`,
url: isCloud ? staticUrls.comfyOrg : staticUrls.github,
icon: isCloud ? 'pi pi-cloud' : 'pi pi-github'
},
{
label: `ComfyUI_frontend v${frontendVersion}`,
url: staticUrls.githubFrontend,
icon: 'pi pi-github'
},
{
label: 'Discord',
url: staticUrls.discord,
icon: 'pi pi-discord'
},
{ label: 'ComfyOrg', url: staticUrls.comfyOrg, icon: 'pi pi-globe' }
])
const allBadges = computed<AboutPageBadge[]>(() => [
...coreBadges.value,
...extensionStore.extensions.flatMap((e) => e.aboutPageBadges ?? [])
])
return {
badges: allBadges
}
})