feat:dmx-painting-add-extend_params (#12098)

* dmx-painting-add-extend_params

* format-code

* 更新类型
This commit is contained in:
Caelan 2025-12-25 13:46:33 +08:00 committed by GitHub
parent 4ba0f2d25c
commit 0669253abb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 10 deletions

View File

@ -140,11 +140,14 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
let model = ''
let priceModel = ''
let image_size = ''
let extend_params = {}
for (const provider of Object.keys(modelGroups)) {
if (modelGroups[provider] && modelGroups[provider].length > 0) {
model = modelGroups[provider][0].id
priceModel = modelGroups[provider][0].price
image_size = modelGroups[provider][0].image_sizes[0].value
extend_params = modelGroups[provider][0].extend_params
break
}
}
@ -153,7 +156,8 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
model,
priceModel,
image_size,
modelGroups
modelGroups,
extend_params
}
}
@ -162,7 +166,7 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
const generationMode = params?.generationMode || painting?.generationMode || MODEOPTIONS[0].value
const { model, priceModel, image_size, modelGroups } = getFirstModelInfo(generationMode)
const { model, priceModel, image_size, modelGroups, extend_params } = getFirstModelInfo(generationMode)
return {
...DEFAULT_PAINTING,
@ -173,6 +177,7 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
modelGroups,
priceModel,
image_size,
extend_params,
...params
}
}
@ -190,7 +195,12 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
const onSelectModel = (modelId: string) => {
const model = allModels.find((m) => m.id === modelId)
if (model) {
updatePaintingState({ model: modelId, priceModel: model.price, image_size: model.image_sizes[0].value })
updatePaintingState({
model: modelId,
priceModel: model.price,
image_size: model.image_sizes[0].value,
extend_params: model.extend_params
})
}
}
@ -293,7 +303,7 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
clearImages()
const { model, priceModel, image_size, modelGroups } = getFirstModelInfo(v)
const { model, priceModel, image_size, modelGroups, extend_params } = getFirstModelInfo(v)
setModelOptions(modelGroups)
@ -309,9 +319,10 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
// 否则更新当前painting
updatePaintingState({
generationMode: v,
model: model,
image_size: image_size,
priceModel: priceModel
model,
image_size,
priceModel,
extend_params
})
}
}
@ -355,7 +366,8 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
const params = {
prompt,
model: painting.model,
n: painting.n
n: painting.n,
...painting?.extend_params
}
const headerExpand = {
@ -397,7 +409,8 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
const params = {
prompt,
n: painting.n,
model: painting.model
model: painting.model,
...painting?.extend_params
}
if (painting.image_size) {

View File

@ -84,7 +84,7 @@ export const MODEOPTIONS = [
// 获取模型分组数据
export const GetModelGroup = async (): Promise<DMXApiModelGroups> => {
try {
const response = await fetch('https://dmxapi.cn/cherry_painting_models_v2.json')
const response = await fetch('https://dmxapi.cn/cherry_painting_models_v3.json')
if (response.ok) {
const data = await response.json()

View File

@ -395,6 +395,7 @@ export interface DmxapiPainting extends PaintingParams {
autoCreate?: boolean
generationMode?: generationModeType
priceModel?: string
extend_params?: Record<string, unknown>
}
export interface TokenFluxPainting extends PaintingParams {