feat: 在相册中为变清晰后的图片添加右上角图标标识

This commit is contained in:
Your Name 2025-12-29 08:09:42 +08:00
parent b8381c6160
commit 349a362f27
2 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,7 @@ type GalleryImage = {
imageSize?: string; // 图片尺寸(如 "2K", "4K")
createdAt: string;
chatId: string;
modelId?: string; // 模型ID,用于标识图片类型(如 "enhance-1.0" 表示变清晰后的图片)
};
type Pagination = {
@ -287,6 +288,12 @@ export default function GalleryPage() {
placeholder="blur"
blurDataURL="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjI3MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjI3MCIgZmlsbD0iI2VlZSIvPjwvc3ZnPg=="
/>
{/* 变清晰标识图标 */}
{img.modelId === "enhance-1.0" && (
<div className="absolute top-2 left-2 bg-blue-500/90 text-white rounded-full p-1.5 shadow-lg" title="变清晰后的图片">
<Sparkles className="h-4 w-4" />
</div>
)}
</div>
{/* 🆕 操作按钮(悬停时显示) */}
<div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-2">

View File

@ -39,6 +39,7 @@ export async function GET(request: NextRequest) {
imageSize: generatedImage.imageSize,
createdAt: generatedImage.createdAt,
chatId: generatedImage.chatId,
modelId: generatedImage.modelId, // 添加 modelId 字段
})
.from(generatedImage)
.where(eq(generatedImage.userId, userId))
@ -56,6 +57,7 @@ export async function GET(request: NextRequest) {
imageSize: img.imageSize,
createdAt: img.createdAt,
chatId: img.chatId,
modelId: img.modelId, // 添加 modelId 字段
}));
const totalPages = Math.ceil(total / pageSize);