Fix RUXA nano-banana-2 runtime model id sync
This commit is contained in:
parent
37e48b7878
commit
56e68ff5d0
@ -59,6 +59,7 @@ export async function POST(request: Request) {
|
||||
|
||||
const addedModels: AiModel[] = [];
|
||||
const errors: { modelId: string; error: string }[] = [];
|
||||
const updatedModels: AiModel[] = [];
|
||||
|
||||
for (const preset of presetsToAdd) {
|
||||
try {
|
||||
@ -70,7 +71,31 @@ export async function POST(request: Request) {
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
errors.push({ modelId: preset.modelId, error: "Model already exists" });
|
||||
const [updated] = await db
|
||||
.update(aiModel)
|
||||
.set({
|
||||
displayName: preset.displayName,
|
||||
description: preset.description,
|
||||
supportsVision: preset.supportsVision,
|
||||
supportsImageGen: preset.supportsImageGen,
|
||||
sortOrder: preset.sortOrder,
|
||||
capabilities: preset.capabilities || null,
|
||||
defaultParams: preset.defaultParams || null,
|
||||
imageGenConfig: preset.imageGenConfig || null,
|
||||
})
|
||||
.where(
|
||||
and(
|
||||
eq(aiModel.providerId, providerId),
|
||||
eq(aiModel.modelId, preset.modelId)
|
||||
)
|
||||
)
|
||||
.returning();
|
||||
|
||||
if (updated) {
|
||||
updatedModels.push(updated);
|
||||
} else {
|
||||
errors.push({ modelId: preset.modelId, error: "Model exists but failed to sync" });
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -111,7 +136,9 @@ export async function POST(request: Request) {
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
addedCount: addedModels.length,
|
||||
updatedCount: updatedModels.length,
|
||||
addedModels,
|
||||
updatedModels,
|
||||
errors: errors.length > 0 ? errors : undefined,
|
||||
counts: {
|
||||
requested: presetsToAdd.length,
|
||||
@ -126,4 +153,3 @@ export async function POST(request: Request) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ export interface RuxaImageModelPreset {
|
||||
|
||||
export const RUXA_NANO_BANANA_2_MODEL_ID = "google/nano-banana-2";
|
||||
export const RUXA_NANO_BANANA_PRO_MODEL_ID = "google/nano-banana-pro";
|
||||
export const RUXA_NANO_BANANA_2_RUNTIME_MODEL_ID = "gemini-3.1-flash-image-preview";
|
||||
|
||||
const RUXA_IMAGE_CONFIG = {
|
||||
maxImages: 1,
|
||||
@ -38,7 +39,7 @@ export const RUXA_IMAGE_MODEL_PRESETS: RuxaImageModelPreset[] = [
|
||||
supportsImageGen: true,
|
||||
defaultParams: {
|
||||
provider: "ruxa",
|
||||
endpoint: "nano-banana-2",
|
||||
endpoint: RUXA_NANO_BANANA_2_RUNTIME_MODEL_ID,
|
||||
imageSize: "2K",
|
||||
aspectRatio: "1:1",
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user