From aa48e293a3cc0a49b88d9f67bb759f9f75163dbb Mon Sep 17 00:00:00 2001 From: zwbcc Date: Wed, 25 Mar 2026 23:53:02 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=85=A8=E4=B8=AD=E6=96=87=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=20+=20=E4=B8=AD=E5=9B=BD=E5=8C=BAAPI=20(api.minimaxi.?= =?UTF-8?q?com)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 10 ++++----- index.html | 64 +++++++++++++++++++++++++++--------------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/app.js b/app.js index 06d291d..4b5540b 100644 --- a/app.js +++ b/app.js @@ -19,7 +19,7 @@ function loadConfig() { try { return JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8')); } catch { - return { apiKey: '', baseUrl: 'https://api.minimax.io' }; + return { apiKey: '', baseUrl: 'https://api.minimaxi.com' }; } } @@ -48,7 +48,7 @@ app.get('/api/config', (req, res) => { app.post('/api/config', (req, res) => { const { apiKey, baseUrl } = req.body; if (typeof apiKey !== 'string' || typeof baseUrl !== 'string') { - return res.status(400).json({ error: 'Invalid fields' }); + return res.status(400).json({ error: '参数格式错误' }); } const cfg = { apiKey: apiKey.trim(), baseUrl: baseUrl.trim() || 'https://api.minimax.io' }; saveConfig(cfg); @@ -61,12 +61,12 @@ app.post('/api/generate', async (req, res) => { const { prompt, aspect_ratio, model } = req.body; if (!prompt || typeof prompt !== 'string' || !prompt.trim()) { - return res.status(400).json({ error: 'prompt is required' }); + return res.status(400).json({ error: '请输入图片描述内容' }); } const cfg = loadConfig(); if (!cfg.apiKey) { - return res.status(400).json({ error: 'API key not configured. Please set your MiniMax API key in settings.' }); + return res.status(400).json({ error: '未配置 API Key,请先在设置中填写 MiniMax API Key。' }); } const baseUrl = cfg.baseUrl || 'https://api.minimax.io'; @@ -101,7 +101,7 @@ app.post('/api/generate', async (req, res) => { res.json({ images }); } catch (err) { console.error('[generate] error:', err.message); - res.status(500).json({ error: 'Failed to reach MiniMax API: ' + err.message }); + res.status(500).json({ error: '无法连接 MiniMax API:' + err.message }); } }); diff --git a/index.html b/index.html index bfc2a85..e73bac1 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - Image Generator + 图片生成器 @@ -18,9 +18,9 @@ - Image Generator + 图片生成器 - . + 未配置 API Key,请先在 中填写。 @@ -40,7 +40,7 @@