mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
Compare commits
1 Commits
fix/codera
...
claude/sla
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
603883d48a |
@@ -244,8 +244,9 @@ app.registerExtension({
|
||||
inputName,
|
||||
'',
|
||||
openFileSelection,
|
||||
{ serialize: false, canvasOnly: true }
|
||||
{ canvasOnly: true }
|
||||
)
|
||||
uploadWidget.serialize = false
|
||||
uploadWidget.label = t('g.choose_file_to_upload')
|
||||
|
||||
useNodeDragAndDrop(node, {
|
||||
@@ -401,8 +402,9 @@ app.registerExtension({
|
||||
mediaRecorder.stop()
|
||||
}
|
||||
},
|
||||
{ serialize: false, canvasOnly: false }
|
||||
{ canvasOnly: false }
|
||||
)
|
||||
recordWidget.serialize = false
|
||||
|
||||
recordWidget.label = t('g.startRecording')
|
||||
// Override the type for Vue rendering while keeping 'button' for LiteGraph
|
||||
|
||||
@@ -55,10 +55,10 @@ export const useBoundingBoxWidget = (): ComfyWidgetConstructorV2 => {
|
||||
}
|
||||
},
|
||||
{
|
||||
serialize: true,
|
||||
canvasOnly: false
|
||||
}
|
||||
)
|
||||
rawWidget.serialize = true
|
||||
|
||||
if (!isBoundingBoxLikeWidget(rawWidget)) {
|
||||
throw new Error(`Unexpected widget type: ${rawWidget.type}`)
|
||||
@@ -82,10 +82,10 @@ export const useBoundingBoxWidget = (): ComfyWidgetConstructorV2 => {
|
||||
step: 10,
|
||||
step2: 1,
|
||||
precision: 0,
|
||||
serialize: false,
|
||||
canvasOnly: true
|
||||
}
|
||||
)
|
||||
subWidget.serialize = false
|
||||
|
||||
if (!isNumericWidget(subWidget)) {
|
||||
throw new Error(`Unexpected widget type: ${subWidget.type}`)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
||||
import type { IChartWidget } from '@/lib/litegraph/src/types/widgets'
|
||||
import type {
|
||||
IChartWidget,
|
||||
IWidgetOptions
|
||||
} from '@/lib/litegraph/src/types/widgets'
|
||||
import { isChartInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
|
||||
import type {
|
||||
ChartInputSpec,
|
||||
@@ -18,10 +21,10 @@ export const useChartWidget = (): ComfyWidgetConstructorV2 => {
|
||||
const chartType = options.type || 'line'
|
||||
|
||||
const widget = node.addWidget('chart', name, options.data || {}, () => {}, {
|
||||
serialize: true,
|
||||
type: chartType,
|
||||
...options
|
||||
}) as IChartWidget
|
||||
} as IWidgetOptions) as IChartWidget
|
||||
widget.serialize = true
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
@@ -11,9 +11,13 @@ export const useColorWidget = (): ComfyWidgetConstructorV2 => {
|
||||
const { name, options } = inputSpec as ColorInputSpec
|
||||
const defaultValue = options?.default || '#000000'
|
||||
|
||||
const widget = node.addWidget('color', name, defaultValue, () => {}, {
|
||||
serialize: true
|
||||
}) as IColorWidget
|
||||
const widget = node.addWidget(
|
||||
'color',
|
||||
name,
|
||||
defaultValue,
|
||||
() => {}
|
||||
) as IColorWidget
|
||||
widget.serialize = true
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
||||
import type { IGalleriaWidget } from '@/lib/litegraph/src/types/widgets'
|
||||
import type {
|
||||
IGalleriaWidget,
|
||||
IWidgetOptions
|
||||
} from '@/lib/litegraph/src/types/widgets'
|
||||
import type {
|
||||
GalleriaInputSpec,
|
||||
InputSpec as InputSpecV2
|
||||
@@ -15,11 +18,9 @@ export const useGalleriaWidget = (): ComfyWidgetConstructorV2 => {
|
||||
name,
|
||||
options.images || [],
|
||||
() => {},
|
||||
{
|
||||
serialize: true,
|
||||
...options
|
||||
}
|
||||
{ ...options } as IWidgetOptions
|
||||
) as IGalleriaWidget
|
||||
widget.serialize = true
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ export const useImageCompareWidget = (): ComfyWidgetConstructorV2 => {
|
||||
return (node: LGraphNode, inputSpec: InputSpecV2): IImageCompareWidget => {
|
||||
const { name, options = {} } = inputSpec as ImageCompareInputSpec
|
||||
|
||||
const widget = node.addWidget('imagecompare', name, ['', ''], () => {}, {
|
||||
serialize: true,
|
||||
...options
|
||||
}) as IImageCompareWidget
|
||||
|
||||
// widget.serialize controls workflow persistence; widget.options.serialize
|
||||
// controls prompt (API) serialization — only disable the former.
|
||||
const widget = node.addWidget(
|
||||
'imagecompare',
|
||||
name,
|
||||
['', ''],
|
||||
() => {},
|
||||
options
|
||||
) as IImageCompareWidget
|
||||
widget.serialize = false
|
||||
|
||||
return widget
|
||||
|
||||
@@ -368,7 +368,6 @@ export const useImagePreviewWidget = () => {
|
||||
) => {
|
||||
return node.addCustomWidget(
|
||||
new ImagePreviewWidget(node, inputSpec.name, {
|
||||
serialize: false,
|
||||
canvasOnly: true
|
||||
})
|
||||
)
|
||||
|
||||
@@ -95,10 +95,10 @@ export const useImageUploadWidget = () => {
|
||||
'image',
|
||||
() => openFileSelection(),
|
||||
{
|
||||
serialize: false,
|
||||
canvasOnly: true
|
||||
}
|
||||
)
|
||||
uploadWidget.serialize = false
|
||||
uploadWidget.label = t('g.choose_file_to_upload')
|
||||
|
||||
// Add our own callback to the combo widget to render an image when it changes
|
||||
|
||||
@@ -593,7 +593,7 @@ describe('useRemoteWidget', () => {
|
||||
describe('auto-refresh on task completion', () => {
|
||||
it('should add auto-refresh toggle widget', () => {
|
||||
const mockNode = createMockLGraphNode({
|
||||
addWidget: vi.fn(),
|
||||
addWidget: vi.fn(() => createMockWidget()),
|
||||
widgets: []
|
||||
})
|
||||
const mockWidget = createMockWidget({
|
||||
@@ -612,10 +612,7 @@ describe('useRemoteWidget', () => {
|
||||
'toggle',
|
||||
'Auto-refresh after generation',
|
||||
false,
|
||||
expect.any(Function),
|
||||
{
|
||||
serialize: false
|
||||
}
|
||||
expect.any(Function)
|
||||
)
|
||||
})
|
||||
|
||||
@@ -623,7 +620,7 @@ describe('useRemoteWidget', () => {
|
||||
const addEventListenerSpy = vi.spyOn(api, 'addEventListener')
|
||||
|
||||
const mockNode = createMockLGraphNode({
|
||||
addWidget: vi.fn(),
|
||||
addWidget: vi.fn(() => createMockWidget()),
|
||||
widgets: []
|
||||
})
|
||||
const mockWidget = createMockWidget({
|
||||
@@ -654,7 +651,7 @@ describe('useRemoteWidget', () => {
|
||||
})
|
||||
|
||||
const mockNode = createMockLGraphNode({
|
||||
addWidget: vi.fn(),
|
||||
addWidget: vi.fn(() => createMockWidget()),
|
||||
widgets: []
|
||||
})
|
||||
const mockWidget = createMockWidget({})
|
||||
@@ -692,7 +689,7 @@ describe('useRemoteWidget', () => {
|
||||
})
|
||||
|
||||
const mockNode = createMockLGraphNode({
|
||||
addWidget: vi.fn(),
|
||||
addWidget: vi.fn(() => createMockWidget()),
|
||||
widgets: []
|
||||
})
|
||||
const mockWidget = createMockWidget({})
|
||||
@@ -726,7 +723,7 @@ describe('useRemoteWidget', () => {
|
||||
const removeEventListenerSpy = vi.spyOn(api, 'removeEventListener')
|
||||
|
||||
const mockNode = createMockLGraphNode({
|
||||
addWidget: vi.fn(),
|
||||
addWidget: vi.fn(() => createMockWidget()),
|
||||
widgets: [],
|
||||
onRemoved: undefined
|
||||
})
|
||||
|
||||
@@ -266,11 +266,9 @@ export function useRemoteWidget<
|
||||
false,
|
||||
(value: boolean) => {
|
||||
autoRefreshEnabled = value
|
||||
},
|
||||
{
|
||||
serialize: false
|
||||
}
|
||||
)
|
||||
autoRefreshWidget.serialize = false
|
||||
|
||||
// Register event listener
|
||||
api.addEventListener('execution_success', handleExecutionSuccess)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
||||
import type { ITextareaWidget } from '@/lib/litegraph/src/types/widgets'
|
||||
import type {
|
||||
ITextareaWidget,
|
||||
IWidgetOptions
|
||||
} from '@/lib/litegraph/src/types/widgets'
|
||||
import type {
|
||||
InputSpec as InputSpecV2,
|
||||
TextareaInputSpec
|
||||
@@ -16,12 +19,12 @@ export const useTextareaWidget = (): ComfyWidgetConstructorV2 => {
|
||||
options.default || '',
|
||||
() => {},
|
||||
{
|
||||
serialize: true,
|
||||
rows: options.rows || 5,
|
||||
cols: options.cols || 50,
|
||||
...options
|
||||
}
|
||||
} as IWidgetOptions
|
||||
) as ITextareaWidget
|
||||
widget.serialize = true
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
@@ -131,10 +131,10 @@ export function addValueControlWidgets(
|
||||
function () {},
|
||||
{
|
||||
values: ['fixed', 'increment', 'decrement', 'randomize'],
|
||||
serialize: false, // Don't include this in prompt.
|
||||
canvasOnly: true
|
||||
}
|
||||
) as IComboWidget
|
||||
valueControl.serialize = false // Don't include this in prompt.
|
||||
|
||||
valueControl.tooltip =
|
||||
'Allows the linked widget to be changed automatically, for example randomizing the noise seed.'
|
||||
@@ -156,11 +156,9 @@ export function addValueControlWidgets(
|
||||
'string',
|
||||
getName('control_filter_list', 'controlFilterListName'),
|
||||
'',
|
||||
function () {},
|
||||
{
|
||||
serialize: false // Don't include this in prompt.
|
||||
}
|
||||
function () {}
|
||||
) as IStringWidget
|
||||
comboFilter.serialize = false // Don't include this in prompt.
|
||||
updateControlWidgetLabel(comboFilter)
|
||||
comboFilter.tooltip =
|
||||
"Allows for filtering the list of values when changing the value via the control generate mode. Allows for RegEx matches in the format /abc/ to only filter to values containing 'abc'."
|
||||
|
||||
Reference in New Issue
Block a user