feat: 提示词详细化 + 模型配置统一到设置 (v1.4.9)
- 40条图片预设扩写为完整出图提示词(主体+场景+光线+风格+质量, 平均200+字符) - 预设卡片显示两行详细描述预览, 点击填入完整提示词(修复原先只填名称) - 6条视频脚本提示词扩为含镜头语言与节奏的完整框架 - AI生图弹窗移除与设置重复的模型/通道下拉, 统一在设置-AI生图配置 - 设置-AI生图新增默认模型下拉, 存imagegen.newapi.model - 修复翻译调用早于effUrl/effKey声明的TDZ错误 - 弹窗全屏显示, 仅关闭按钮可关闭(遮罩点击不关闭) - 版本号4处同步升至1.4.9, CHANGELOG补齐v1.4.9条目
This commit is contained in:
1 parent
67f8a8f708
commit
4dcc908eaa
11 files changed
+126
-143
No files matched your search
@@ -163,7 +163,7 @@ function resolveProvider(settings) {
|
||||
url: (ig.newapi && ig.newapi.url) || 'http://192.168.68.19:3099/v1',
|
||||
// 内置 key 优先取设置里填的,其次取服务器环境变量
|
||||
apiKey: (ig.newapi && ig.newapi.apiKey) || process.env.NEWAPI_KEY || '',
|
||||
model: '',
|
||||
model: (ig.newapi && ig.newapi.model) || 'flux-schnell',
|
||||
label: 'NewAPI(Pollinations + CF Workers AI)'
|
||||
};
|
||||
}
|
||||
@@ -185,6 +185,7 @@ router.get('/models', asyncHandler(async (req, res) => {
|
||||
provider: {
|
||||
type: cur.provider,
|
||||
label: cur.label,
|
||||
builtinModel: cur.model || 'flux-schnell',
|
||||
url: cur.url,
|
||||
apiKeyMasked: maskKey(cur.apiKey),
|
||||
hasKey: !!cur.apiKey,
|
||||
@@ -206,7 +207,6 @@ router.post('/generate', asyncHandler(async (req, res) => {
|
||||
const { prompt, model, size, provider, libraryId } = req.body || {};
|
||||
// 文生图:中文提示词先翻译成英文再发给上游(图生图同样翻译)
|
||||
const originalPrompt = String(prompt || '').trim();
|
||||
const effPrompt = await translatePromptToEnglish(originalPrompt, effUrl, effKey);
|
||||
|
||||
// 参考图(以图生图):兼容 refImages / refs / refPaths 三种字段
|
||||
const rawRefs = (req.body && (req.body.refImages || req.body.refs || req.body.refPaths)) || [];
|
||||
@@ -236,9 +236,10 @@ router.post('/generate', asyncHandler(async (req, res) => {
|
||||
if (!effKey) {
|
||||
return res.status(400).json({ success: false, error: '未配置 NewAPI Key,请到设置 → AI 生图填写' });
|
||||
}
|
||||
if (!effModel) effModel = 'flux-schnell';
|
||||
effModel = effModel || cur.model || 'flux-schnell'; // 默认模型统一在设置 → AI 生图里配
|
||||
}
|
||||
|
||||
const effPrompt = await translatePromptToEnglish(originalPrompt, effUrl, effKey);
|
||||
const effSize = ALLOWED_SIZES.includes(size) ? size : '1024x1024';
|
||||
|
||||
// 读取参考图(有参考图 = 以图生图,走图片编辑接口)
|
||||
@@ -251,6 +252,10 @@ router.post('/generate', asyncHandler(async (req, res) => {
|
||||
}
|
||||
}
|
||||
const isEdit = refs.length > 0;
|
||||
// 前端不再选模型:有参考图且内置模型不支持编辑时,自动切到图生图模型
|
||||
if (isEdit && !useCustom && !['flux-2', 'flux-2-klein'].includes(effModel)) {
|
||||
effModel = 'flux-2';
|
||||
}
|
||||
const targetUrl = isEdit ? normalizeEditUrl(effUrl) : normalizeGenUrl(effUrl);
|
||||
|
||||
logger.info(`[aigen] ${isEdit ? 'edit' : 'generate'} model=${effModel} size=${effSize} refs=${refs.length} provider=${useCustom ? 'custom' : 'builtin'} prompt=${String(effPrompt).slice(0, 60)} (orig: ${String(originalPrompt).slice(0, 40)})`);
|
||||
|
||||
@@ -30,6 +30,7 @@ router.get('/', (req, res) => {
|
||||
provider: ig.provider === 'custom' ? 'custom' : 'newapi',
|
||||
newapi: {
|
||||
url: (ig.newapi && ig.newapi.url) || '',
|
||||
model: (ig.newapi && ig.newapi.model) || 'flux-schnell',
|
||||
apiKeyMasked: maskKey((ig.newapi && ig.newapi.apiKey) || ''),
|
||||
// 真正生效的 key:设置里的或环境变量兜底
|
||||
hasKey: !!((ig.newapi && ig.newapi.apiKey) || process.env.NEWAPI_KEY)
|
||||
@@ -73,6 +74,7 @@ router.put('/', (req, res) => {
|
||||
provider: ig.provider,
|
||||
newapi: {
|
||||
url: ig.newapi.url,
|
||||
model: ig.newapi.model || 'flux-schnell',
|
||||
apiKeyMasked: maskKey(ig.newapi.apiKey),
|
||||
hasKey: !!(ig.newapi.apiKey || process.env.NEWAPI_KEY)
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user