Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a793eadb32 | ||
|
|
d9c61306fe | ||
|
|
ecb28c3aa5 | ||
|
|
c25f8b474c |
No files matched your search
@@ -1,5 +1,33 @@
|
||||
# 更新日志
|
||||
|
||||
## 2026-11-19 → v1.4.14
|
||||
|
||||
- ✨ **灯箱只显示图片**:双击图片打开灯箱后,底部缩略图条只列出当前文件夹(含筛选)下的图片,mp4/md 等打不开的文件不再混入(此前显示出来也点不开,纯属干扰)
|
||||
- 灯箱列表本身也同步过滤为纯图片:左右方向键/箭头按钮翻页不会再翻到视频、文档等打不开的项;顶部「序号 / 总数」与缩略图条均按图片计数
|
||||
- 视频、文档的行为不变:双击仍弹出各自的播放/查看器,不进灯箱
|
||||
- 🔧 **新增「素材」目录挂载**:docker-compose.yml 与 README(compose / docker run 两种方式)补挂载 `/vol2/1000/HD2/素材`,该目录可正常添加为素材库(此前报「素材库路径不存在」)
|
||||
|
||||
## 2026-11-19 → v1.4.13
|
||||
|
||||
- ✨ **灯箱底部新增缩略图条**:双击图片放大后,底部列出当前文件夹(含筛选结果)的全部图片缩略图,点任意一张直接跳转查看,不用一张张翻
|
||||
- 缩略图条显示「当前序号 / 总数」,当前图紫色高亮并自动滚动居中;切图时(含左右方向键/箭头按钮)缩略图条同步跟随
|
||||
- 缩略图走原 thumbnail 缩略图接口全量加载(弹层滚动容器内不使用 lazy,避免 Chromium 中永不加载),无缩略图的文件显示格式角标兜底
|
||||
- 缩略图条通过 portal 挂到 body、层级压在灯箱(z-index 2000)之上,不被祖先层叠上下文遮挡;数据与灯箱图片列表同源同序,跳转序号严格对齐
|
||||
- ✨ **幻灯片播放**:缩略图条左侧新增 ▶ 播放 / ⏸ 暂停按钮,开启后按选定间隔自动切下一张,放完最后一张循环回首张;手动点缩略图或用箭头切图时计时器重新计时,每张图都停留满一个间隔;关闭灯箱自动停播
|
||||
- 切换间隔可选 1 / 2 / 3 / 5 / 10 秒(下拉选择),选择存 localStorage 下次沿用,默认 3 秒
|
||||
- 修复缩略图破图:后端对部分视频缩略图返回 0 字节 webp 导致浏览器显示碎图,加载失败自动退化为格式角标
|
||||
|
||||
## 2026-11-19 → v1.4.12
|
||||
|
||||
- ✨ **设置 → AI 生图新增「免费生图:Cloudflare Workers AI 提供商」说明卡**:标注每日免费额度(10000 neurons/天,北京时间 08:00 重置,FLUX.1 schnell 约 10 neurons/张 ≈ 每天约 1000 张),并给出两步申请地址——① 注册 Cloudflare 账号(免费、无需信用卡)② 创建 API Token(Workers AI Run 权限),含 Token 创建提示
|
||||
- 顶部简介同步补充免费额度入口提示
|
||||
|
||||
## 2026-11-19 → v1.4.11
|
||||
|
||||
- ✨ **AI 生图弹窗新增「生图模型」点选**:按通道分组列出全部可选模型(CF Workers AI / Pollinations),点一下即选中并高亮,所选模型存 localStorage 下次沿用;自定义提供商则显示设置里配置的模型
|
||||
- 生成时把所选模型带给后端(effModel = 前端所选 > 设置默认),后端加模型白名单校验,未知模型名直接 400
|
||||
- 选了参考图时提示会自动切 FLUX.2 图生图模型;右上角保留「通道设置」入口
|
||||
|
||||
## 2026-11-19 → v1.4.10
|
||||
|
||||
- ✨ **提示词全中文化**:40 条图片预设新增中文详细提示词 promptCn(主体+场景+光线+构图+风格+质量),预设卡片、悬浮提示、点击填入全部显示中文;英文 prompt 字段保留作对照与翻译兜底
|
||||
|
||||
@@ -103,6 +103,7 @@ services:
|
||||
- /vol2/1000/HD2/壁纸:/vol2/1000/HD2/壁纸
|
||||
- /vol2/1000/HD2/我的文档:/vol2/1000/HD2/我的文档
|
||||
- /vol2/1000/HD2/发布到平台的图片和视频:/vol2/1000/HD2/发布到平台的图片和视频
|
||||
- /vol2/1000/HD2/素材:/vol2/1000/HD2/素材
|
||||
# 持久化配置(素材库列表、管理员密码,不用改)
|
||||
- /vol3/1000/HD3/docker/flypic/config:/root/.flypic
|
||||
environment:
|
||||
@@ -145,6 +146,7 @@ docker run -d --name flypic --restart unless-stopped \
|
||||
-v /vol2/1000/HD2/壁纸:/vol2/1000/HD2/壁纸 \
|
||||
-v "/vol2/1000/HD2/我的文档:/vol2/1000/HD2/我的文档" \
|
||||
-v "/vol2/1000/HD2/发布到平台的图片和视频:/vol2/1000/HD2/发布到平台的图片和视频" \
|
||||
-v "/vol2/1000/HD2/素材:/vol2/1000/HD2/素材" \
|
||||
jpccr.ccs.tencentyun.com/jinghui/flypic:latest
|
||||
```
|
||||
|
||||
|
||||
@@ -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.14';
|
||||
const TIMEOUT_MS = 8000;
|
||||
|
||||
const state = {
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ services:
|
||||
- /vol2/1000/HD2/壁纸:/vol2/1000/HD2/壁纸
|
||||
- /vol2/1000/HD2/我的文档:/vol2/1000/HD2/我的文档
|
||||
- /vol2/1000/HD2/发布到平台的图片和视频:/vol2/1000/HD2/发布到平台的图片和视频
|
||||
- /vol2/1000/HD2/素材:/vol2/1000/HD2/素材
|
||||
# 持久化配置(config.json 存储素材库路径、密码等,不用改)
|
||||
- /vol3/1000/HD3/docker/flypic/config:/root/.flypic
|
||||
environment:
|
||||
@@ -28,7 +29,7 @@ services:
|
||||
- HUB_API_KEY=${HUB_API_KEY:-}
|
||||
- NEWAPI_KEY=${NEWAPI_KEY:-}
|
||||
# 当前站点版本(与 frontend/package.json、CHANGELOG 保持一致,界面版本徽标来源)
|
||||
- SITE_VERSION=1.4.10
|
||||
- SITE_VERSION=1.4.14
|
||||
# 让容器经 host.docker.internal 访问宿主机的 AI 侧车
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
@@ -12,7 +12,7 @@ import { PROMPT_CATEGORIES } from '../constants/promptPresets';
|
||||
/**
|
||||
* AI 生图弹窗
|
||||
* - 热门提示词分类(点击填入/追加)
|
||||
* - 通道与模型统一在「设置 → AI 生图」配置,弹窗不再重复选择
|
||||
* - 弹窗内点选生图模型(列表来自设置配置的模型分组),KEY/通道仍在「设置 → AI 生图」
|
||||
* - 生成 → 预览 → 保存到素材库 / 下载 / 重新生成
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,8 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
const [cat, setCat] = useState('hot');
|
||||
const [sizes, setSizes] = useState([]);
|
||||
const [providerInfo, setProviderInfo] = useState(null);
|
||||
const [modelGroups, setModelGroups] = useState([]); // 可选生图模型分组
|
||||
const [selModel, setSelModel] = useState(''); // 用户点选的模型 id(空=设置默认)
|
||||
const [size, setSize] = useState('1024x1024');
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -69,6 +71,15 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
.then((d) => {
|
||||
setSizes(d.sizes || []);
|
||||
setProviderInfo(d.provider || null);
|
||||
const groups = d.groups || [];
|
||||
setModelGroups(groups);
|
||||
const all = groups.flatMap((g) => (g.models || []).map((m) => m.id));
|
||||
const p = d.provider || {};
|
||||
// 自定义提供商:只有设置里填的那个模型可用
|
||||
if (p.type === 'custom') { setSelModel(p.customModel || ''); return; }
|
||||
const def = p.builtinModel || 'flux-schnell';
|
||||
const saved = localStorage.getItem('flypic_aigen_model');
|
||||
setSelModel(all.includes(saved) ? saved : (all.includes(def) ? def : (all[0] || def)));
|
||||
})
|
||||
.catch((e) => setError('读取模型列表失败: ' + (e.data?.error || e.message)));
|
||||
}, [open]);
|
||||
@@ -121,6 +132,7 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
try {
|
||||
const d = await aigenAPI.generate({
|
||||
prompt: prompt.trim(),
|
||||
model: selModel || undefined,
|
||||
size,
|
||||
libraryId: currentLibraryId,
|
||||
refImages: refs.map((r) => ({ path: r.path, filename: r.filename })),
|
||||
@@ -271,17 +283,58 @@ export default function AIGenModal({ open, onClose, onSaved }) {
|
||||
|
||||
{/* 右:参数 + 生成 */}
|
||||
<div className="lg:col-span-2 space-y-3.5">
|
||||
{/* 通道/模型已统一在设置里配置,此处不再重复选择 */}
|
||||
<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"
|
||||
>
|
||||
去设置
|
||||
</button>
|
||||
{/* 生图模型:列出可点选的模型 */}
|
||||
<div className="px-3 py-2.5 rounded-lg bg-gray-50 dark:bg-gray-900/40 border border-gray-200 dark:border-gray-700">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-xs font-medium text-gray-500 dark:text-gray-400">生图模型</span>
|
||||
<button
|
||||
onClick={() => window.dispatchEvent(new CustomEvent('open:settings', { detail: { tab: 'aigen' } }))}
|
||||
className="text-[11px] text-purple-600 dark:text-purple-400 hover:underline"
|
||||
>
|
||||
通道设置
|
||||
</button>
|
||||
</div>
|
||||
{providerInfo && providerInfo.type === 'custom' ? (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
<span className="px-2.5 py-1 rounded-full text-[11px] bg-purple-600 text-white border border-purple-600">
|
||||
{providerInfo.customModel || '自定义模型'}
|
||||
</span>
|
||||
<span className="px-1 py-1 text-[11px] text-gray-400 dark:text-gray-500 self-center">
|
||||
自定义提供商的模型在设置里配置
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-1.5">
|
||||
{modelGroups.map((g) => (
|
||||
<div key={g.key} className="flex items-start gap-2">
|
||||
<span className="text-[10px] text-gray-400 dark:text-gray-500 w-[76px] flex-shrink-0 pt-1 leading-4">{g.label}</span>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{(g.models || []).map((m) => (
|
||||
<button
|
||||
key={m.id}
|
||||
type="button"
|
||||
title={m.id}
|
||||
onClick={() => { setSelModel(m.id); localStorage.setItem('flypic_aigen_model', m.id); }}
|
||||
className={`px-2.5 py-1 rounded-full text-[11px] border transition-colors ${selModel === m.id
|
||||
? 'bg-purple-600 text-white border-purple-600'
|
||||
: 'bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 border-gray-200 dark:border-gray-600 hover:border-purple-400 hover:text-purple-600 dark:hover:text-purple-300'}`}
|
||||
>
|
||||
{m.name}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{!modelGroups.length && (
|
||||
<span className="text-[11px] text-gray-400 dark:text-gray-500">读取模型列表中…</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{refs.length > 0 && (
|
||||
<p className="mt-1.5 text-[11px] text-amber-600 dark:text-amber-400">
|
||||
已选参考图:后端会自动切到 FLUX.2 图生图模型
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{noKey && (
|
||||
<div className="flex items-start gap-1.5 text-[11px] text-amber-600 dark:text-amber-400">
|
||||
|
||||
@@ -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.10';
|
||||
const appVersion = hub.version ? `v${String(hub.version).replace(/^v/, '')}` : 'v1.4.14';
|
||||
|
||||
// 从全局 store 获取筛选状态
|
||||
const selectedFormats = filters.formats || [];
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { useState, useMemo, useCallback, useRef } from 'react';
|
||||
import { PhotoProvider } from 'react-photo-view';
|
||||
import PhotoStrip from './PhotoStrip';
|
||||
import 'react-photo-view/dist/react-photo-view.css';
|
||||
import { VariableSizeList as List } from 'react-window';
|
||||
|
||||
@@ -197,10 +198,15 @@ function ImageWaterfall() {
|
||||
return imageAPI.getOriginalUrl(currentLibraryId, image.path);
|
||||
}, [currentLibraryId]);
|
||||
|
||||
// 灯箱只收图片:视频/文档双击走 FileViewer,不进灯箱列表(底部缩略图条同源,打不开的文件不显示)
|
||||
const lightboxImages = useMemo(() => {
|
||||
return filteredImages.filter(img => (img.fileType || 'image') === 'image');
|
||||
}, [filteredImages]);
|
||||
|
||||
// PhotoProvider 图片列表
|
||||
const providerImages = useMemo(() => {
|
||||
return filteredImages.map(img => ({ src: getOriginalUrl(img), key: img.id }));
|
||||
}, [filteredImages, getOriginalUrl]);
|
||||
return lightboxImages.map(img => ({ src: getOriginalUrl(img), key: img.id }));
|
||||
}, [lightboxImages, getOriginalUrl]);
|
||||
|
||||
// 图片点击处理 —— 单击选中,双击放大
|
||||
const handleImageClick = useCallback((image, event, imageIndex) => {
|
||||
@@ -236,11 +242,13 @@ function ImageWaterfall() {
|
||||
const handleImageDoubleClick = useCallback((image, flatIndex) => {
|
||||
const fileType = image.fileType || 'image';
|
||||
if (fileType === 'image') {
|
||||
setPhotoIndex(flatIndex);
|
||||
// flatIndex 是全量列表索引,灯箱列表只含图片 → 映射为图片子集索引
|
||||
const idx = lightboxImages.findIndex(im => im.id === image.id);
|
||||
setPhotoIndex(idx >= 0 ? idx : 0);
|
||||
} else {
|
||||
setViewerFile(image);
|
||||
}
|
||||
}, []);
|
||||
}, [lightboxImages]);
|
||||
|
||||
// 文件名双击处理(重命名)
|
||||
const handleFilenameDoubleClick = useCallback((e, image) => {
|
||||
@@ -660,6 +668,14 @@ onToggleFavorite={handleToggleFavorite}
|
||||
)}
|
||||
</PhotoProvider>
|
||||
|
||||
{/* 灯箱底部缩略图条:只列图片(与 providerImages 同源对齐),点击跳转查看 */}
|
||||
<PhotoStrip
|
||||
images={lightboxImages}
|
||||
index={photoIndex}
|
||||
onIndexChange={setPhotoIndex}
|
||||
getThumbnailUrl={getThumbnailUrl}
|
||||
/>
|
||||
|
||||
{/* 文件查看器 */}
|
||||
{viewerFile && (
|
||||
<FileViewer
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* 灯箱底部缩略图条 + 幻灯片播放
|
||||
* 双击图片放大后,在底部列出当前文件夹(含筛选)下的全部图片,
|
||||
* 点击任意缩略图直接跳转查看,与 react-photo-view 的 index 一一对应。
|
||||
* 左侧提供幻灯片播放:▶ 播放 / ⏸ 暂停,间隔可选(1/2/3/5/10 秒,localStorage 记忆)。
|
||||
*
|
||||
* 通过 portal 挂到 body:react-photo-view 也是 portal 到 body(z-index 2000),
|
||||
* 这里用 2100 保证压在其上方,且不被祖先的 transform/filter 形成的层叠上下文困住。
|
||||
*/
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
const INTERVAL_KEY = 'flypic_slideshow_interval';
|
||||
const INTERVAL_OPTIONS = [1, 2, 3, 5, 10];
|
||||
|
||||
export default function PhotoStrip({ images, index, onIndexChange, getThumbnailUrl }) {
|
||||
const stripRef = useRef(null);
|
||||
const [playing, setPlaying] = useState(false);
|
||||
const [intervalSec, setIntervalSec] = useState(() => {
|
||||
const v = parseFloat(localStorage.getItem(INTERVAL_KEY));
|
||||
return INTERVAL_OPTIONS.includes(v) ? v : 3;
|
||||
});
|
||||
// 缩略图加载失败(后端可能返回 0 字节 webp)→ 退化为格式角标
|
||||
const [failed, setFailed] = useState({});
|
||||
|
||||
const total = images ? images.length : 0;
|
||||
|
||||
const changeInterval = (v) => {
|
||||
setIntervalSec(v);
|
||||
localStorage.setItem(INTERVAL_KEY, String(v));
|
||||
};
|
||||
|
||||
// 灯箱关闭即停播(组件在 index<0 时仍挂载,只是返回 null)
|
||||
useEffect(() => {
|
||||
if (index < 0 && playing) setPlaying(false);
|
||||
}, [index, playing]);
|
||||
|
||||
// 幻灯片:每张停留 intervalSec,到末尾循环回首张;
|
||||
// 手动跳转(index 变化)会重排计时器,让新图也停留满一个间隔。
|
||||
useEffect(() => {
|
||||
if (!playing || index < 0 || total < 2) return undefined;
|
||||
const t = setTimeout(() => onIndexChange((index + 1) % total), intervalSec * 1000);
|
||||
return () => clearTimeout(t);
|
||||
}, [playing, index, intervalSec, total, onIndexChange]);
|
||||
|
||||
// 切换图片时把当前缩略图滚到条中间(只滚条自身,不动页面)
|
||||
useEffect(() => {
|
||||
if (index < 0 || !stripRef.current) return;
|
||||
const el = stripRef.current.querySelector('[data-active="true"]');
|
||||
if (!el) return;
|
||||
const c = stripRef.current;
|
||||
c.scrollTo({
|
||||
left: el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}, [index]);
|
||||
|
||||
if (index < 0 || !images || !images.length) return null;
|
||||
|
||||
return createPortal(
|
||||
<div className="fixed bottom-0 left-0 right-0 z-[2100] bg-black/85 backdrop-blur-sm border-t border-white/10">
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
{/* 当前进度 */}
|
||||
<span className="shrink-0 text-[11px] text-gray-300 tabular-nums select-none pr-1 border-r border-white/15 mr-1">
|
||||
{index + 1} / {total}
|
||||
</span>
|
||||
|
||||
{/* 幻灯片播放:▶/⏸ + 间隔选择 */}
|
||||
<button
|
||||
type="button"
|
||||
title={playing ? '暂停幻灯片播放' : '幻灯片播放'}
|
||||
aria-label={playing ? '暂停幻灯片' : '播放幻灯片'}
|
||||
onClick={() => total >= 2 && setPlaying((p) => !p)}
|
||||
className={`shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-colors ${
|
||||
playing
|
||||
? 'bg-purple-500 text-white hover:bg-purple-400'
|
||||
: 'bg-white/10 text-gray-200 hover:bg-white/20'
|
||||
} ${total < 2 ? 'opacity-40 cursor-not-allowed' : ''}`}
|
||||
>
|
||||
{playing ? (
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
|
||||
<rect x="6" y="4" width="4" height="16" rx="1" />
|
||||
<rect x="14" y="4" width="4" height="16" rx="1" />
|
||||
</svg>
|
||||
) : (
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M7 4.5v15l13-7.5z" />
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
<select
|
||||
title="幻灯片切换间隔"
|
||||
aria-label="幻灯片切换间隔"
|
||||
value={intervalSec}
|
||||
onChange={(e) => changeInterval(parseFloat(e.target.value))}
|
||||
className={`shrink-0 h-7 rounded bg-white/10 text-[11px] text-gray-200 px-1 pr-4 outline-none cursor-pointer hover:bg-white/20 border border-transparent focus:border-purple-400/60 ${
|
||||
playing ? 'border-purple-400/60' : ''
|
||||
}`}
|
||||
>
|
||||
{INTERVAL_OPTIONS.map((s) => (
|
||||
<option key={s} value={s} className="bg-gray-900 text-gray-100">
|
||||
{s} 秒
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
{/* 缩略图横向滚动条 */}
|
||||
<div
|
||||
ref={stripRef}
|
||||
className="flex-1 flex items-center gap-1.5 overflow-x-auto overflow-y-hidden scrollbar-thin"
|
||||
style={{ scrollbarWidth: 'thin' }}
|
||||
>
|
||||
{images.map((img, i) => {
|
||||
const src = getThumbnailUrl ? getThumbnailUrl(img) : '';
|
||||
const active = i === index;
|
||||
const bad = failed[img.id ?? i];
|
||||
return (
|
||||
<button
|
||||
key={img.id ?? i}
|
||||
type="button"
|
||||
data-active={active ? 'true' : 'false'}
|
||||
title={img.filename || ''}
|
||||
onClick={() => onIndexChange(i)}
|
||||
className={`relative shrink-0 w-12 h-12 rounded overflow-hidden border-2 transition-all duration-150 ${
|
||||
active
|
||||
? 'border-purple-500 ring-2 ring-purple-400/60 scale-105 z-10'
|
||||
: 'border-transparent opacity-55 hover:opacity-100 hover:border-white/40'
|
||||
}`}
|
||||
>
|
||||
{src && !bad ? (
|
||||
<img
|
||||
src={src}
|
||||
alt={img.filename || ''}
|
||||
decoding="async"
|
||||
draggable={false}
|
||||
onError={() => setFailed((f) => ({ ...f, [img.id ?? i]: true }))}
|
||||
className="w-full h-full object-cover pointer-events-none"
|
||||
/>
|
||||
) : (
|
||||
<span className="w-full h-full flex items-center justify-center bg-gray-800 text-[9px] text-gray-400">
|
||||
{(img.format || (img.filename || '').split('.').pop() || '').slice(0, 5)}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
document.body
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
|
||||
import { X, ScanText, Info, Save, FlaskConical, Github, ExternalLink, Wand2, Film } from 'lucide-react';
|
||||
import { settingsAPI, aigenAPI } from '../api';
|
||||
|
||||
const APP_VERSION = 'v1.4.10';
|
||||
const APP_VERSION = 'v1.4.14';
|
||||
const REPO_URL = 'https://gitea.88531.cn/jinghui/flypic';
|
||||
|
||||
/**
|
||||
@@ -326,7 +326,7 @@ export default function SettingsModal({ open, onClose, versionLabel, initialTab
|
||||
{active === 'aigen' && cfg && ig && (
|
||||
<div className="space-y-5">
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">
|
||||
AI 生图默认走内置 NewAPI(Pollinations + CF Workers AI 两个生图渠道);也可以切换到自己的 OpenAI 兼容提供商。密钥只保存在本机,不出服务器。
|
||||
AI 生图默认走内置 NewAPI(Pollinations + CF Workers AI 两个生图渠道,CF Workers AI 提供商可免费申请、每日有免费额度,见下方说明);也可以切换到自己的 OpenAI 兼容提供商。密钥只保存在本机,不出服务器。
|
||||
</p>
|
||||
|
||||
<div>
|
||||
@@ -364,6 +364,37 @@ export default function SettingsModal({ open, onClose, versionLabel, initialTab
|
||||
|
||||
{ig.provider === 'newapi' && (
|
||||
<div className="space-y-3 p-4 bg-gray-50 dark:bg-gray-900/50 rounded-lg border border-gray-200 dark:border-gray-700">
|
||||
{/* CF Workers AI 免费额度 + 申请地址 */}
|
||||
<div className="p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800">
|
||||
<div className="flex items-center gap-1.5 mb-1">
|
||||
<span className="text-xs font-semibold text-blue-700 dark:text-blue-300">免费生图:Cloudflare Workers AI 提供商</span>
|
||||
<span className="px-1.5 py-0.5 text-[10px] font-medium rounded bg-blue-600 text-white">每日免费额度</span>
|
||||
</div>
|
||||
<p className="text-[11px] leading-relaxed text-blue-600/90 dark:text-blue-300/85">
|
||||
内置通道里的 CF Workers AI 提供商可自行免费申请:Workers 免费计划<strong className="font-medium">无需绑定信用卡</strong>,每天 10000 neurons 免费额度(北京时间每天 08:00 重置),FLUX.1 schnell 约 10 neurons/张,<strong className="font-medium">约合每天 1000 张免费文生图</strong>;DALL·E 3、FLUX 高质量等模型也走该额度。
|
||||
</p>
|
||||
<div className="mt-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[11px]">
|
||||
<a
|
||||
href="https://dash.cloudflare.com/sign-up"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="text-blue-600 dark:text-blue-400 hover:underline font-medium"
|
||||
>
|
||||
① 注册 Cloudflare 账号(免费)→
|
||||
</a>
|
||||
<a
|
||||
href="https://dash.cloudflare.com/profile/api-tokens"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="text-blue-600 dark:text-blue-400 hover:underline font-medium"
|
||||
>
|
||||
② 创建 API Token(Workers AI Run 权限)→
|
||||
</a>
|
||||
</div>
|
||||
<p className="mt-1 text-[10px] text-blue-500/80 dark:text-blue-400/70">
|
||||
Token 创建时直接选「Workers AI」预设模板即可,过期时间选 No expiration;申请到的 Token 填到下方 API Key 即可免费生图。
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1">接口地址</label>
|
||||
<input
|
||||
|
||||
Reference in new issue
Block a user