diff --git a/app/(admin)/settings/admin-settings-client.tsx b/app/(admin)/settings/admin-settings-client.tsx
index bd63c42bb..16832f437 100644
--- a/app/(admin)/settings/admin-settings-client.tsx
+++ b/app/(admin)/settings/admin-settings-client.tsx
@@ -153,6 +153,7 @@ import {
normalizeDetailAgentLocalMoonshotConfig,
} from "@/lib/ai/detail-agent-model-config";
import { FAL_IMAGE_MODEL_PRESETS } from "@/lib/ai/fal-image-models";
+import { RUXA_IMAGE_MODEL_PRESETS } from "@/lib/ai/ruxa-image-models";
import {
formatImageModelCreditDiscountLabel,
getGenerationCreditCostFromImageGenConfig,
@@ -6095,6 +6096,7 @@ export function AdminSettingsClient() {
const isVolcanoVideo = providerForm.type === "volcano-video";
const isKreaProvider = providerForm.type === "krea";
const isFalImageProvider = providerForm.type === "fal-image";
+ const isRuxaImageProvider = providerForm.type === "ruxa-image";
const isBltcyVideoProvider = providerForm.type === "bltcy-video";
const isLemonProvider =
providerForm.type === "openai" &&
@@ -6215,6 +6217,17 @@ export function AdminSettingsClient() {
}
}
+ if (isNewProvider && isRuxaImageProvider && providerId) {
+ try {
+ await handleQuickAddRuxaImageModels(providerId, { skipConfirm: true });
+ } catch (modelError) {
+ console.error("[Auto Add RUXA Image Models] Error:", modelError);
+ toast.warning(
+ 'RUXA 生图预设模型添加失败,请手动点击"快速添加 RUXA 图片预设"按钮'
+ );
+ }
+ }
+
if (isNewProvider && isBltcyVideoProvider && providerId) {
try {
await handleQuickAddBltcyVideoModels(providerId, {
@@ -7099,6 +7112,50 @@ export function AdminSettingsClient() {
}
};
+ const handleQuickAddRuxaImageModels = async (
+ providerId: string,
+ options?: { skipConfirm?: boolean }
+ ) => {
+ if (
+ !options?.skipConfirm &&
+ !confirm(
+ `将为此服务商添加 ${RUXA_IMAGE_MODEL_PRESETS.length} 个 RUXA 生图预设模型(含 Nano Banana 2「专线」、Nano Banana Pro「专线」)。\n\n继续吗?`
+ )
+ ) {
+ return;
+ }
+
+ try {
+ toast.info("正在添加 RUXA 生图预设模型...");
+
+ const response = await fetch("/api/admin/ruxa-image-models", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ providerId }),
+ });
+
+ const data = await response.json();
+
+ if (!response.ok) {
+ throw new Error(data.error || "添加失败");
+ }
+
+ const { addedCount, errors } = data;
+
+ if (addedCount > 0) {
+ toast.success(`成功添加 ${addedCount} 个 RUXA 生图预设模型`);
+ mutateModels();
+ }
+
+ if (errors && errors.length > 0) {
+ toast.warning(`${errors.length} 个模型添加失败(可能已存在)`);
+ }
+ } catch (error: any) {
+ console.error("[Quick Add RUXA Image Models] Error:", error);
+ toast.error(error.message || "添加 RUXA 生图预设模型失败");
+ }
+ };
+
const handleUseFalImageProviderPreset = () => {
setProviderForm({
id: "",
@@ -15113,6 +15170,17 @@ export function AdminSettingsClient() {
快速添加 Krea 预设模型
)}
+ {provider.type === "ruxa-image" && (
+
+ )}
{provider.type === "fal-image" && (