fix: grok-image 补齐 aspect_ratio 与 resolution 传参 (#184)

* fix: grok-image 补齐 aspect_ratio 与 resolution 传参

- 能力配置开放比例与 1k/2k 分辨率
- 请求体映射 size→aspect_ratio、quality→resolution
- 画布设置展示「分辨率」选项
- 补充单测

Closes #182

* fix(create): 创作页图片质量支持 1k/2k 分辨率选项

创作页原先硬编码 auto/low/medium/high,导致 grok 能力配置里的 1k/2k
无法显示;改为按模型 quality.values 动态渲染,有 1k/2k 时标题显示「分辨率」。
This commit is contained in:
Andrew
2026-08-08 18:27:36 +08:00
committed by GitHub
parent 0a5aa33c73
commit 554eb49000
8 changed files with 164 additions and 15 deletions

View File

@@ -10,6 +10,8 @@ const qualityOptions = [
{ value: "high", label: "高" },
{ value: "medium", label: "中" },
{ value: "low", label: "低" },
{ value: "1k", label: "1K" },
{ value: "2k", label: "2K" },
];
const DIMENSION_STEP = 16;
@@ -78,8 +80,8 @@ export function ImageSettingsPanel({ config, onConfigChange, theme, showTitle =
>
{showTitle ? <div className="text-base font-semibold">图像设置</div> : null}
{profile.quality.supported ? <div className="space-y-2">
<SettingTitle color={theme.node.muted}>质量</SettingTitle>
<div className="grid grid-cols-4 gap-1.5">
<SettingTitle color={theme.node.muted}>{isGrokResolutionQuality(profile) ? "分辨率" : "质量"}</SettingTitle>
<div className={`grid gap-1.5 ${activeQualityOptions.length <= 2 ? "grid-cols-2" : "grid-cols-4"}`}>
{activeQualityOptions.map((item) => (
<OptionPill key={item.value} selected={quality === item.value} theme={theme} onClick={() => onConfigChange("quality", item.value)}>
{item.label}
@@ -181,7 +183,12 @@ export function ImageSettingsTheme({ theme, children }: { theme: CanvasTheme; ch
}
export function imageQualityLabel(value: string) {
return ({ auto: "自动", high: "高", medium: "中", low: "低" } as Record<string, string>)[value] || "默认";
return ({ auto: "自动", high: "高", medium: "中", low: "低", "1k": "1K", "2k": "2K" } as Record<string, string>)[value] || value || "默认";
}
function isGrokResolutionQuality(profile: ImageCapabilityConfig) {
const values = profile.quality.values.map((item) => item.toLowerCase());
return values.includes("1k") || values.includes("2k");
}
export function imageSizeLabel(size: string) {