fix: Codex 自动压缩不触发 —— 接管时链接模型目录(绝对路径)进 config.toml (hot 1.5.83)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
(function initCanvasInputs(root) {
|
||||
function uniqueNonEmpty(values) {
|
||||
const seen = new Set();
|
||||
return (Array.isArray(values) ? values : []).filter((value) => {
|
||||
const normalized = typeof value === "string" ? value.trim() : "";
|
||||
if (!normalized || seen.has(normalized)) return false;
|
||||
seen.add(normalized);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
function collectUpstreamOutputs(node, readNodeOutput) {
|
||||
const out = { text: "", image: "", images: [] };
|
||||
if (!node || !node.inputs || typeof readNodeOutput !== "function") return out;
|
||||
|
||||
for (const key of Object.keys(node.inputs)) {
|
||||
const connections = (node.inputs[key] && node.inputs[key].connections) || [];
|
||||
for (const connection of connections) {
|
||||
const source = readNodeOutput(connection.node) || {};
|
||||
if (source.text && !out.text) out.text = String(source.text).trim();
|
||||
if (source.image) out.images.push(source.image);
|
||||
}
|
||||
}
|
||||
|
||||
out.images = uniqueNonEmpty(out.images);
|
||||
out.image = out.images[0] || "";
|
||||
return out;
|
||||
}
|
||||
|
||||
const api = { uniqueNonEmpty, collectUpstreamOutputs };
|
||||
if (typeof module !== "undefined" && module.exports) module.exports = api;
|
||||
root.CanvasInputs = api;
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
Reference in New Issue
Block a user