perf: memo GridCard, fuse save fns, fix slash tab active color
This commit is contained in:
@@ -19,7 +19,7 @@ const createSchema = z.object({
|
||||
apiKey: z.string().min(8),
|
||||
alias: z.string().max(120).optional(),
|
||||
model: z.string().max(120).optional(),
|
||||
baseUrl: z.string().url().optional(),
|
||||
baseUrl: z.string().max(2000).optional(),
|
||||
});
|
||||
|
||||
import { PROVIDER_MODEL_SUGGESTIONS } from '@/lib/ai/models-list';
|
||||
@@ -75,8 +75,9 @@ export async function POST(req: NextRequest) {
|
||||
);
|
||||
}
|
||||
|
||||
const effectiveBaseUrl = provider === 'custom' ? body.baseUrl : undefined;
|
||||
if (provider !== 'custom' && body.baseUrl) {
|
||||
const effectiveBaseUrl = (provider === 'custom' || provider === 'custom_openai' || provider === 'custom_anthropic') ? body.baseUrl : undefined;
|
||||
const allowsBaseUrl = provider === 'custom' || provider === 'custom_openai' || provider === 'custom_anthropic';
|
||||
if (!allowsBaseUrl && body.baseUrl) {
|
||||
return NextResponse.json(
|
||||
{ error: 'INVALID_REQUEST', message: 'baseUrl is only allowed for custom providers' },
|
||||
{ status: 400 },
|
||||
@@ -96,6 +97,7 @@ export async function POST(req: NextRequest) {
|
||||
plaintext: body.apiKey,
|
||||
alias: body.alias,
|
||||
model: body.model,
|
||||
baseUrl: effectiveBaseUrl,
|
||||
});
|
||||
|
||||
return NextResponse.json({ key: toPublicApiKey(row) });
|
||||
|
||||
Reference in New Issue
Block a user