Key updates: Added AddFramesToVideoFolder node to add frames to a video folder Introduced VideoFolderProvider and VideoDefinitionProvider nodes to manage video folders and video definitions Added FadeToInVideoFolder node for fading between frames in a video folder Implemented ListedSVDConditioning node for applying SVD conditioning to a list of parameters Added VideoFolderFFMPEGVideoInterpolate node to interpolate frames in a video folder using FFmpeg Introduced AudioFolderProvider and AudioDefinitionProvider nodes for managing audio folders and definitions Added AddAudioToAudioFolder and AddSilenceToAudioFolder nodes for adding audio files and silence to audio folders Implemented GetAudioFilesLengthsFromAudioFolder node to retrieve lengths of audio files in a folder Added AudioFolderRenderAudio node to join audio files in an audio folder Introduced GenerateMusic node for generating music from descriptions using the AudioCraft library Added XttsNode for text-to-speech conversion using the XTTS library Implemented AdjustAudioVolumeForFiles node to adjust volume for a list of audio files The changes also include the addition of LiteLLM nodes for text generation: Added FuncAnysToText node that runs Python code with multiple input types and outputs a string Introduced FuncAnysToLatent node for running code that outputs a latent representation Added FuncAnysToString node for executing code with various inputs and producing a string output Implemented FuncAnysToList node to run code that takes different input types and returns a list Added FuncAnysToCond node for running code with multiple inputs and generating a conditioning output These new nodes expand the capabilities for video and audio processing, allowing more advanced manipulations and generation of video and audio content within the graph.
48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
import { app } from "../../scripts/app.js";
|
|
import { ComfyWidgets } from "../../scripts/widgets.js";
|
|
import marked from "./marked.js";
|
|
|
|
|
|
|
|
// Displays input markdown on a node
|
|
|
|
app.registerExtension({
|
|
name: "pysssss.ShowMarkdown",
|
|
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
|
if (nodeData.internal_state_display || nodeData.name == "ShowMarkdown") {
|
|
// When the node is executed we will be sent the input markdown, display this in the widget
|
|
const onExecuted = nodeType.prototype.onExecuted;
|
|
nodeType.prototype.onExecuted = function (message) {
|
|
onExecuted?.apply(this, arguments);
|
|
|
|
if (this.widgets) {
|
|
const pos = this.widgets.findIndex((w) => w.name === "markdown");
|
|
if (pos !== -1) {
|
|
for (let i = pos; i < this.widgets.length; i++) {
|
|
this.widgets[i].onRemove?.();
|
|
}
|
|
this.widgets.length = pos;
|
|
}
|
|
}
|
|
|
|
for (const list of message.text) {
|
|
const w = ComfyWidgets["STRING"](this, "markdown", ["STRING", { multiline: true }], app).widget;
|
|
|
|
// Convert markdown to HTML
|
|
const html = marked(list);
|
|
|
|
// Create a new div element to hold the rendered markdown
|
|
const div = document.createElement("div");
|
|
div.classList.add("markdown-widget");
|
|
div.style.opacity = 0.6;
|
|
div.innerHTML = html;
|
|
|
|
// Replace the input element with the div containing the rendered markdown
|
|
w.inputEl.parentNode.replaceChild(div, w.inputEl);
|
|
}
|
|
|
|
this.onResize?.(this.size);
|
|
};
|
|
}
|
|
},
|
|
}); |