Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 4 additions & 2 deletions src/extensions/core/uploadAudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ app.registerExtension({
audio.setAttribute('name', 'media')
const audioUIWidget: DOMWidget<HTMLAudioElement, string> =
node.addDOMWidget(inputName, /* name=*/ 'audioUI', audio)
audioUIWidget.options.canvasOnly = true
audioUIWidget.options.canvasOnly = false

let mediaRecorder: MediaRecorder | null = null
let isRecording = false
Expand Down Expand Up @@ -376,10 +376,12 @@ app.registerExtension({
mediaRecorder.stop()
}
},
{ serialize: false, canvasOnly: true }
{ serialize: false, canvasOnly: false }
)

recordWidget.label = t('g.startRecording')
// Override the type for Vue rendering while keeping 'button' for LiteGraph
recordWidget.type = 'audiorecord'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[architecture] medium Priority

Issue: Type override hack using recordWidget.type = 'audiorecord' after widget creation
Context: While this solves the immediate problem, it creates a maintenance concern by bypassing the formal widget type system
Suggestion: Consider registering 'audiorecord' as a proper button widget variant or creating a formal audio record widget type in the widget registry


const originalOnRemoved = node.onRemoved
node.onRemoved = function () {
Expand Down
6 changes: 0 additions & 6 deletions src/lib/litegraph/src/types/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export type IWidget =
| ISelectButtonWidget
| ITextareaWidget
| IAssetWidget
| IAudioRecordWidget

export interface IBooleanWidget extends IBaseWidget<boolean, 'toggle'> {
type: 'toggle'
Expand Down Expand Up @@ -228,11 +227,6 @@ export interface ITextareaWidget extends IBaseWidget<string, 'textarea'> {
value: string
}

export interface IAudioRecordWidget extends IBaseWidget<string, 'audiorecord'> {
type: 'audiorecord'
value: string
}

export interface IAssetWidget
extends IBaseWidget<string, 'asset', IWidgetOptions<string[]>> {
type: 'asset'
Expand Down

This file was deleted.

9 changes: 0 additions & 9 deletions src/schemas/nodeDef/nodeDefSchemaV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,6 @@ const zTextareaInputSpec = zBaseInputOptions.extend({
.optional()
})

const zAudioRecordInputSpec = zBaseInputOptions.extend({
type: z.literal('AUDIORECORD'),
name: z.string(),
isOptional: z.boolean().optional(),
options: z.record(z.unknown()).optional()
})

const zCustomInputSpec = zBaseInputOptions.extend({
type: z.string(),
name: z.string(),
Expand All @@ -174,7 +167,6 @@ const zInputSpec = z.union([
zColorInputSpec,
zFileUploadInputSpec,
zImageInputSpec,
zAudioRecordInputSpec,
zImageCompareInputSpec,
zMarkdownInputSpec,
zTreeSelectInputSpec,
Expand Down Expand Up @@ -230,7 +222,6 @@ export type GalleriaInputSpec = z.infer<typeof zGalleriaInputSpec>
export type SelectButtonInputSpec = z.infer<typeof zSelectButtonInputSpec>
export type TextareaInputSpec = z.infer<typeof zTextareaInputSpec>
export type CustomInputSpec = z.infer<typeof zCustomInputSpec>
export type AudioRecordInputSpec = z.infer<typeof zAudioRecordInputSpec>

export type InputSpec = z.infer<typeof zInputSpec>
export type OutputSpec = z.infer<typeof zOutputSpec>
Expand Down
4 changes: 1 addition & 3 deletions src/scripts/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type {
IStringWidget
} from '@/lib/litegraph/src/types/widgets'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useAudioRecordWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useAudioRecordWidget'
import { useBooleanWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useBooleanWidget'
import { useChartWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useChartWidget'
import { useColorWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useColorWidget'
Expand Down Expand Up @@ -305,6 +304,5 @@ export const ComfyWidgets: Record<string, ComfyWidgetConstructor> = {
CHART: transformWidgetConstructorV2ToV1(useChartWidget()),
GALLERIA: transformWidgetConstructorV2ToV1(useGalleriaWidget()),
SELECTBUTTON: transformWidgetConstructorV2ToV1(useSelectButtonWidget()),
TEXTAREA: transformWidgetConstructorV2ToV1(useTextareaWidget()),
AUDIO_RECORD: transformWidgetConstructorV2ToV1(useAudioRecordWidget())
TEXTAREA: transformWidgetConstructorV2ToV1(useTextareaWidget())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[architecture] high Priority

Issue: Removing formal AUDIO_RECORD widget registration entirely from ComfyWidgets
Context: This creates an inconsistency where AUDIO_RECORD widgets exist but aren't formally registered in the widget system, potentially causing issues with widget discovery and type checking
Suggestion: Either register AUDIO_RECORD as a proper widget type or document why this specific widget type needs to bypass the formal registration system

}