图片增加最大上传个数
This commit is contained in:
+548
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<script type="module" crossorigin src="/assets/index-ChXF-ot2.js"></script>
|
<script type="module" crossorigin src="/assets/index-3RDqkBKt.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ interface ImageEngine {
|
|||||||
supportedModels: string[];
|
supportedModels: string[];
|
||||||
supportedSizes: Record<string, Record<string, string>>;
|
supportedSizes: Record<string, Record<string, string>>;
|
||||||
defaultSize: string;
|
defaultSize: string;
|
||||||
|
maxImageCount: number;
|
||||||
generateUrl: string;
|
generateUrl: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
priority: number;
|
priority: number;
|
||||||
@@ -111,6 +112,7 @@ const AdminImageEngines: React.FC = () => {
|
|||||||
supported_models: JSON.stringify(values.supportedModels || []),
|
supported_models: JSON.stringify(values.supportedModels || []),
|
||||||
supported_sizes: JSON.stringify(sizes),
|
supported_sizes: JSON.stringify(sizes),
|
||||||
default_size: values.defaultSize || '2K',
|
default_size: values.defaultSize || '2K',
|
||||||
|
max_image_count: values.maxImageCount ?? 0,
|
||||||
generate_url: values.generateUrl || '',
|
generate_url: values.generateUrl || '',
|
||||||
is_active: values.isActive ?? true,
|
is_active: values.isActive ?? true,
|
||||||
priority: values.priority ?? 0,
|
priority: values.priority ?? 0,
|
||||||
@@ -158,6 +160,7 @@ const AdminImageEngines: React.FC = () => {
|
|||||||
isActive: true, priority: 0,
|
isActive: true, priority: 0,
|
||||||
supportedModels: ['doubao-seedream-5-0-260128'],
|
supportedModels: ['doubao-seedream-5-0-260128'],
|
||||||
defaultSize: '2K',
|
defaultSize: '2K',
|
||||||
|
maxImageCount: 0,
|
||||||
size_2K: ALL_RATIOS,
|
size_2K: ALL_RATIOS,
|
||||||
size_4K: ALL_RATIOS,
|
size_4K: ALL_RATIOS,
|
||||||
});
|
});
|
||||||
@@ -204,6 +207,10 @@ const AdminImageEngines: React.FC = () => {
|
|||||||
))}</Space>;
|
))}</Space>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '最大图片', dataIndex: 'maxImageCount', width: 100,
|
||||||
|
render: (v: number) => <Tag color="purple">{v} 张</Tag>,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '状态', dataIndex: 'isActive', width: 80,
|
title: '状态', dataIndex: 'isActive', width: 80,
|
||||||
render: (v: boolean) => <Tag color={v ? 'green' : 'default'}>{v ? '启用' : '停用'}</Tag>,
|
render: (v: boolean) => <Tag color={v ? 'green' : 'default'}>{v ? '启用' : '停用'}</Tag>,
|
||||||
@@ -315,6 +322,9 @@ const AdminImageEngines: React.FC = () => {
|
|||||||
{ value: '4K', label: '4K' },
|
{ value: '4K', label: '4K' },
|
||||||
]} />
|
]} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item name="maxImageCount" label="最大图片数量">
|
||||||
|
<Input type="number" size="large" />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item name="generateUrl" label="生成接口地址">
|
<Form.Item name="generateUrl" label="生成接口地址">
|
||||||
<Input placeholder="https://ark.cn-beijing.volces.com/api/v3/images/generations" size="large" />
|
<Input placeholder="https://ark.cn-beijing.volces.com/api/v3/images/generations" size="large" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
"""add max image count to image engines
|
||||||
|
|
||||||
|
Revision ID: a1b2c3d4e5f6
|
||||||
|
Revises: f7a3b2c1d4e5
|
||||||
|
Create Date: 2026-07-01 00:00:00.000000
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
revision: str = 'a1b2c3d4e5f6'
|
||||||
|
down_revision: Union[str, None] = 'f7a3b2c1d4e5'
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.add_column('image_engines', sa.Column('max_image_count', sa.Integer(), server_default='0', nullable=False))
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.drop_column('image_engines', 'max_image_count')
|
||||||
@@ -44,5 +44,6 @@ async def list_active_engines(
|
|||||||
"supported_models": models,
|
"supported_models": models,
|
||||||
"supported_sizes": sizes,
|
"supported_sizes": sizes,
|
||||||
"default_size": e.default_size,
|
"default_size": e.default_size,
|
||||||
|
"max_image_count": e.max_image_count,
|
||||||
})
|
})
|
||||||
return {"items": items}
|
return {"items": items}
|
||||||
@@ -17,6 +17,7 @@ class ImageEngine(Base, TimestampMixin):
|
|||||||
# {"2K":{"1:1":"2048×2048",...}, "4K":{"1:1":"4096×4096",...}}
|
# {"2K":{"1:1":"2048×2048",...}, "4K":{"1:1":"4096×4096",...}}
|
||||||
supported_sizes: Mapped[str] = mapped_column(Text, default='{}')
|
supported_sizes: Mapped[str] = mapped_column(Text, default='{}')
|
||||||
default_size: Mapped[str] = mapped_column(String(32), default="2K")
|
default_size: Mapped[str] = mapped_column(String(32), default="2K")
|
||||||
|
max_image_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||||
generate_url: Mapped[str | None] = mapped_column(String(512), nullable=True, default="")
|
generate_url: Mapped[str | None] = mapped_column(String(512), nullable=True, default="")
|
||||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||||
priority: Mapped[int] = mapped_column(Integer, default=0)
|
priority: Mapped[int] = mapped_column(Integer, default=0)
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ class GenerationAIImageEngineOptionOut(BaseModel):
|
|||||||
)
|
)
|
||||||
default_size: str | None = Field(None, description="默认图片分辨率档位,例如 2K")
|
default_size: str | None = Field(None, description="默认图片分辨率档位,例如 2K")
|
||||||
priority: int = Field(0, description="引擎优先级,数值越大越优先")
|
priority: int = Field(0, description="引擎优先级,数值越大越优先")
|
||||||
|
max_image_count: int = Field(0, description="最大图片数量")
|
||||||
|
|
||||||
|
|
||||||
class GenerationAIVideoEngineOptionOut(BaseModel):
|
class GenerationAIVideoEngineOptionOut(BaseModel):
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class ImageEngineCreate(BaseModel):
|
|||||||
supported_models: str = Field(default='["doubao-seedream-5-0-260128"]')
|
supported_models: str = Field(default='["doubao-seedream-5-0-260128"]')
|
||||||
supported_sizes: str = Field(default='{}')
|
supported_sizes: str = Field(default='{}')
|
||||||
default_size: str = Field(default="2K", max_length=32)
|
default_size: str = Field(default="2K", max_length=32)
|
||||||
|
max_image_count: int = Field(default=0)
|
||||||
generate_url: str = Field(default="", max_length=512)
|
generate_url: str = Field(default="", max_length=512)
|
||||||
is_active: bool = True
|
is_active: bool = True
|
||||||
priority: int = 0
|
priority: int = 0
|
||||||
@@ -31,6 +32,7 @@ class ImageEnginePublic(BaseModel):
|
|||||||
supported_models: list[str] = []
|
supported_models: list[str] = []
|
||||||
supported_sizes: dict[str, dict[str, str]] = {}
|
supported_sizes: dict[str, dict[str, str]] = {}
|
||||||
default_size: str = "2K"
|
default_size: str = "2K"
|
||||||
|
max_image_count: int = 0
|
||||||
|
|
||||||
|
|
||||||
class ImageEngineListResponse(BaseModel):
|
class ImageEngineListResponse(BaseModel):
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ async def list_generation_ai_engine_options(db: AsyncSession) -> GenerationAIEng
|
|||||||
supported_sizes=_image_supported_sizes(engine),
|
supported_sizes=_image_supported_sizes(engine),
|
||||||
default_size=engine.default_size,
|
default_size=engine.default_size,
|
||||||
priority=engine.priority or 0,
|
priority=engine.priority or 0,
|
||||||
|
max_image_count=engine.max_image_count,
|
||||||
)
|
)
|
||||||
for engine in image_result.scalars().all()
|
for engine in image_result.scalars().all()
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user