fix(stage-ui): default artistry provider to none (#1854)

This commit is contained in:
jim139129
2026-05-21 03:05:55 +08:00
committed by GitHub
parent 7534adf476
commit cd908015b3
5 changed files with 47 additions and 10 deletions
@@ -3,7 +3,7 @@ import { any, array, number, object, optional, string } from 'valibot'
import { createConfig } from '../libs/electron/persistence'
export const artistryConfigSchema = object({
artistryProvider: optional(string(), 'comfyui'),
artistryProvider: optional(string(), 'none'),
artistryGlobals: optional(object({
comfyuiServerUrl: optional(string(), 'http://localhost:8188'),
comfyuiSavedWorkflows: optional(array(any()), []),
@@ -25,6 +25,7 @@ import { ReplicateProvider } from './providers/replicate'
const log = useLogg('artistry-bridge').useGlobalConfig()
const DEFAULT_REMIX_ID = '48250602'
const DEFAULT_ARTISTRY_PROVIDER = 'none'
interface ArtistrySyncSnapshot {
provider?: string
@@ -147,10 +148,15 @@ export async function generateHeadless(params: {
}
const executionPromise = (async () => {
const requestedProvider = (params.provider || artistryConfig.get()?.artistryProvider || 'comfyui').trim().toLowerCase()
const requestedProvider = (params.provider || artistryConfig.get()?.artistryProvider || DEFAULT_ARTISTRY_PROVIDER).trim().toLowerCase()
if (requestedProvider === 'none') {
log.log('[Headless] Provider is \'none\'. Bypassing generation.')
throw new Error('Artistry provider is disabled.')
}
const provider = artistryProviders.get(requestedProvider)
if (!provider) {
log.error(`[Headless] CRITICAL: Provider '${requestedProvider}' not found in registry! fallback to replicate`)
log.error(`[Headless] Provider '${requestedProvider}' not found in registry.`)
throw new Error(`Provider '${requestedProvider}' not found.`)
}
@@ -250,7 +256,7 @@ export async function generateHeadless(params: {
return await executionPromise
}
catch (err) {
return { error: err instanceof Error ? err.message : String(err) }
return { error: errorMessageFrom(err) ?? String(err) }
}
finally {
// Remove from map after completion so it can be re-triggered later
@@ -291,7 +297,7 @@ async function handleArtistryTrigger(params: {
globals: robustParse(artistryConfigOverrides.globals || artistryConfigOverrides.Globals || cardDefaults.globals, 'artistryGlobals'),
}
const { config: artistryConfig } = await injeca.resolve({ config: 'configs:artistry' } as { config: ProvidedBy<Config<typeof artistryConfigSchema>> })
const providerId = config.provider || cardDefaults.provider || artistryConfig.get()?.artistryProvider || 'comfyui'
const providerId = config.provider || cardDefaults.provider || artistryConfig.get()?.artistryProvider || DEFAULT_ARTISTRY_PROVIDER
// [BY DESIGN]: Short-circuit if artistry is explicitly disabled (provider: 'none').
// This prevents noisy "Provider not found" errors when the feature is intentionally bypassed.
@@ -463,7 +469,7 @@ export async function setupArtistryBridge(params: {
defineInvokeHandler(params.context, artistrySyncConfig, (payload) => {
log.log(`🔄 Syncing artistry config to main. Provider: ${payload.provider}`)
params.artistryConfig.update({
artistryProvider: payload.provider || params.artistryConfig.get()?.artistryProvider || 'comfyui',
artistryProvider: payload.provider || params.artistryConfig.get()?.artistryProvider || DEFAULT_ARTISTRY_PROVIDER,
artistryGlobals: payload.globals || params.artistryConfig.get()?.artistryGlobals || {
comfyuiServerUrl: 'http://localhost:8188',
comfyuiSavedWorkflows: [],
@@ -57,9 +57,8 @@ const availableProviders = computed(() => [
<div class="max-w-full">
<fieldset
class="min-w-0 flex flex-row gap-4 overflow-x-auto scroll-smooth pb-2"
style="scrollbar-width: none;"
role="radiogroup"
flex="~ row gap-4"
min-w-0 of-x-auto scroll-smooth role="radiogroup"
>
<RadioCardSimple
v-for="provider in availableProviders"
@@ -0,0 +1,29 @@
import { createPinia, setActivePinia } from 'pinia'
import { beforeEach, describe, expect, it } from 'vitest'
import { useArtistryStore } from './artistry'
/**
* @example
* describe('artistry store', () => {})
*/
describe('artistry store', () => {
beforeEach(() => {
setActivePinia(createPinia())
})
/**
* @example
* it('defaults to disabled artistry without treating ComfyUI as configured', () => {})
*/
it('defaults to disabled artistry without treating ComfyUI as configured', () => {
const artistryStore = useArtistryStore()
// @example
expect(artistryStore.globalProvider).toBe('none')
// @example
expect(artistryStore.activeProvider).toBe('none')
// @example
expect(artistryStore.configured).toBe(false)
})
})
@@ -19,7 +19,7 @@ export interface ComfyUIWorkflowTemplate {
export const useArtistryStore = defineStore('artistry', () => {
// --- Persistent Global Settings (User Preferences) ---
const globalProvider = useLocalStorageManualReset<string>('artistry-provider', 'comfyui')
const globalProvider = useLocalStorageManualReset<string>('artistry-provider', 'none')
const globalModel = useLocalStorageManualReset<string>('artistry-model', '')
const globalPromptPrefix = useLocalStorageManualReset<string>('artistry-prompt-prefix', '')
const globalProviderOptions = useLocalStorageManualReset<Record<string, any> | undefined>('artistry-provider-options', undefined)
@@ -119,6 +119,9 @@ export const useArtistryStore = defineStore('artistry', () => {
if (!activeProvider.value)
return false
if (activeProvider.value === 'none')
return false
if (activeProvider.value === 'replicate') {
return !!replicateApiKey.value
}