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 @@