This commit is contained in:
sjy
2026-07-09 10:31:21 +08:00
8 changed files with 64 additions and 26 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -28,7 +28,7 @@
} }
})(); })();
</script> </script>
<script type="module" crossorigin src="/assets/index-kx3oQI_t.js"></script> <script type="module" crossorigin src="/assets/index-_9WDiveb.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css"> <link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
</head> </head>
<body> <body>
+41 -19
View File
@@ -41,25 +41,35 @@ function parseSizes(val: unknown): Record<string, Record<string, string>> {
// Default size options with pixel mappings // Default size options with pixel mappings
const SIZE_OPTIONS: Record<string, Record<string, string>> = { const SIZE_OPTIONS: Record<string, Record<string, string>> = {
"1K": {
"1:1": "1024x1024",
"4:3": "1152x864",
"3:4": "864x1152",
"16:9": "1312x736",
"9:16": "736x1312",
"3:2": "1248x832",
"2:3": "832x1248",
"21:9": "1568x672",
},
"2K": { "2K": {
"1:1": "2048×2048", "1:1": "2048x2048",
"4:3": "2304×1728", "4:3": "2304x1728",
"3:4": "1728×2304", "3:4": "1728x2304",
"16:9": "2560×1440", "16:9": "2848x1600",
"9:16": "1600×2848", "9:16": "1600x2848",
"3:2": "2496×1664", "3:2": "2496x1664",
"2:3": "1664×2496", "2:3": "1664x2496",
"21:9": "3024×1296", "21:9": "3136x1344",
}, },
"4K": { "4K": {
"1:1": "4096×4096", "1:1": "4096x4096",
"4:3": "4608×3456", "4:3": "4704x3520",
"3:4": "3520×4704", "3:4": "3520x4704",
"16:9": "5404×3040", "16:9": "5504x3040",
"9:16": "3040×5504", "9:16": "3040x5504",
"3:2": "4992×3328", "3:2": "4992x3328",
"2:3": "3328×4992", "2:3": "3328x4992",
"21:9": "6197×2656", "21:9": "6197x2656",
}, },
}; };
@@ -94,7 +104,7 @@ const AdminImageEngines: React.FC = () => {
const values = await form.validateFields(); const values = await form.validateFields();
// Build supportedSizes from form values // Build supportedSizes from form values
const sizes: Record<string, Record<string, string>> = {}; const sizes: Record<string, Record<string, string>> = {};
for (const tier of ["2K", "4K"]) { for (const tier of ["1K", "2K", "4K"]) {
const selected: string[] = values[`size_${tier}`] || []; const selected: string[] = values[`size_${tier}`] || [];
if (selected.length > 0) { if (selected.length > 0) {
sizes[tier] = {}; sizes[tier] = {};
@@ -147,7 +157,7 @@ const AdminImageEngines: React.FC = () => {
setModal({ open: true, engine: engine || null }); setModal({ open: true, engine: engine || null });
if (engine) { if (engine) {
const sizeFields: Record<string, string[]> = {}; const sizeFields: Record<string, string[]> = {};
for (const tier of ["2K", "4K"]) { for (const tier of ["1K", "2K", "4K"]) {
sizeFields[`size_${tier}`] = Object.keys(engine.supportedSizes?.[tier] || {}); sizeFields[`size_${tier}`] = Object.keys(engine.supportedSizes?.[tier] || {});
} }
form.setFieldsValue({ form.setFieldsValue({
@@ -161,6 +171,7 @@ const AdminImageEngines: React.FC = () => {
supportedModels: ['doubao-seedream-5-0-260128'], supportedModels: ['doubao-seedream-5-0-260128'],
defaultSize: '2K', defaultSize: '2K',
maxImageCount: 0, maxImageCount: 0,
size_1K: ALL_RATIOS,
size_2K: ALL_RATIOS, size_2K: ALL_RATIOS,
size_4K: ALL_RATIOS, size_4K: ALL_RATIOS,
}); });
@@ -187,6 +198,16 @@ const AdminImageEngines: React.FC = () => {
</div> </div>
), ),
}, },
{
title: '1K 支持比例', key: 'sizes_1k', width: 260,
render: (_: any, r: ImageEngine) => {
const ratios = Object.keys(r.supportedSizes?.["1K"] || {});
if (ratios.length === 0) return <span style={{ color: '#bfbfbf' }}>-</span>;
return <Space size={2} wrap>{ratios.map(ratio => (
<Tag key={ratio} color="green">{ratio} {r.supportedSizes["1K"][ratio]}</Tag>
))}</Space>;
},
},
{ {
title: '2K 支持比例', key: 'sizes_2k', width: 260, title: '2K 支持比例', key: 'sizes_2k', width: 260,
render: (_: any, r: ImageEngine) => { render: (_: any, r: ImageEngine) => {
@@ -294,7 +315,7 @@ const AdminImageEngines: React.FC = () => {
</Typography.Text> </Typography.Text>
</div> </div>
{["2K", "4K"].map(tier => ( {["1K", "2K", "4K"].map(tier => (
<div key={tier} style={{ <div key={tier} style={{
background: '#fafbfc', borderRadius: 10, padding: '12px 16px', background: '#fafbfc', borderRadius: 10, padding: '12px 16px',
marginBottom: 12, border: '1px solid #f0f0f5', marginBottom: 12, border: '1px solid #f0f0f5',
@@ -318,6 +339,7 @@ const AdminImageEngines: React.FC = () => {
<Form.Item name="defaultSize" label="默认尺寸档位"> <Form.Item name="defaultSize" label="默认尺寸档位">
<Select size="large" options={[ <Select size="large" options={[
{ value: '1K', label: '1K' },
{ value: '2K', label: '2K' }, { value: '2K', label: '2K' },
{ value: '4K', label: '4K' }, { value: '4K', label: '4K' },
]} /> ]} />
@@ -115,7 +115,7 @@ const AdminVideoEngines: React.FC = () => {
form.resetFields(); form.resetFields();
form.setFieldsValue({ form.setFieldsValue({
isActive: true, priority: 0, isActive: true, priority: 0,
maxDuration: 15, maxDuration: 30,
maxImageCount: 2, maxImageCount: 2,
maxVideoCount: 0, maxVideoCount: 0,
maxAudioCount: 0, maxAudioCount: 0,
@@ -123,7 +123,7 @@ const AdminVideoEngines: React.FC = () => {
supportsUniversalReference: true, supportsUniversalReference: true,
supportedRatios: ['16:9', '4:3', '1:1', '3:4', '9:16', '21:9'], supportedRatios: ['16:9', '4:3', '1:1', '3:4', '9:16', '21:9'],
supportedResolutions: ['480p', '720p', '1080p'], supportedResolutions: ['480p', '720p', '1080p'],
supportedDurations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], supportedDurations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
}); });
} }
}; };
@@ -50,6 +50,7 @@ async def create_menu_config(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return menu return menu
@@ -89,6 +90,7 @@ async def update_menu_config(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return menu return menu
@@ -121,4 +123,5 @@ async def delete_menu_config(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return {"message": "ok"} return {"message": "ok"}
@@ -72,6 +72,7 @@ async def create_package(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return _to_out(pkg) return _to_out(pkg)
@@ -109,6 +110,7 @@ async def update_package(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return _to_out(pkg) return _to_out(pkg)
@@ -142,4 +144,5 @@ async def delete_package(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return {"ok": True} return {"ok": True}
@@ -58,6 +58,7 @@ async def save_config(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return result return result
@@ -81,6 +82,7 @@ async def reset_default(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return result return result
@@ -114,6 +116,7 @@ async def import_config(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return result return result
+10 -3
View File
@@ -202,6 +202,7 @@ async def create_user(
), ),
ip=None, ip=None,
) )
await db.commit()
return user return user
@@ -233,6 +234,7 @@ async def update_user_menus(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return {"message": "ok"} return {"message": "ok"}
@@ -289,6 +291,7 @@ async def adjust_credits(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return {"message": "ok"} return {"message": "ok"}
@@ -319,6 +322,7 @@ async def update_user_status(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return {"message": "ok"} return {"message": "ok"}
@@ -1594,7 +1598,7 @@ async def update_system_config(
if not config: if not config:
raise HTTPException(status_code=404, detail="配置不存在") raise HTTPException(status_code=404, detail="配置不存在")
config.value = str(req.value) config.value = str(req.value)
await db.commit() await db.flush()
await log_operation( await log_operation(
db, db,
admin.id, admin.id,
@@ -1611,6 +1615,7 @@ async def update_system_config(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return config return config
@@ -2185,7 +2190,7 @@ async def upload_pdf(
key=config_key, key=config_key,
value=url, value=url,
)) ))
await db.commit() await db.flush()
await log_operation( await log_operation(
db, db,
admin.id, admin.id,
@@ -2202,6 +2207,7 @@ async def upload_pdf(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return {"url": url} return {"url": url}
@@ -2247,7 +2253,7 @@ async def upload_logo(
value=url, value=url,
description="网站Logo图片", description="网站Logo图片",
)) ))
await db.commit() await db.flush()
await log_operation( await log_operation(
db, db,
admin.id, admin.id,
@@ -2263,6 +2269,7 @@ async def upload_logo(
ensure_ascii=False, ensure_ascii=False,
), ),
) )
await db.commit()
return {"url": url} return {"url": url}