Skip to content

Commit bb7df86

Browse files
authored
fix (#206)
* fix * version
1 parent b519962 commit bb7df86

3 files changed

Lines changed: 22 additions & 13 deletions

File tree

bizyui/js/handle_node_configure.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function chainCallback(originalCallback, newCallback) {
1818
}
1919
}
2020

21-
function isImagesInputSlot(slot) {
22-
return slot?.name === 'images' || slot?.localized_name === 'images'
21+
function isTrackedLinkedInput(slot) {
22+
return Boolean((slot?.name || slot?.localized_name) && slot?.widget === undefined)
2323
}
2424

2525
app.registerExtension({
@@ -39,11 +39,11 @@ app.registerExtension({
3939
originalOnConnectionsChange,
4040
async function (type, slotIndex, isConnected, linkInfo, ioSlot) {
4141
const inputSlot = this.inputs?.[slotIndex]
42-
if (!isImagesInputSlot(inputSlot)) {
42+
if (!isTrackedLinkedInput(inputSlot)) {
4343
return
4444
}
4545

46-
// 只处理 images 输入槽位本身的连线变化,避免误判 output 变化。
46+
// 只处理这类输入槽位本身的连线变化,避免误判 output 变化。
4747
if (ioSlot && ioSlot !== inputSlot) {
4848
return
4949
}

bizyui/js/model_price.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ export function hasModelInput(node) {
7777
* @param {number} badgeOptions.iconOptions.uuid - 图标uuid 用于删除 自定义属性
7878
*/
7979
export function addCustomBadge(node, badgeOptions) {
80-
const customBadge = new LGraphBadge(badgeOptions);
80+
const BadgeConstructor = globalThis.LGraphBadge;
81+
if (typeof BadgeConstructor !== "function") {
82+
throw new Error("LGraphBadge is not available");
83+
}
84+
85+
const customBadge = new BadgeConstructor(badgeOptions);
8186
// 每次添加badge 清空所有badge 因为badge没有一个唯一标识符,并且价格展示也就一个badge 所以直接全部清除
8287
node.badges = [];
8388
node.badges.push(() => customBadge);
@@ -145,16 +150,20 @@ export function getBadgeConfigByCoinType(coinType, priceText) {
145150
};
146151
}
147152

148-
function getImagesLinkFlag(node) {
153+
function getLinkedInputFlags(node) {
149154
if (!node?.inputs || !Array.isArray(node.inputs)) {
150-
return "false";
155+
return {};
151156
}
152157

153-
const imagesInput = node.inputs.find(
154-
(input) => input?.name === "images" || input?.localized_name === "images"
155-
);
158+
return node.inputs.reduce((flags, input) => {
159+
const inputName = input?.name || input?.localized_name;
160+
if (!inputName || input?.widget !== undefined) {
161+
return flags;
162+
}
156163

157-
return imagesInput?.link != null ? "true" : "false";
164+
flags[inputName] = input?.link != null ? "true" : "false";
165+
return flags;
166+
}, {});
158167
}
159168

160169
/**
@@ -179,7 +188,7 @@ export async function addPriceBadgeToNode(node, modelName = "") {
179188
nodeInputs.model = modelName;
180189
}
181190

182-
nodeInputs.images = getImagesLinkFlag(node);
191+
Object.assign(nodeInputs, getLinkedInputFlags(node));
183192

184193
// 获取价格信息
185194
const priceResult = await fetchNodePrice(modelName, nodeInputs);

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.19
1+
1.3.20

0 commit comments

Comments
 (0)