feat: AI生图弹窗新增生图模型点选 (v1.4.11)
- 弹窗按通道分组列出8个可选模型(CF Workers AI/Pollinations), 点击即选中高亮 - 所选模型存localStorage下次沿用; 自动初始化=设置默认模型 - generate带model参数(effModel=前端所选>设置默认), 后端加ALLOWED_MODELS白名单, 未知模型400 - 实测点选Pollinations动漫出图返回model=pollinations-flux-anime; 白名单拦截bogus-model - 版本号4处升至1.4.11, CHANGELOG补条目
This commit is contained in:
1 parent
cac9484861
commit
c25f8b474c
7 files changed
+84
-16
No files matched your search
@@ -83,6 +83,12 @@ const EDIT_MODELS = [
|
||||
{ id: 'flux-2-klein-4b', name: 'FLUX.2 Klein 4B(图生图·最省)' }
|
||||
];
|
||||
|
||||
// 文生图允许的模型(内置分组 + 图生图专用),防止任意模型名打到上游
|
||||
const ALLOWED_MODELS = new Set([
|
||||
...BUILTIN_GROUPS.flatMap((g) => g.models.map((m) => m.id)),
|
||||
...EDIT_MODELS.map((m) => m.id)
|
||||
]);
|
||||
|
||||
const REF_EXTS = new Set(['.jpg', '.jpeg', '.png', '.webp', '.bmp', '.avif', '.gif']);
|
||||
const MAX_REFS = 4;
|
||||
const MIME_BY_EXT = {
|
||||
@@ -236,6 +242,9 @@ router.post('/generate', asyncHandler(async (req, res) => {
|
||||
if (!effKey) {
|
||||
return res.status(400).json({ success: false, error: '未配置 NewAPI Key,请到设置 → AI 生图填写' });
|
||||
}
|
||||
if (effModel && !ALLOWED_MODELS.has(effModel)) {
|
||||
return res.status(400).json({ success: false, error: `未知模型: ${effModel}` });
|
||||
}
|
||||
effModel = effModel || cur.model || 'flux-schnell'; // 默认模型统一在设置 → AI 生图里配
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ const { getSettings } = require('./settings');
|
||||
const HUB_URL = (process.env.HUB_URL || 'https://auth.88531.cn/api').replace(/\/+$/, '');
|
||||
const HUB_PROJECT_ID = process.env.HUB_PROJECT_ID || '';
|
||||
const HUB_API_KEY = process.env.HUB_API_KEY || '';
|
||||
const SITE_VERSION = process.env.SITE_VERSION || '1.4.10';
|
||||
const SITE_VERSION = process.env.SITE_VERSION || '1.4.11';
|
||||
const TIMEOUT_MS = 8000;
|
||||
|
||||
const state = {
|
||||
|
||||
Reference in new issue
Block a user