fix: Volcengine model list pollution + missing by-cwd route
- provider-catalog: getDefaultModelsForProvider() now returns preset's defaultModels even when empty, instead of falling through to ANTHROPIC_DEFAULT_MODELS. Fixes Volcengine (defaultModels: []) incorrectly showing Sonnet/Opus/Haiku. - providers/models route: remove DEFAULT_MODELS fallback when both DB and catalog are empty — providers like Volcengine that require user-specified model names should show only those models. - Add missing src/app/api/chat/sessions/by-cwd/route.ts that was untracked; without it worktree switching would 404 in release builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
0eabed8c27
commit
4e01902368
3 files changed
+23
-6
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getLatestSessionByWorkingDirectory } from '@/lib/db';
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const cwd = req.nextUrl.searchParams.get('cwd');
|
||||
if (!cwd) {
|
||||
return NextResponse.json({ error: 'cwd is required' }, { status: 400 });
|
||||
}
|
||||
|
||||
const session = getLatestSessionByWorkingDirectory(cwd);
|
||||
if (session) {
|
||||
return NextResponse.json({ sessionId: session.id });
|
||||
}
|
||||
return NextResponse.json({ sessionId: null });
|
||||
}
|
||||
@@ -128,14 +128,14 @@ export async function GET() {
|
||||
capabilities: m.capabilities as Record<string, unknown> | undefined,
|
||||
}));
|
||||
|
||||
// Start with DB models + catalog defaults
|
||||
// Start with DB models + catalog defaults.
|
||||
// If both are empty (e.g. Volcengine where user must specify model names),
|
||||
// leave rawModels empty — do NOT fall back to DEFAULT_MODELS (Sonnet/Opus/Haiku).
|
||||
if (dbModels.length > 0) {
|
||||
const dbIds = new Set(dbModels.map(m => m.value));
|
||||
rawModels = [...dbModels, ...catalogRaw.filter(m => !dbIds.has(m.value))];
|
||||
} else if (catalogRaw.length > 0) {
|
||||
rawModels = [...catalogRaw];
|
||||
} else {
|
||||
rawModels = [...DEFAULT_MODELS];
|
||||
rawModels = [...catalogRaw];
|
||||
}
|
||||
|
||||
// Inject role_models_json.default into the list if not already present
|
||||
|
||||
Reference in new issue
Block a user