优化图片预览清晰度并修复模型切换后无法发送
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-02-07 21:29:31 +08:00
parent a921a9d984
commit ab95548b2c
2 changed files with 10 additions and 2 deletions

View File

@ -171,6 +171,11 @@ export function ImagePreview({
};
const { thumbnail, original, maxWidth, is4K } = parseImageUrls();
const preferOriginalForPreview = maxWidth >= 380 && original && original !== thumbnail;
const previewSrc = preferOriginalForPreview ? original : thumbnail;
const previewSrcSet = original
? `${thumbnail} 1x, ${original} 2x`
: undefined;
// 下载图片函数(下载原图)
const handleDownload = async () => {
@ -243,7 +248,8 @@ export function ImagePreview({
{/* 缩略图(显示压缩后的缩略图)*/}
<div className="group relative inline-block max-w-full mr-3 mb-3">
<img
src={thumbnail}
src={previewSrc}
srcSet={previewSrcSet}
alt="Generated Image"
className="cursor-pointer rounded-lg transition-opacity hover:opacity-90"
style={{
@ -252,6 +258,8 @@ export function ImagePreview({
width: "100%",
objectFit: "contain"
}}
loading="lazy"
decoding="async"
onClick={() => setIsOpen(true)}
/>

View File

@ -759,7 +759,7 @@ function PureMultimodalInput({
className="rounded-xl border border-border bg-background p-3 shadow-xs transition-all duration-200 focus-within:border-border hover:border-muted-foreground/50"
onSubmit={(event) => {
event.preventDefault();
if (status !== "ready") {
if (status === "submitted" || status === "streaming") {
toast.error("请等待模型返回当前回复后再继续");
} else {
submitForm();