Files

28 lines
847 B
JavaScript
Raw Permalink Normal View History

2026-03-17 14:36:31 +08:00
import { NextResponse } from 'next/server';
import path from 'path';
import fs from 'fs';
import { getProjectRoot } from '@/lib/db/base';
export async function GET(request, { params }) {
try {
const { projectId } = params;
if (!projectId) {
return NextResponse.json({ error: 'The project ID cannot be empty' }, { status: 400 });
}
const projectRoot = await getProjectRoot();
const projectPath = path.join(projectRoot, projectId);
const configPath = path.join(projectPath, 'dataset_info.json');
const exists = fs.existsSync(configPath);
return NextResponse.json({
exists,
configPath: exists ? configPath : null
});
} catch (error) {
console.error('Error checking Llama Factory config:', String(error));
return NextResponse.json({ error: error.message }, { status: 500 });
}
}