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
@@ -1,5 +1,17 @@
|
||||
# 更新日志
|
||||
|
||||
## 2026-11-19 → v1.4.9
|
||||
|
||||
**AI 生图配置统一到设置 + 提示词全中文化**——模型与通道配置不再在弹窗里重复出现,提示词所见即中文:
|
||||
|
||||
- ✨ **配置去重**:AI 生图弹窗移除「模型提供商」「模型」两个下拉(与右上角设置重复);通道/模型统一在「设置 → AI 生图」配置,弹窗内只留一句「通道与模型在右上角设置里配置」+「去设置」直达按钮
|
||||
- ✨ **设置 → AI 生图新增「默认模型」下拉**(内置 NewAPI 通道):按分组列出 CF Workers AI / Pollinations 模型,与自定义提供商的模型名同在设置页;选参考图时后端自动切 FLUX.2 图生图模型,用户无需手动换模型
|
||||
- ✨ **提示词中文化**:热门提示词按钮显示中文名、点击替换(不追加)输入框;发送前提示词原样传给后端,由后端经聊天模型翻译成英文再发上游(多模型兜底,翻译失败回落原文)
|
||||
- 🐛 修复生图翻译调用早于 `effUrl/effKey` 声明导致的运行时引用错误(TDZ)
|
||||
- 🎨 AI 生图/AI 一键生成视频弹窗改为默认全屏显示
|
||||
- 🐛 所有弹窗仅通过关闭按钮关闭,点击遮罩不再关闭(防误触丢失提示词/参考图)
|
||||
- ✨ **提示词全面详细化**:40 条图片预设从短标签扩写为完整出图提示词(主体+场景+光线+构图+风格+质量,平均 200+ 字符);预设卡片直接显示详细描述(两行预览),点击填入完整提示词而非名称;6 条视频脚本提示词扩为含镜头语言与节奏的完整脚本框架
|
||||
|
||||
## 2026-11-18 → v1.4.8
|
||||
|
||||
**搜索结果批量改名 + 关键词替换**——搜索出一批文件后直接对命中结果批量改名,支持把文件名中的关键词替换掉:
|
||||
|
||||
@@ -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)
|
||||
},
|
||||
|
||||
@@ -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.8';
|
||||
const SITE_VERSION = process.env.SITE_VERSION || '1.4.9';
|
||||
const TIMEOUT_MS = 8000;
|
||||
|
||||
const state = {
|
||||
|
||||
@@ -23,7 +23,8 @@ const DEFAULTS = {
|
||||
provider: 'newapi', // 'newapi' | 'custom'
|
||||
newapi: {
|
||||
url: 'http://192.168.68.19:3099/v1',
|
||||
apiKey: '' // 留空则用服务器环境变量 NEWAPI_KEY
|
||||
apiKey: '', // 留空则用服务器环境变量 NEWAPI_KEY
|
||||
model: 'flux-schnell' // 默认生图模型(弹窗不再选模型,统一在设置里配)
|
||||
},
|
||||
custom: {
|
||||
url: '',
|
||||
@@ -67,6 +68,7 @@ function getSettings() {
|
||||
provider: (data.imagegen && data.imagegen.provider) === 'custom' ? 'custom' : 'newapi',
|
||||
newapi: {
|
||||
url: (data.imagegen && data.imagegen.newapi && data.imagegen.newapi.url) || DEFAULTS.imagegen.newapi.url,
|
||||
model: (data.imagegen && data.imagegen.newapi && data.imagegen.newapi.model) || DEFAULTS.imagegen.newapi.model,
|
||||
apiKey: (data.imagegen && data.imagegen.newapi && data.imagegen.newapi.apiKey) || ''
|
||||
},
|
||||
custom: {
|
||||
@@ -111,6 +113,7 @@ function saveSettings(settings) {
|
||||
if (ig.provider === 'custom' || ig.provider === 'newapi') merged.imagegen.provider = ig.provider;
|
||||
if (ig.newapi) {
|
||||
if (typeof ig.newapi.url === 'string') merged.imagegen.newapi.url = ig.newapi.url.trim();
|
||||
if (typeof ig.newapi.model === 'string') merged.imagegen.newapi.model = ig.newapi.model.trim() || 'flux-schnell';
|
||||
const k = ig.newapi.apiKey;
|
||||
// 空串/掩码 = 保持原值(与 OCR 行为一致)
|
||||
if (typeof k === 'string' && k.trim() && !k.includes('***')) {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ services:
|
||||
- HUB_API_KEY=${HUB_API_KEY:-}
|
||||
- NEWAPI_KEY=${NEWAPI_KEY:-}
|
||||
# 当前站点版本(与 frontend/package.json、CHANGELOG 保持一致,界面版本徽标来源)
|
||||
- SITE_VERSION=1.4.8
|
||||
- SITE_VERSION=1.4.9
|
||||
# 让容器经 host.docker.internal 访问宿主机的 AI 侧车
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
@@ -12,7 +12,7 @@ import { PROMPT_CATEGORIES } from '../constants/promptPresets';
|
||||
/**
|
||||
* AI 生图弹窗
|
||||
* - 热门提示词分类(点击填入/追加)
|
||||
* - 内置模型(NewAPI:CF Workers AI / Pollinations)+ 自定义提供商
|
||||
* - 通道与模型统一在「设置 → AI 生图」配置,弹窗不再重复选择
|
||||
* - 生成 → 预览 → 保存到素材库 / 下载 / 重新生成
|
||||
*/
|
||||
|
||||
@@ -35,12 +35,9 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
|
||||
const [prompt, setPrompt] = useState('');
|
||||
const [cat, setCat] = useState('hot');
|
||||
const [groups, setGroups] = useState([]);
|
||||
const [sizes, setSizes] = useState([]);
|
||||
const [providerInfo, setProviderInfo] = useState(null);
|
||||
const [model, setModel] = useState('flux-schnell');
|
||||
const [size, setSize] = useState('1024x1024');
|
||||
const [useCustom, setUseCustom] = useState(false);
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
@@ -52,7 +49,6 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
const [advanced, setAdvanced] = useState(false);
|
||||
|
||||
// 参考图(以图生图)
|
||||
const [editModels, setEditModels] = useState([]);
|
||||
const [refs, setRefs] = useState([]); // [{ path, filename, thumbnailPath }]
|
||||
const [showRefPicker, setShowRefPicker] = useState(false);
|
||||
const [refList, setRefList] = useState([]);
|
||||
@@ -71,19 +67,12 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
setRefQuery('');
|
||||
aigenAPI.getModels()
|
||||
.then((d) => {
|
||||
setGroups(d.groups || []);
|
||||
setEditModels(d.editModels || []);
|
||||
setSizes(d.sizes || []);
|
||||
setProviderInfo(d.provider || null);
|
||||
const first = (d.groups || [])[0];
|
||||
if (first && first.models && first.models[0]) setModel(first.models[0].id);
|
||||
if (d.provider && d.provider.type === 'custom') setUseCustom(true);
|
||||
})
|
||||
.catch((e) => setError('读取模型列表失败: ' + (e.data?.error || e.message)));
|
||||
}, [open]);
|
||||
|
||||
const currentModelId = useCustom ? (providerInfo?.customModel || '') : model;
|
||||
|
||||
/** 素材库缩略图地址 */
|
||||
const thumbUrl = (img) => {
|
||||
if (!img || !currentLibraryId) return '';
|
||||
@@ -123,10 +112,6 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
}
|
||||
if (refs.length >= 4) { setError('最多选 4 张参考图'); return; }
|
||||
setRefs((prev) => [...prev, img]);
|
||||
// 选了参考图就自动切到图生图模型,避免用户忘记换模型导致图片没被用上
|
||||
if (editModels.length && !String(model).startsWith('flux-2')) {
|
||||
setModel(editModels[0].id);
|
||||
}
|
||||
};
|
||||
const handleGenerate = async () => {
|
||||
if (!prompt.trim()) { setError('请先输入提示词,或点一个热门提示词'); return; }
|
||||
@@ -134,19 +119,11 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
setError('');
|
||||
setSaved(false);
|
||||
try {
|
||||
if (refs.length > 0 && !useCustom && !String(model).startsWith('flux-2')) {
|
||||
setError('已选参考图,请把模型切换为「FLUX.2 图生图」系列');
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
const d = await aigenAPI.generate({
|
||||
prompt: prompt.trim(),
|
||||
model: useCustom ? undefined : model,
|
||||
size,
|
||||
provider: useCustom ? 'custom' : 'builtin',
|
||||
libraryId: currentLibraryId,
|
||||
refImages: refs.map((r) => ({ path: r.path, filename: r.filename })),
|
||||
...(refs.length ? {} : {})
|
||||
});
|
||||
const img = d.images && d.images[0];
|
||||
if (!img || !img.b64) throw new Error('未返回图片数据');
|
||||
@@ -211,7 +188,7 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
if (!open) return null;
|
||||
|
||||
const activeCat = PROMPT_CATEGORIES.find((c) => c.key === cat) || PROMPT_CATEGORIES[0];
|
||||
const noKey = providerInfo && !providerInfo.hasKey && !useCustom;
|
||||
const noKey = providerInfo && !providerInfo.hasKey && providerInfo.type !== 'custom';
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4">
|
||||
@@ -276,13 +253,16 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
{activeCat.prompts.map((p) => (
|
||||
<button
|
||||
key={p.name}
|
||||
onClick={() => appendPrompt(p.name)}
|
||||
title={p.name}
|
||||
onClick={() => appendPrompt(p.prompt)}
|
||||
title={p.prompt}
|
||||
className="text-left px-2.5 py-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-purple-400 dark:hover:border-purple-500 hover:bg-purple-50 dark:hover:bg-purple-500/10 transition-colors group"
|
||||
>
|
||||
<div className="text-xs font-medium text-gray-800 dark:text-gray-200 truncate group-hover:text-purple-700 dark:group-hover:text-purple-300">
|
||||
{p.name}
|
||||
</div>
|
||||
<div className="mt-0.5 text-[10px] leading-4 text-gray-400 dark:text-gray-500 line-clamp-2 group-hover:text-gray-500 dark:group-hover:text-gray-400">
|
||||
{p.prompt}
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
@@ -291,66 +271,22 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
|
||||
{/* 右:参数 + 生成 */}
|
||||
<div className="lg:col-span-2 space-y-3.5">
|
||||
{/* 提供商 */}
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-500 dark:text-gray-400 mb-1.5">模型提供商</label>
|
||||
<select
|
||||
value={useCustom ? 'custom' : 'builtin'}
|
||||
onChange={(e) => setUseCustom(e.target.value === 'custom')}
|
||||
className="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100"
|
||||
{/* 通道/模型已统一在设置里配置,此处不再重复选择 */}
|
||||
<div className="flex items-center justify-between px-3 py-2 rounded-lg bg-gray-50 dark:bg-gray-900/40 border border-gray-200 dark:border-gray-700">
|
||||
<span className="text-[11px] text-gray-500 dark:text-gray-400">
|
||||
通道与模型在右上角「设置 → AI 生图」配置
|
||||
</span>
|
||||
<button
|
||||
onClick={() => window.dispatchEvent(new CustomEvent('open:settings', { detail: { tab: 'aigen' } }))}
|
||||
className="text-[11px] text-purple-600 dark:text-purple-400 hover:underline flex-shrink-0 ml-2"
|
||||
>
|
||||
<option value="builtin">内置 NewAPI(Pollinations + CF Workers AI)</option>
|
||||
<option value="custom" disabled={!providerInfo?.customModel && !providerInfo?.customUrl}>
|
||||
自定义提供商{providerInfo?.customModel ? `(${providerInfo.customModel})` : '(未配置)'}
|
||||
</option>
|
||||
</select>
|
||||
{providerInfo && !providerInfo.hasKey && !useCustom && (
|
||||
<div className="mt-1.5 flex items-start gap-1.5 text-[11px] text-amber-600 dark:text-amber-400">
|
||||
<AlertTriangle className="w-3.5 h-3.5 flex-shrink-0 mt-px" />
|
||||
<span>
|
||||
未配置 API Key。到「设置 → AI 生图」填写,或由服务器环境变量注入。
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
去设置
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* 模型 */}
|
||||
{!useCustom && (
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-500 dark:text-gray-400 mb-1.5">模型</label>
|
||||
<select
|
||||
value={model}
|
||||
onChange={(e) => setModel(e.target.value)}
|
||||
className="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100"
|
||||
>
|
||||
{groups.map((g) => (
|
||||
<optgroup key={g.key} label={g.label}>
|
||||
{g.models.map((m) => (
|
||||
<option key={m.id} value={m.id}>{m.name}</option>
|
||||
))}
|
||||
</optgroup>
|
||||
))}
|
||||
{editModels.length > 0 && (
|
||||
<optgroup label="以图生图(需要参考图)">
|
||||
{editModels.map((m) => (
|
||||
<option key={m.id} value={m.id}>{m.name}</option>
|
||||
))}
|
||||
</optgroup>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{useCustom && (
|
||||
<div className="p-3 bg-amber-50 dark:bg-amber-500/10 border border-amber-200 dark:border-amber-500/30 rounded-lg text-xs text-amber-700 dark:text-amber-300">
|
||||
使用设置中配置的自定义提供商({providerInfo?.customUrl || '未配置地址'})。
|
||||
模型:{providerInfo?.customModel || '(未配置)'}
|
||||
<button
|
||||
onClick={() => window.dispatchEvent(new CustomEvent('open:settings', { detail: { tab: 'aigen' } }))}
|
||||
className="ml-1 underline hover:text-amber-900 dark:hover:text-amber-100"
|
||||
>
|
||||
去配置
|
||||
</button>
|
||||
{noKey && (
|
||||
<div className="flex items-start gap-1.5 text-[11px] text-amber-600 dark:text-amber-400">
|
||||
<AlertTriangle className="w-3.5 h-3.5 flex-shrink-0 mt-px" />
|
||||
<span>未配置 API Key。到「设置 → AI 生图」填写,或由服务器环境变量注入。</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -441,7 +377,7 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
|
||||
{loading && (
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500 text-center">
|
||||
正在调用 {useCustom ? '自定义提供商' : (model || '')}
|
||||
正在调用生图服务
|
||||
{refs.length > 0 ? '(以图生图,约 20-60 秒)' : ',超时上限 150 秒'}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -24,14 +24,12 @@ const SUBTITLE_COLORS = [
|
||||
{ key: '#00FFCC', label: '青色' },
|
||||
];
|
||||
const POPULAR_PROMPTS = [
|
||||
'产品功能速览:突出核心卖点与使用场景',
|
||||
'周末探店 vlog:轻松活泼的语气',
|
||||
'知识科普:分步骤讲解一个概念',
|
||||
'旅行日记:描述风景与心情',
|
||||
'健身打卡:励志、节奏感强',
|
||||
'美食制作:步骤清晰、诱人',
|
||||
'读书分享:提炼要点与感悟',
|
||||
'科技新闻:简洁、专业',
|
||||
'产品功能速览:开头 3 秒抛出用户痛点,逐条演示 3 个核心卖点与真实使用场景,配合界面录屏特写与前后对比,结尾出现品牌名与一句话 slogan,节奏明快,字幕醒目',
|
||||
'周末探店 vlog:从推门进店的第一视角开场,依次拍环境空镜、招牌菜特写、入口咀嚼的满足表情,穿插与店主的简短对话,轻快背景音乐,暖色调,结尾给出店名地址与推荐指数',
|
||||
'知识科普:先用一个反常识的问题抓住注意力,再分三步由浅入深讲解概念,每步配一个生活化类比和简单动画示意,最后用一句话总结并抛出延伸思考,语速适中,重点处放大字幕',
|
||||
'旅行日记:以清晨出发的车窗镜头开场,交替呈现沿途风景大远景、地标建筑仰拍、当地市集人文细节与个人打卡瞬间,配舒缓音乐和游记式旁白,结尾定格日落剪影并标注地点',
|
||||
'健身打卡:开场展示今日训练目标与身材对比,中间分组记录动作特写、重量数据和力竭瞬间,穿插教练指导与呼吸节奏提示,热血鼓点配乐,结尾打出训练总消耗与坚持天数',
|
||||
'美食制作:从食材摆盘的俯拍开场,按备料、烹饪、装盘三阶段推进,关键步骤给慢镜头特写(下锅滋响、拉丝、淋酱),配清晰步骤字幕,结尾成品 360 度展示与口感描述'
|
||||
];
|
||||
|
||||
function errText(e, fb) { if (!e) return fb; if (typeof e === 'string') return e; return e.message || JSON.stringify(e); }
|
||||
|
||||
@@ -40,7 +40,7 @@ const [showAIVideo, setShowAIVideo] = useState(false);
|
||||
// 授权系统 hub:版本 / 公告 / 在线人数
|
||||
const hub = useHub();
|
||||
const announcements = hub.announcements || [];
|
||||
const appVersion = hub.version ? `v${String(hub.version).replace(/^v/, '')}` : 'v1.4.8';
|
||||
const appVersion = hub.version ? `v${String(hub.version).replace(/^v/, '')}` : 'v1.4.9';
|
||||
|
||||
// 从全局 store 获取筛选状态
|
||||
const selectedFormats = filters.formats || [];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { X, ScanText, Info, Save, FlaskConical, Github, ExternalLink, Wand2, Film } from 'lucide-react';
|
||||
import { settingsAPI } from '../api';
|
||||
import { settingsAPI, aigenAPI } from '../api';
|
||||
|
||||
const APP_VERSION = 'v1.4.8';
|
||||
const APP_VERSION = 'v1.4.9';
|
||||
const REPO_URL = 'https://gitea.88531.cn/jinghui/flypic';
|
||||
|
||||
/**
|
||||
@@ -17,6 +17,7 @@ export default function SettingsModal({ open, onClose, versionLabel, initialTab
|
||||
const [ig, setIg] = useState(null); // imagegen 配置
|
||||
const [igNewKey, setIgNewKey] = useState(''); // NewAPI 新密钥
|
||||
const [igCustomKey, setIgCustomKey] = useState(''); // 自定义提供商新密钥
|
||||
const [igGroups, setIgGroups] = useState([]); // 内置模型分组(默认模型下拉用)
|
||||
const [va, setVa] = useState(null); // AI 视频文本模型配置
|
||||
const [vaKey, setVaKey] = useState(''); // AI 视频新密钥
|
||||
const [saving, setSaving] = useState(false);
|
||||
@@ -45,6 +46,7 @@ export default function SettingsModal({ open, onClose, versionLabel, initialTab
|
||||
provider: d?.imagegen?.provider || 'newapi',
|
||||
newapi: {
|
||||
url: d?.imagegen?.newapi?.url || 'http://192.168.68.19:3099/v1',
|
||||
model: d?.imagegen?.newapi?.model || 'flux-schnell',
|
||||
apiKeyMasked: d?.imagegen?.newapi?.apiKeyMasked || '',
|
||||
hasKey: !!d?.imagegen?.newapi?.hasKey
|
||||
},
|
||||
@@ -65,6 +67,9 @@ export default function SettingsModal({ open, onClose, versionLabel, initialTab
|
||||
});
|
||||
})
|
||||
.catch((e) => setMsg({ type: 'error', text: '读取设置失败: ' + (e.data?.message || e.message) }));
|
||||
aigenAPI.getModels()
|
||||
.then((d) => setIgGroups(d.groups || []))
|
||||
.catch(() => setIgGroups([]));
|
||||
}, [open]);
|
||||
|
||||
if (!open) return null;
|
||||
@@ -89,6 +94,7 @@ export default function SettingsModal({ open, onClose, versionLabel, initialTab
|
||||
provider: ig.provider,
|
||||
newapi: {
|
||||
url: ig.newapi.url,
|
||||
model: ig.newapi.model || 'flux-schnell',
|
||||
apiKey: igNewKey || '' // 空 = 保持原密钥
|
||||
},
|
||||
custom: {
|
||||
@@ -378,6 +384,26 @@ export default function SettingsModal({ open, onClose, versionLabel, initialTab
|
||||
className="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1">默认模型</label>
|
||||
<select
|
||||
value={ig.newapi.model || 'flux-schnell'}
|
||||
onChange={(e) => setIg((v) => ({ ...v, newapi: { ...v.newapi, model: e.target.value } }))}
|
||||
className="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100"
|
||||
>
|
||||
{igGroups.map((g) => (
|
||||
<optgroup key={g.key} label={g.label}>
|
||||
{g.models.map((m) => (
|
||||
<option key={m.id} value={m.id}>{m.name}</option>
|
||||
))}
|
||||
</optgroup>
|
||||
))}
|
||||
{!igGroups.length && <option value="flux-schnell">FLUX.1 schnell(快速)</option>}
|
||||
</select>
|
||||
<p className="mt-1 text-[11px] text-gray-400 dark:text-gray-500">
|
||||
AI 生图弹窗使用此模型;选了参考图时后端自动切到 FLUX.2 图生图模型。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* AI 生图 · 常用热门提示词库
|
||||
* 分类 + 预设提示词(中英混合,flux 系模型对英文提示词效果更稳)
|
||||
* 点击条目 = 追加/替换输入框内容
|
||||
* 每条均为「主体 + 场景 + 光线 + 构图 + 风格 + 质量」的完整详细描述,点击即得可直接出图的提示词
|
||||
*/
|
||||
|
||||
export const PROMPT_CATEGORIES = [
|
||||
@@ -9,88 +10,88 @@ export const PROMPT_CATEGORIES = [
|
||||
key: 'hot',
|
||||
label: '🔥 热门',
|
||||
prompts: [
|
||||
{ name: '赛博朋克城市夜景', prompt: 'cyberpunk city at night, neon lights, rain reflections, flying cars, ultra detailed, cinematic lighting' },
|
||||
{ name: '治愈系猫咪', prompt: 'a fluffy cat sitting on windowsill, warm afternoon sunlight, soft focus, cozy atmosphere, photorealistic' },
|
||||
{ name: '水晶球微缩世界', prompt: 'miniature world inside a glass snow globe on wooden table, macro photography, dreamy bokeh, studio lighting' },
|
||||
{ name: '复古胶片人像', prompt: 'vintage film portrait, kodak portra 400, soft natural light, nostalgic mood, grain texture' },
|
||||
{ name: '极简几何壁纸', prompt: 'minimalist geometric wallpaper, pastel gradient colors, clean shapes, flat design, 4k' }
|
||||
{ name: '赛博朋克城市夜景', prompt: 'cyberpunk city street at night after rain, towering neon signs in chinese and japanese, colorful reflections on wet asphalt, flying cars leaving light trails in the sky, dense crowd with transparent umbrellas, volumetric fog, cinematic lighting, blade runner mood, ultra detailed, 8k, wide angle' },
|
||||
{ name: '治愈系猫咪', prompt: 'a fluffy orange cat curled up on a sunlit windowsill, warm golden hour afternoon light, dust particles floating in the air, sheer curtains gently blowing, potted plants nearby, soft focus background, cozy warm tones, photorealistic, 85mm lens, shallow depth of field, highly detailed fur' },
|
||||
{ name: '水晶球微缩世界', prompt: 'miniature snowy village inside a glass snow globe on a rustic wooden table, macro photography, tiny warm window lights glowing, dreamy bokeh, soft studio softbox lighting, sparkling snow dust, shallow depth of field, whimsical cozy atmosphere, ultra detailed, 8k' },
|
||||
{ name: '复古胶片人像', prompt: 'vintage film portrait of a young woman, kodak portra 400 film look, soft window light, nostalgic warm tones, subtle film grain, slightly faded colors, 1970s styling, gentle smile, shallow depth of field, 50mm lens, analog photography aesthetic' },
|
||||
{ name: '极简几何壁纸', prompt: 'minimalist geometric wallpaper with overlapping circles triangles and arches, pastel gradient of lavender peach and mint, clean flat design, subtle noise texture, balanced repeating composition, modern abstract background, no text, 4k' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'portrait',
|
||||
label: '👤 头像人像',
|
||||
prompts: [
|
||||
{ name: '动漫男头', prompt: 'anime boy avatar, short black hair, hoodie, city background at dusk, detailed illustration, vibrant colors' },
|
||||
{ name: '动漫女头', prompt: 'anime girl avatar, long silver hair, flower crown, soft pastel colors, clean lineart, studio ghibli style' },
|
||||
{ name: '3D 卡通头像', prompt: '3D cartoon avatar of a young man, Pixar style, round face, big eyes, soft studio lighting, plain background' },
|
||||
{ name: '写真级人像', prompt: 'professional headshot portrait, shallow depth of field, natural window light, high detail skin texture, 85mm lens' },
|
||||
{ name: '像素风头像', prompt: 'pixel art avatar, 64x64, retro game style, bold outlines, limited palette, cute expression' }
|
||||
{ name: '动漫男头', prompt: 'anime boy avatar, short messy black hair, oversized hoodie, city skyline at dusk in the background, detailed illustration, vibrant sunset colors, clean lineart, expressive eyes, upper body shot, japanese anime style, high quality' },
|
||||
{ name: '动漫女头', prompt: 'anime girl avatar, long silver hair, delicate flower crown, soft pastel colors, clean lineart, studio ghibli inspired style, gentle smile, dreamy floral background, detailed illustration, portrait framing, masterpiece quality' },
|
||||
{ name: '3D 卡通头像', prompt: '3D cartoon avatar of a young man, pixar style, round friendly face, big sparkling eyes, soft studio lighting, plain gradient background, smooth clay render, cute and approachable, octane render, high quality' },
|
||||
{ name: '写真级人像', prompt: 'professional headshot portrait, shallow depth of field, soft natural window light, high detail skin texture, 85mm f/1.8 lens, neutral clean background, sharp focus on eyes, commercial photography, subtle color grading' },
|
||||
{ name: '像素风头像', prompt: 'pixel art avatar, 64x64 grid, retro game style, bold clean outlines, limited 16 color palette, cute confident expression, symmetrical composition, nostalgic 8-bit vibe, crisp pixels, no anti-aliasing' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'wallpaper',
|
||||
label: '🖼 壁纸风景',
|
||||
prompts: [
|
||||
{ name: '雪山日出', prompt: 'snow mountain range at sunrise, golden alpenglow, crystal clear lake reflection, ultra wide angle, 8k landscape' },
|
||||
{ name: '海上星河', prompt: 'milky way over calm ocean, starry night, long exposure photography, deep blue tones, tranquil scene' },
|
||||
{ name: '梯田晨雾', prompt: 'terraced rice fields with morning mist, layered mountains, traditional chinese landscape painting mood, aerial view' },
|
||||
{ name: '梦幻森林', prompt: 'enchanted forest with glowing mushrooms and fireflies, volumetric light rays, fantasy atmosphere, highly detailed' },
|
||||
{ name: '沙漠驼队', prompt: 'camel caravan crossing golden sand dunes at sunset, long shadows, warm tones, national geographic style' }
|
||||
{ name: '雪山日出', prompt: 'snow mountain range at sunrise, golden alpenglow on the peaks, crystal clear alpine lake perfectly mirroring the mountains, wisps of mist, ultra wide angle, 8k landscape photography, cold blue shadows turning warm gold, dramatic sky' },
|
||||
{ name: '海上星河', prompt: 'milky way arching over a calm ocean at night, long exposure photography, thousands of stars, gentle glowing waves, deep blue tones, tranquil and vast scene, high detail astrophotography, horizon glow' },
|
||||
{ name: '梯田晨雾', prompt: 'terraced rice fields at dawn covered in morning mist, layered mountains fading into the distance, aerial drone view, traditional chinese landscape painting mood, soft light, serene atmosphere, green and grey tones, ultra detailed' },
|
||||
{ name: '梦幻森林', prompt: 'enchanted forest with glowing mushrooms and floating fireflies, volumetric light rays breaking through the canopy, moss covered ancient trees, fantasy atmosphere, magical blue and green glow, highly detailed digital art' },
|
||||
{ name: '沙漠驼队', prompt: 'camel caravan crossing golden sand dunes at sunset, long dramatic shadows, warm orange tones, national geographic style, vast desert horizon, rippled sand texture, wide cinematic shot, dusty air' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'anime',
|
||||
label: '✨ 动漫插画',
|
||||
prompts: [
|
||||
{ name: '樱花下的少女', prompt: 'anime girl under cherry blossom tree, petals falling, spring breeze, pastel colors, detailed anime illustration' },
|
||||
{ name: '机甲战士', prompt: 'giant mecha robot standing in ruined city, dramatic angle, sci-fi anime style, detailed mechanical parts, dynamic lighting' },
|
||||
{ name: '魔法使', prompt: 'young wizard casting spell, glowing runes, dark library background, fantasy anime illustration, vibrant magic effects' },
|
||||
{ name: '校园日常', prompt: 'anime scene of students walking home at sunset, warm orange sky, slice of life, clean lineart, makoto shinkai style' },
|
||||
{ name: '和风少女', prompt: 'girl in kimono holding wagashi, traditional japanese room, tatami, soft light, detailed anime art' }
|
||||
{ name: '樱花下的少女', prompt: 'anime girl standing under a cherry blossom tree, pink petals drifting in the spring breeze, soft pastel colors, backlit flowers, gentle smile, warm afternoon light, detailed anime illustration, masterpiece quality' },
|
||||
{ name: '机甲战士', prompt: 'giant mecha robot standing in a ruined city, dramatic low angle, sci-fi anime style, intricate mechanical parts, steam and sparks, dynamic lighting, floating dust, epic sense of scale, highly detailed' },
|
||||
{ name: '魔法使', prompt: 'young wizard casting a glowing spell, floating arcane runes, dark ancient library background, fantasy anime illustration, vibrant magic effects, rim lighting, sparkling light particles, dynamic pose' },
|
||||
{ name: '校园日常', prompt: 'anime scene of students walking home at sunset, warm orange sky with towering cumulus clouds, long shadows on the road, slice of life mood, clean lineart, makoto shinkai style, detailed background, nostalgic feeling' },
|
||||
{ name: '和风少女', prompt: 'girl in a colorful kimono holding japanese wagashi sweet, traditional tatami room with sliding shoji doors, soft diffused light, delicate fabric patterns, elegant and calm, detailed anime art' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'commerce',
|
||||
label: '🛍 电商海报',
|
||||
prompts: [
|
||||
{ name: '产品主图', prompt: 'product photography of a perfume bottle on marble pedestal, soft gradient background, studio lighting, luxury feel, high-end commercial shot' },
|
||||
{ name: '美食海报', prompt: 'gourmet burger with melted cheese, steam rising, dark moody background, commercial food photography, appetizing, sharp detail' },
|
||||
{ name: '双十一促销', prompt: 'e-commerce sale banner, red and gold color scheme, floating gift boxes and confetti, modern 3d render, festive atmosphere' },
|
||||
{ name: '化妆品展示', prompt: 'cosmetic serum bottle surrounded by fresh flowers and water drops, clean white background, fresh and natural, commercial photo' },
|
||||
{ name: '数码新品', prompt: 'smartphone floating above glowing platform, tech product render, blue and purple neon accents, futuristic commercial style' }
|
||||
{ name: '产品主图', prompt: 'product photography of a luxury perfume bottle on a white marble pedestal, soft gradient background, diffused studio lighting, subtle reflections, elegant high-end commercial shot, sharp detail, 8k, negative space for text' },
|
||||
{ name: '美食海报', prompt: 'gourmet burger with melted cheese and sesame bun, steam rising, dark moody background, dramatic side light, commercial food photography, fresh appetizing ingredients, sharp detail, shallow depth of field' },
|
||||
{ name: '双十一促销', prompt: 'e-commerce sale banner background, red and gold color scheme, floating gift boxes ribbons and confetti, modern 3d render, festive energetic atmosphere, glossy materials, studio lighting, empty center space for headline' },
|
||||
{ name: '化妆品展示', prompt: 'cosmetic serum bottle surrounded by fresh flowers and water droplets, clean white background, bright natural light, fresh and natural mood, commercial product photo, crisp detail, soft shadows' },
|
||||
{ name: '数码新品', prompt: 'smartphone floating above a glowing platform, tech product render, blue and purple neon accents, dark background with light streaks, futuristic commercial style, sharp reflections, high detail, 8k' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'icon3d',
|
||||
label: '🧊 图标3D',
|
||||
prompts: [
|
||||
{ name: '3D 立体图标', prompt: '3d icon of a treasure chest, glossy material, soft shadows, pastel gradient background, clay render style, cute and round' },
|
||||
{ name: '玻璃质感', prompt: 'glassmorphism 3d icon of cloud storage, translucent frosted glass, floating, soft studio light, clean background' },
|
||||
{ name: '卡通食物', prompt: 'cute 3d icon of a ramen bowl, kawaii style, thick outlines, vibrant colors, glossy plastic material' },
|
||||
{ name: '徽章印章', prompt: '3d golden badge icon with star, metallic material, embossed, dark blue background, premium look' },
|
||||
{ emoji: '🎮', name: '游戏手柄', prompt: '3d gamepad icon, retro controller, matte plastic material, playful colors, soft ambient occlusion, icon design' }
|
||||
{ name: '3D 立方图标', prompt: '3d icon of a treasure chest, glossy material, soft shadows, pastel gradient background, clay render style, cute rounded shapes, studio lighting, centered composition, app icon design, high quality' },
|
||||
{ name: '玻璃质感', prompt: 'glassmorphism 3d icon of cloud storage, translucent frosted glass, floating above a soft gradient, soft studio light, subtle refractions and highlights, clean minimal background, modern ui icon' },
|
||||
{ name: '卡通食物', prompt: 'cute 3d icon of a ramen bowl, kawaii style, thick outlines, vibrant colors, glossy plastic material, swirling steam on top, soft ambient occlusion, centered app icon' },
|
||||
{ name: '徽章印章', prompt: '3d golden badge icon with a star, metallic material, embossed details, dark blue background, premium look, soft rim light, centered composition, high quality render' },
|
||||
{ emoji: '🎮', name: '游戏手柄', prompt: '3d gamepad icon, retro controller, matte plastic material, playful colors, soft ambient occlusion, centered on pastel background, rounded cute style, icon design' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'art',
|
||||
label: '🎨 艺术风格',
|
||||
prompts: [
|
||||
{ name: '浮世绘海浪', prompt: 'great wave in ukiyo-e style, hokusai inspired, woodblock print texture, indigo blue palette, traditional japanese art' },
|
||||
{ name: '梵高星空', prompt: 'starry night style painting, swirling sky, thick brushstrokes, post-impressionism, oil painting texture' },
|
||||
{ name: '水彩花卉', prompt: 'delicate watercolor flowers, loose brushstrokes, soft edges, white background, botanical illustration style' },
|
||||
{ name: '低多边形', prompt: 'low poly landscape with pine forest and mountains, faceted geometry, vibrant sunset colors, digital art' },
|
||||
{ name: '水墨仙鹤', prompt: 'chinese ink wash painting of crane flying over lotus, minimal brush strokes, elegant, rice paper texture' }
|
||||
{ name: '浮世绘海浪', prompt: 'great wave cresting in ukiyo-e style, hokusai inspired, woodblock print texture, indigo blue palette, foamy claw-like spray, mount fuji in the distance, traditional japanese art, visible paper grain' },
|
||||
{ name: '梵高星空', prompt: 'starry night style painting, swirling turbulent sky, glowing yellow stars, dark cypress silhouette, thick impasto brushstrokes, post-impressionism, oil painting texture, vibrant blues and yellows' },
|
||||
{ name: '水彩花卉', prompt: 'delicate watercolor flowers, loose brushstrokes, soft bleeding edges, white background, botanical illustration style, pastel pink and green palette, airy composition, hand painted paper texture' },
|
||||
{ name: '低多边形', prompt: 'low poly landscape with pine forest and snow mountains, faceted geometry, vibrant sunset colors of orange and purple sky, clean triangles, stylized digital art' },
|
||||
{ name: '水墨仙鹤', prompt: 'chinese ink wash painting of a crane flying over a lotus pond, minimal confident brush strokes, elegant negative space, rice paper texture, subtle grey ink gradients, oriental aesthetic' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'scene',
|
||||
label: '🏠 室内场景',
|
||||
prompts: [
|
||||
{ name: '温馨书房', prompt: 'cozy home library with floor to ceiling bookshelves, leather armchair, warm lamp light, rainy window, photorealistic' },
|
||||
{ name: '北欧客厅', prompt: 'scandinavian living room, white walls, light wood furniture, large plants, natural daylight, interior design photo' },
|
||||
{ name: '咖啡角落', prompt: 'small cafe corner with espresso machine, pastries display, morning light through glass, hygge atmosphere' },
|
||||
{ name: '阁楼卧室', prompt: 'attic bedroom with slanted window, fairy lights, linen bedding, plants, soft morning light, aesthetic photo' },
|
||||
{ name: '赛博房间', prompt: 'futuristic bedroom with holographic screens, neon strip lights, minimalist furniture, cyberpunk interior' }
|
||||
{ name: '温馨书房', prompt: 'cozy home library with floor to ceiling bookshelves, leather armchair, warm lamp light, rainy window with droplets, photorealistic, warm amber tones, intimate atmosphere, detailed interior, 8k' },
|
||||
{ name: '北欧客厅', prompt: 'scandinavian living room, white walls, light oak furniture, large green plants, big windows with natural daylight, minimal decor, interior design photography, airy and clean, bright tones' },
|
||||
{ name: '咖啡角落', prompt: 'small cafe corner with an espresso machine and glass pastry display, morning sunlight streaming through the window, hygge atmosphere, warm wood tones, steam rising from a cup, photorealistic' },
|
||||
{ name: '阁楼卧室', prompt: 'attic bedroom with a slanted skylight window, fairy lights, linen bedding, potted plants, soft morning light, aesthetic cozy photo, muted tones, detailed textiles' },
|
||||
{ name: '赛博房间', prompt: 'futuristic bedroom with floating holographic screens, neon strip lights in cyan and magenta, minimalist furniture, cyberpunk interior, volumetric glow, detailed props, cinematic lighting' }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user