-
+
+ ) : (
+ enabledCategories.map((category) => (
+
+ {renderPromptCategory(category)}
+
+ ))
)}
diff --git a/lib/style-pro/config.ts b/lib/style-pro/config.ts
index e60381065..97a029688 100644
--- a/lib/style-pro/config.ts
+++ b/lib/style-pro/config.ts
@@ -22,6 +22,8 @@ export type StyleProCategory = {
options: StyleProOption[];
};
+export type StyleProPromptDisplayMode = "stacked" | "carousel";
+
export type StyleProConfig = {
enabled: boolean;
modelId: string;
@@ -29,6 +31,7 @@ export type StyleProConfig = {
negativePrompt: string;
aspectRatio: string;
imageSize: string;
+ promptDisplayMode: StyleProPromptDisplayMode;
categories: StyleProCategory[];
};
@@ -405,6 +408,7 @@ export const defaultStyleProConfig: StyleProConfig = {
negativePrompt: "低清晰度,畸变,文字乱码,主体变形,产品结构错误,多余物体,水印",
aspectRatio: "auto",
imageSize: "2K",
+ promptDisplayMode: "stacked",
categories: INDEX_25_STYLE_PRO_CATEGORIES,
};
@@ -433,6 +437,10 @@ function cleanNumber(value: unknown, fallback: number, min: number, max: number)
return Math.min(max, Math.max(min, Math.round(numeric)));
}
+function cleanPromptDisplayMode(value: unknown): StyleProPromptDisplayMode {
+ return value === "carousel" ? "carousel" : "stacked";
+}
+
function sortByOrder(items: T[]) {
return [...items].sort((a, b) => a.order - b.order || a.id.localeCompare(b.id));
}
@@ -507,6 +515,7 @@ export function normalizeStyleProConfig(value: unknown): StyleProConfig {
negativePrompt: cleanString(raw.negativePrompt, fallback.negativePrompt, 4000),
aspectRatio: cleanString(raw.aspectRatio, fallback.aspectRatio, 32),
imageSize: cleanString(raw.imageSize, fallback.imageSize, 32),
+ promptDisplayMode: cleanPromptDisplayMode(raw.promptDisplayMode),
categories: isLegacyDefaultCategories(sortedCategories)
? fallback.categories
: sortedCategories,
@@ -572,6 +581,7 @@ export function toPublicStyleProConfig(
enabled: config.enabled,
aspectRatio: config.aspectRatio,
imageSize: config.imageSize,
+ promptDisplayMode: config.promptDisplayMode,
categories: config.categories
.filter((category) => category.enabled)
.map((category) => ({
-
- {category.title}
-
-
+ ) : promptDisplayMode === "carousel" ? (
+
-
-
- {category.options.map((option) => {
- const selected = selectedIds.includes(option.id);
- return (
-
- );
- })}
-
-
+ {enabledCategories.map((category) => (
+
+
+ {renderPromptCategory(category, "carousel")}
-
- );
- })
+ ))}
+