remove: 移除 image-01-live 模型及相关代码

This commit is contained in:
zwbcc
2026-03-28 21:07:29 +08:00
parent e20f53e253
commit 04068da6b0
4 changed files with 6 additions and 78 deletions

View File

@@ -1,6 +1,6 @@
# 图片生成器
MiniMax 文生图工具,基于 `image-01` / `image-01-live` 模型。
MiniMax 文生图工具,基于 `image-01` 模型。
**访问:** `http://域名或IP:8195`
@@ -93,15 +93,14 @@ image-generator/
| 参数 | 默认 | 说明 |
|------|------|------|
| `model` | `image-01` | `image-01` / `image-01-live` |
| `model` | `image-01` | 模型,目前仅支持 `image-01` |
| `prompt` | 必填 | 图片描述,最多 1500 字符 |
| `aspect_ratio` | `16:9` | `1:1` `16:9` `4:3` `3:2` `2:3` `3:4` `9:16` `21:9` |
| `response_format` | `url` | `url`24h有效`base64` |
| `n` | `1` | 数量 1-9 |
| `seed` | 随机 | 整数,用于复现 |
| `width` / `height` | — | 自定义分辨率 512-20488的倍数 |
| `style.style_type` | — | 画风:漫画/元气/中世纪/水彩(仅 live |
| `style.style_weight` | 0.8 | 画风权重 0.1-1.0(仅 live |
### 常见错误

11
app.js
View File

@@ -55,7 +55,7 @@ app.post('/api/generate', async (req, res) => {
if (!prompt || typeof prompt !== 'string' || !prompt.trim()) {
return res.status(400).json({ error: '请输入图片描述' });
}
if (model !== 'image-01' && model !== 'image-01-live') {
if (model !== 'image-01') {
return res.status(400).json({ error: 'model 参数无效' });
}
@@ -78,15 +78,6 @@ app.post('/api/generate', async (req, res) => {
if (prompt_optimizer) payload.prompt_optimizer = true;
if (aigc_watermark) payload.aigc_watermark = true;
// style only for image-01-live
if (model === 'image-01-live' && style) {
const { style_type, style_weight } = style;
if (style_type) {
payload.style = { style_type };
if (style_weight != null) payload.style.style_weight = style_weight;
}
}
const baseUrl = cfg.baseUrl || 'https://api.minimaxi.com';
const endpoint = `${baseUrl}/v1/image_generation`;

View File

@@ -36,17 +36,7 @@
<main>
<!-- Model selector -->
<div class="model-tabs">
<button class="model-tab active" data-model="image-01">
<span class="tab-name">image-01</span>
<span class="tab-desc">标准模型</span>
</button>
<button class="model-tab" data-model="image-01-live">
<span class="tab-name">image-01-live</span>
<span class="tab-desc">支持画风</span>
</button>
</div>
<form id="generateForm">
@@ -127,18 +117,7 @@
<p class="opt-note">同时设置宽高时优先于比例</p>
</div>
<!-- image-01-live: style -->
<div class="opt-group style-group" id="styleGroup" style="display:none">
<label class="opt-label">画风类型</label>
<select id="styleType">
<option value="漫画">漫画</option>
<option value="元气">元气</option>
<option value="中世纪">中世纪</option>
<option value="水彩">水彩</option>
</select>
<label class="opt-label" style="margin-top:10px">画风权重 <span class="opt-hint" id="weightHint">0.8</span></label>
<input type="range" id="styleWeight" min="1" max="10" value="8" step="1" class="weight-slider" />
</div>
<!-- Toggles -->
<div class="toggle-group">

41
ui.js
View File

@@ -31,10 +31,6 @@ const nPlus = $('nPlus');
const seedInput = $('seedInput');
const widthInput = $('widthInput');
const heightInput = $('heightInput');
const styleGroup = $('styleGroup');
const styleType = $('styleType');
const styleWeight = $('styleWeight');
const weightHint = $('weightHint');
const promptOptimizer= $('promptOptimizer');
const watermark = $('watermark');
const settingsModal = $('settingsModal');
@@ -46,30 +42,6 @@ const apiKeyInput = $('apiKeyInput');
const toggleKey = $('toggleKey');
const baseUrlInput = $('baseUrlInput');
// ── Model tabs ─────────────────────────────────────────────────
document.querySelectorAll('.model-tab').forEach(tab => {
tab.addEventListener('click', () => {
const model = tab.dataset.model;
setModel(model);
});
});
function setModel(model) {
currentModel = model;
document.querySelectorAll('.model-tab').forEach(t =>
t.classList.toggle('active', t.dataset.model === model)
);
const isLive = model === 'image-01-live';
styleGroup.style.display = isLive ? '' : 'none';
// 21:9 only for image-01
const opt21_9 = aspectRatio.querySelector('option[value="21:9"]');
if (opt21_9) opt21_9.disabled = isLive;
if (isLive && aspectRatio.value === '21:9') aspectRatio.value = '16:9';
}
// ── Stepper (n) ────────────────────────────────────────────────
nMinus.addEventListener('click', () => {
@@ -82,12 +54,6 @@ nPlus.addEventListener('click', () => {
if (v <= 9) nInput.value = v;
});
// ── Weight slider ──────────────────────────────────────────────
styleWeight.addEventListener('input', () => {
weightHint.textContent = (styleWeight.value / 10).toFixed(1);
});
// ── Helpers ────────────────────────────────────────────────────
function setLoading(on) {
@@ -135,13 +101,6 @@ function buildPayload() {
if (promptOptimizer.checked) payload.prompt_optimizer = true;
if (watermark.checked) payload.aigc_watermark = true;
if (currentModel === 'image-01-live') {
payload.style = {
style_type: styleType.value,
style_weight: parseFloat((styleWeight.value / 10).toFixed(1)),
};
}
return payload;
}