优化图片预览清晰度并修复模型切换后无法发送
This commit is contained in:
parent
a921a9d984
commit
ab95548b2c
@ -171,6 +171,11 @@ export function ImagePreview({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const { thumbnail, original, maxWidth, is4K } = parseImageUrls();
|
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 () => {
|
const handleDownload = async () => {
|
||||||
@ -243,7 +248,8 @@ export function ImagePreview({
|
|||||||
{/* 缩略图(显示压缩后的缩略图)*/}
|
{/* 缩略图(显示压缩后的缩略图)*/}
|
||||||
<div className="group relative inline-block max-w-full mr-3 mb-3">
|
<div className="group relative inline-block max-w-full mr-3 mb-3">
|
||||||
<img
|
<img
|
||||||
src={thumbnail}
|
src={previewSrc}
|
||||||
|
srcSet={previewSrcSet}
|
||||||
alt="Generated Image"
|
alt="Generated Image"
|
||||||
className="cursor-pointer rounded-lg transition-opacity hover:opacity-90"
|
className="cursor-pointer rounded-lg transition-opacity hover:opacity-90"
|
||||||
style={{
|
style={{
|
||||||
@ -252,6 +258,8 @@ export function ImagePreview({
|
|||||||
width: "100%",
|
width: "100%",
|
||||||
objectFit: "contain"
|
objectFit: "contain"
|
||||||
}}
|
}}
|
||||||
|
loading="lazy"
|
||||||
|
decoding="async"
|
||||||
onClick={() => setIsOpen(true)}
|
onClick={() => setIsOpen(true)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@ -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"
|
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) => {
|
onSubmit={(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (status !== "ready") {
|
if (status === "submitted" || status === "streaming") {
|
||||||
toast.error("请等待模型返回当前回复后再继续");
|
toast.error("请等待模型返回当前回复后再继续");
|
||||||
} else {
|
} else {
|
||||||
submitForm();
|
submitForm();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user