Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/components/helpcenter/HelpCenterMenuContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ import { electronAPI, isElectron } from '@/utils/envUtil'
import { formatVersionAnchor } from '@/utils/formatUtil'
import { useConflictAcknowledgment } from '@/workbench/extensions/manager/composables/useConflictAcknowledgment'
import { useManagerState } from '@/workbench/extensions/manager/composables/useManagerState'
import { useComfyManagerService } from '@/workbench/extensions/manager/services/comfyManagerService'
import { ManagerTab } from '@/workbench/extensions/manager/types/comfyManagerTypes'

// Types
Expand Down Expand Up @@ -369,6 +370,18 @@ const menuItems = computed<MenuItem[]>(() => {
}
})
}
if (!isElectron() && !isCloud) {
items.push({
key: 'update-comfyui',
type: 'item',
icon: 'icon-[lucide--download]',
label: t('helpCenter.updateComfyUI'),
action: () => {
onUpdateComfyUI()
emit('close')
}
Comment thread
Myestery marked this conversation as resolved.
})
}

items.push({
key: 'more',
Expand Down Expand Up @@ -545,6 +558,13 @@ const onReinstall = (): void => {
}
}

const onUpdateComfyUI = (): void => {
const { updateComfyUI, rebootComfyUI } = useComfyManagerService()
void updateComfyUI({ is_stable: true }).then(() => {
void rebootComfyUI()
})
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const onReleaseClick = (release: ReleaseNote): void => {
trackResourceClick('release_notes', true)
void releaseStore.handleShowChangelog(release.version)
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,8 @@
"updateAvailable": "Update",
"desktopUserGuide": "Desktop User Guide",
"openDevTools": "Open Dev Tools",
"reinstall": "Re-Install"
"reinstall": "Re-Install",
"updateComfyUI": "Update ComfyUI"
},
"releaseToast": {
"newVersionAvailable": "New update is out!",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type ManagerQueueStatus = components['schemas']['QueueStatus']
type InstallPackParams = components['schemas']['InstallPackParams']
type InstalledPacksResponse = components['schemas']['InstalledPacksResponse']
type UpdateAllPacksParams = components['schemas']['UpdateAllPacksParams']
type UpdateComfyUIParams = components['schemas']['UpdateComfyUIParams']
type ManagerTaskHistory = components['schemas']['HistoryResponse']
type QueueTaskItem = components['schemas']['QueueTaskItem']

Expand All @@ -26,6 +27,7 @@ enum ManagerRoute {
RESET_QUEUE = 'manager/queue/reset',
QUEUE_STATUS = 'manager/queue/status',
UPDATE_ALL = 'manager/queue/update_all',
UPDATE_COMFYUI = 'manager/queue/update_comfyui',
LIST_INSTALLED = 'customnode/installed',
GET_NODES = 'customnode/getmappings',
IMPORT_FAIL_INFO = 'customnode/import_fail_info',
Expand Down Expand Up @@ -271,6 +273,33 @@ export const useComfyManagerService = () => {
)
}

const updateComfyUI = async (
params: UpdateComfyUIParams = { is_stable: true },
ui_id?: string,
signal?: AbortSignal
) => {
const errorContext = 'Updating ComfyUI'
const routeSpecificErrors = {
400: 'Bad Request: Missing required parameters',
403: 'Forbidden: To use this action, a security_level of `middle or below` is required'
}

const queryParams = {
client_id: api.clientId ?? api.initialClientId ?? 'unknown',
ui_id: ui_id || uuidv4(),
...params
}

return executeRequest<null>(
() =>
managerApiClient.get(ManagerRoute.UPDATE_COMFYUI, {
params: queryParams,
signal
}),
{ errorContext, routeSpecificErrors, isQueueOperation: true }
)
}

const rebootComfyUI = async (signal?: AbortSignal) => {
const errorContext = 'Rebooting ComfyUI'
const routeSpecificErrors = {
Expand Down Expand Up @@ -335,6 +364,7 @@ export const useComfyManagerService = () => {
updateAllPacks,

// System operations
updateComfyUI,
rebootComfyUI,
isLegacyManagerUI
}
Expand Down
1 change: 1 addition & 0 deletions tests-ui/tests/store/comfyManagerStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ describe('useComfyManagerStore', () => {
disablePack: vi.fn().mockResolvedValue(null),
updatePack: vi.fn().mockResolvedValue(null),
updateAllPacks: vi.fn().mockResolvedValue(null),
updateComfyUI: vi.fn().mockResolvedValue(null),
rebootComfyUI: vi.fn().mockResolvedValue(null),
isLegacyManagerUI: vi.fn().mockResolvedValue(false)
}
Expand Down