mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
api_nodes: added prices for ByteDance Image nodes (#5152)
This commit is contained in:
@@ -1383,6 +1383,38 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
|
|||||||
},
|
},
|
||||||
ViduStartEndToVideoNode: {
|
ViduStartEndToVideoNode: {
|
||||||
displayPrice: '$0.4/Run'
|
displayPrice: '$0.4/Run'
|
||||||
|
},
|
||||||
|
ByteDanceImageNode: {
|
||||||
|
displayPrice: (node: LGraphNode): string => {
|
||||||
|
const modelWidget = node.widgets?.find(
|
||||||
|
(w) => w.name === 'model'
|
||||||
|
) as IComboWidget
|
||||||
|
|
||||||
|
if (!modelWidget) return 'Token-based'
|
||||||
|
|
||||||
|
const model = String(modelWidget.value)
|
||||||
|
|
||||||
|
if (model.includes('seedream-3-0-t2i')) {
|
||||||
|
return '$0.03/Run'
|
||||||
|
}
|
||||||
|
return 'Token-based'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ByteDanceImageEditNode: {
|
||||||
|
displayPrice: (node: LGraphNode): string => {
|
||||||
|
const modelWidget = node.widgets?.find(
|
||||||
|
(w) => w.name === 'model'
|
||||||
|
) as IComboWidget
|
||||||
|
|
||||||
|
if (!modelWidget) return 'Token-based'
|
||||||
|
|
||||||
|
const model = String(modelWidget.value)
|
||||||
|
|
||||||
|
if (model.includes('seededit-3-0-i2i')) {
|
||||||
|
return '$0.03/Run'
|
||||||
|
}
|
||||||
|
return 'Token-based'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1470,7 +1502,10 @@ export const useNodePricing = () => {
|
|||||||
// Google/Gemini nodes
|
// Google/Gemini nodes
|
||||||
GeminiNode: ['model'],
|
GeminiNode: ['model'],
|
||||||
// OpenAI nodes
|
// OpenAI nodes
|
||||||
OpenAIChatNode: ['model']
|
OpenAIChatNode: ['model'],
|
||||||
|
// ByteDance
|
||||||
|
ByteDanceImageNode: ['model'],
|
||||||
|
ByteDanceImageEditNode: ['model']
|
||||||
}
|
}
|
||||||
return widgetMap[nodeType] || []
|
return widgetMap[nodeType] || []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1694,6 +1694,30 @@ describe('useNodePricing', () => {
|
|||||||
'$0.1-0.4/Run (varies with quad, style, texture & quality)'
|
'$0.1-0.4/Run (varies with quad, style, texture & quality)'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should return correct pricing for exposed ByteDance models', () => {
|
||||||
|
const { getNodeDisplayPrice } = useNodePricing()
|
||||||
|
|
||||||
|
const testCases = [
|
||||||
|
{
|
||||||
|
node_name: 'ByteDanceImageNode',
|
||||||
|
model: 'seedream-3-0-t2i-250415',
|
||||||
|
expected: '$0.03/Run'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
node_name: 'ByteDanceImageEditNode',
|
||||||
|
model: 'seededit-3-0-i2i-250628',
|
||||||
|
expected: '$0.03/Run'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
testCases.forEach(({ node_name, model, expected }) => {
|
||||||
|
const node = createMockNode(node_name, [
|
||||||
|
{ name: 'model', value: model }
|
||||||
|
])
|
||||||
|
expect(getNodeDisplayPrice(node)).toBe(expected)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user