File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { app } from "../../scripts/app.js" ;
22import { applyBadgeToNode } from "./handle_load_nodes.js" ;
3+ import { hasModelInput } from "./model_price.js" ;
34app . registerExtension ( {
45 name : "bizyair.handle.node.configure" ,
56 nodeCreated ( node , app ) {
6- // const possibleWidgetNames = ["model_name", "model"];
77 // 在这里可以拿到变化之后的值,并且也可以拿到node,这时候给node切换badge即可
88 if ( node && node . widgets && Array . isArray ( node . widgets ) ) {
9- // 只有model选择的widget才注册callback函数
9+ if ( ! hasModelInput ( node ) ) {
10+ return ;
11+ }
1012 // 不仅仅是切换model才会修改模型定价,比如切换输入参数也会修改模型定价
1113 node . widgets . forEach ( ( widget ) => {
12- // widget.callback = async function () {
13- // // 用户手动修改widget时,强制刷新badge(不使用缓存的模型类型)
14- // await applyBadgeToNode(node, true);
15- // };
14+ widget . callback = async function ( ) {
15+ // 用户手动修改widget时,强制刷新badge(不使用缓存的模型类型)
16+ await applyBadgeToNode ( node , true ) ;
17+ } ;
1618 } ) ;
1719 }
1820 } ,
Original file line number Diff line number Diff line change 1- 1.2.86
1+ 1.2.87
You can’t perform that action at this time.
0 commit comments