fix: always honor selected image size from canvas toolbar
This commit is contained in:
parent
b28f1013da
commit
35a65f26f6
@ -102,18 +102,13 @@ export function ImageParamsBar({
|
||||
// Gemini:1~2 张
|
||||
return [1, 2];
|
||||
};
|
||||
const supportsSize = imageGenConfig?.supportsSize !== false;
|
||||
|
||||
const clampParamsByProvider = (raw: ImageGenerationParams): ImageGenerationParams => {
|
||||
const options = getImageCountOptions();
|
||||
const fallbackCount = options[0] ?? 1;
|
||||
const imageCount = options.includes(raw.imageCount || fallbackCount) ? (raw.imageCount || fallbackCount) : fallbackCount;
|
||||
const imageSize = supportsSize
|
||||
? (raw.imageSize || "2K")
|
||||
: "2K";
|
||||
return {
|
||||
...raw,
|
||||
imageSize,
|
||||
imageSize: raw.imageSize || "2K",
|
||||
imageCount,
|
||||
};
|
||||
};
|
||||
@ -209,37 +204,26 @@ export function ImageParamsBar({
|
||||
</DropdownMenu>
|
||||
|
||||
{/* 分辨率 */}
|
||||
{supportsSize ? (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" className="h-8 px-2 gap-1 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none focus:ring-0">
|
||||
<Maximize2 size={14} />
|
||||
<span className="font-medium text-xs">{params.imageSize}</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="center" className="min-w-[100px]">
|
||||
{IMAGE_SIZE_OPTIONS.map((option) => (
|
||||
<DropdownMenuItem
|
||||
key={option.value}
|
||||
onClick={() => updateParam("imageSize", option.value)}
|
||||
className="focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none focus:ring-0"
|
||||
>
|
||||
<Check className={cn("mr-2 h-4 w-4", params.imageSize === option.value ? "opacity-100" : "opacity-0")} />
|
||||
{option.label}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
) : (
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="h-8 px-2 gap-1 text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none focus:ring-0"
|
||||
disabled
|
||||
>
|
||||
<Maximize2 size={14} />
|
||||
<span className="font-medium text-xs">2K</span>
|
||||
</Button>
|
||||
)}
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" className="h-8 px-2 gap-1 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none focus:ring-0">
|
||||
<Maximize2 size={14} />
|
||||
<span className="font-medium text-xs">{params.imageSize}</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="center" className="min-w-[100px]">
|
||||
{IMAGE_SIZE_OPTIONS.map((option) => (
|
||||
<DropdownMenuItem
|
||||
key={option.value}
|
||||
onClick={() => updateParam("imageSize", option.value)}
|
||||
className="focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none focus:ring-0"
|
||||
>
|
||||
<Check className={cn("mr-2 h-4 w-4", params.imageSize === option.value ? "opacity-100" : "opacity-0")} />
|
||||
{option.label}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
{showImageCountSelector && (
|
||||
<DropdownMenu>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user