diff --git a/app/(admin)/settings/style-pro/style-pro-settings-client.tsx b/app/(admin)/settings/style-pro/style-pro-settings-client.tsx index 8341cc6b3..773e33a83 100644 --- a/app/(admin)/settings/style-pro/style-pro-settings-client.tsx +++ b/app/(admin)/settings/style-pro/style-pro-settings-client.tsx @@ -106,6 +106,47 @@ function modelLabel(model: AiModelOption) { return `${name}${id}${model.isHidden ? " · 前端隐藏" : ""}`; } +function ColorSettingField({ + label, + value, + onChange, +}: { + label: string; + value: string; + onChange: (value: string) => void; +}) { + const shortHex = value.match(/^#([0-9a-fA-F]{3})$/); + const pickerValue = /^#[0-9a-fA-F]{6}$/.test(value) + ? value + : shortHex + ? `#${shortHex[1] + .split("") + .map((char) => `${char}${char}`) + .join("")}` + : "#000000"; + + return ( +
+ +
+ onChange(event.target.value)} + type="color" + value={pickerValue} + /> + onChange(event.target.value)} + placeholder="#2563eb" + value={value} + /> +
+
+ ); +} + export function StyleProSettingsClient() { const { data, mutate } = useSWR( `/api/admin/settings?key=${STYLE_PRO_CONFIG_KEY}`, @@ -135,11 +176,6 @@ export function StyleProSettingsClient() { allImageModels.filter((model) => model.isHidden !== true), [allImageModels] ); - const hiddenImageModels = useMemo( - () => allImageModels.filter((model) => model.isHidden === true), - [allImageModels] - ); - const updateConfig = (updates: Partial) => { setConfig((current) => ({ ...current, ...updates })); }; @@ -304,7 +340,7 @@ export function StyleProSettingsClient() { 基础设置 - 控制功能开关、风格化公开模型、实景化隐藏模型、默认提示词和生成规格。 + 控制功能开关、风格化公开模型、实景化模型链路、默认提示词和生成规格。 @@ -356,9 +392,9 @@ export function StyleProSettingsClient() {
- +

- 前台只显示“实景化”模式,不展示模型名称;这里仅可选择已在 AI 模型中设置为“前端隐藏”的图片模型。第一阶段失败时第二阶段不会继续执行。 + 前台只显示“实景化”模式,不展示模型名称;这里可选择所有已启用的生图模型。第一阶段失败时第二阶段不会继续执行。

@@ -379,16 +415,16 @@ export function StyleProSettingsClient() { 未配置 {config.realisticFirstModelId && - !hiddenImageModels.some( + !allImageModels.some( (model) => model.modelId === config.realisticFirstModelId || model.id === config.realisticFirstModelId ) ? ( - 当前保存值(未在隐藏模型列表中):{config.realisticFirstModelId} + 当前保存值(未在模型列表中):{config.realisticFirstModelId} ) : null} - {hiddenImageModels.map((model) => { + {allImageModels.map((model) => { const value = model.modelId || model.id; return ( @@ -416,16 +452,16 @@ export function StyleProSettingsClient() { 未配置 {config.realisticSecondModelId && - !hiddenImageModels.some( + !allImageModels.some( (model) => model.modelId === config.realisticSecondModelId || model.id === config.realisticSecondModelId ) ? ( - 当前保存值(未在隐藏模型列表中):{config.realisticSecondModelId} + 当前保存值(未在模型列表中):{config.realisticSecondModelId} ) : null} - {hiddenImageModels.map((model) => { + {allImageModels.map((model) => { const value = model.modelId || model.id; return ( @@ -523,6 +559,50 @@ export function StyleProSettingsClient() {

+
+
+ +

+ 控制风格化 PRO 页面里的分类标题、提示词按钮和选中按钮颜色,保存后前台立即按配置渲染。 +

+
+
+ updateConfig({ titleTextColor })} + value={config.titleTextColor} + /> + + updateConfig({ buttonBackgroundColor }) + } + value={config.buttonBackgroundColor} + /> + + updateConfig({ buttonTextColor }) + } + value={config.buttonTextColor} + /> + + updateConfig({ selectedButtonBackgroundColor }) + } + value={config.selectedButtonBackgroundColor} + /> + + updateConfig({ selectedButtonTextColor }) + } + value={config.selectedButtonTextColor} + /> +
+
+