mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 11:11:26 -03:00
fix(autocomplete): strip lastAccepted boundary from exported workflows (#1093)
The hidden __lm_autocomplete_meta_* widget persisted lastAccepted (insertedText/textSnapshot) into exported workflow JSON, leaking old prompt text even after the user deleted it. Patch app.graphToPrompt (shared by workflow export, Export API and queueing) to strip lastAccepted from the serialized result's widgets_values / widgets_values_named / output inputs. Only the exported artifact is touched; live node state, undo snapshots, copy/paste and local saves keep the boundary intact.
This commit is contained in:
@@ -45,6 +45,23 @@ import { app } from '../../../scripts/app.js'
|
||||
import { api } from '../../../scripts/api.js'
|
||||
// @ts-ignore
|
||||
import { getPoolConfigFromConnectedNode, getActiveLorasFromNode, updateConnectedTriggerWords, updateDownstreamLoaders } from '../../web/comfyui/utils.js'
|
||||
// @ts-ignore
|
||||
import { stripAutocompleteMetadataFromPromptResult } from '../../web/comfyui/autocomplete.js'
|
||||
|
||||
// Strip the autocomplete lastAccepted boundary from exported workflows.
|
||||
// lastAccepted carries old prompt text (insertedText/textSnapshot) and is
|
||||
// session-only state; it must not leak into exported JSON (#1093).
|
||||
// graphToPrompt is shared by workflow export, Export API and queueing.
|
||||
// Local saves go through the change-tracker snapshot (no graphToPrompt) and
|
||||
// are intentionally left untouched so cross-session caret continuity is kept.
|
||||
// Post-processing the resolved result avoids any window/race with
|
||||
// change-tracker or copy/paste serialization of live state.
|
||||
const originalGraphToPrompt = app.graphToPrompt.bind(app)
|
||||
app.graphToPrompt = async (...args: unknown[]) => {
|
||||
const result = await originalGraphToPrompt(...args)
|
||||
stripAutocompleteMetadataFromPromptResult(result)
|
||||
return result
|
||||
}
|
||||
|
||||
function forwardMiddleMouseToCanvas(container: HTMLElement) {
|
||||
if (!container) return
|
||||
|
||||
Reference in New Issue
Block a user