Files
ComfyUI_frontend/src/stores/aboutPanelStore.ts
Dante dac58ad811 feat: show template version in system info for local builds (#9018)
## Summary
<img width="985" height="417" alt="스크린샷 2026-02-21 오전 1 05 10"
src="https://github.com/user-attachments/assets/4543a5aa-d1ae-4be7-971e-7b1454625829"
/>



- Add `installed_templates_version` and `required_templates_version` to
the system stats schema
- Display the template version as a badge on the About page alongside
ComfyUI and Frontend badges
- Display the template version as a row in the local System Info table
- Highlight badge (red severity) and table row (red text) when installed
version doesn't match required version, so users can quickly spot
outdated templates

Fixes #4006

## Test plan

- [x] Open Settings > About and verify "Templates v{version}" badge
appears
- [x] Verify "Templates Version" row appears in System Info table
- [ ] When `installed_templates_version` matches
`required_templates_version`: badge is default color, table row is
default color
- [ ] When versions don't match: badge turns red, table row turns red
- [ ] When `installed_templates_version` is absent (package not
installed): badge is hidden, table row shows empty

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 15:21:21 +09:00

82 lines
2.6 KiB
TypeScript

import { defineStore } from 'pinia'
import { computed } from 'vue'
import { useExternalLink } from '@/composables/useExternalLink'
import { isCloud, isDesktop } from '@/platform/distribution/types'
import type { AboutPageBadge } from '@/types/comfy'
import { electronAPI } 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 templatesVersion = computed(
() =>
systemStatsStore?.systemStats?.system?.installed_templates_version ?? ''
)
const requiredTemplatesVersion = computed(
() =>
systemStatsStore?.systemStats?.system?.required_templates_version ?? ''
)
const isTemplatesOutdated = computed(
() =>
templatesVersion.value !== '' &&
requiredTemplatesVersion.value !== '' &&
templatesVersion.value !== requiredTemplatesVersion.value
)
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 ${
isDesktop
? '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'
},
...(templatesVersion.value
? [
{
label: `Templates v${templatesVersion.value}`,
url: 'https://pypi.org/project/comfyui-workflow-templates/',
icon: 'pi pi-book',
...(isTemplatesOutdated.value
? { severity: 'danger' as const }
: {})
}
]
: []),
{
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
}
})