added fast apply
if isEdit === true & Morph API Key is in .env: - Morph Fast Apply is activated.
This commit is contained in:
@@ -42,8 +42,8 @@ function parseAIResponse(response: string): ParsedResponse {
|
|||||||
const importPath = importMatch[1];
|
const importPath = importMatch[1];
|
||||||
// Skip relative imports and built-in React
|
// Skip relative imports and built-in React
|
||||||
if (!importPath.startsWith('.') && !importPath.startsWith('/') &&
|
if (!importPath.startsWith('.') && !importPath.startsWith('/') &&
|
||||||
importPath !== 'react' && importPath !== 'react-dom' &&
|
importPath !== 'react' && importPath !== 'react-dom' &&
|
||||||
!importPath.startsWith('@/')) {
|
!importPath.startsWith('@/')) {
|
||||||
// Extract package name (handle scoped packages like @heroicons/react)
|
// Extract package name (handle scoped packages like @heroicons/react)
|
||||||
const packageName = importPath.startsWith('@')
|
const packageName = importPath.startsWith('@')
|
||||||
? importPath.split('/').slice(0, 2).join('/')
|
? importPath.split('/').slice(0, 2).join('/')
|
||||||
@@ -495,7 +495,7 @@ export async function POST(request: NextRequest) {
|
|||||||
results.packagesInstalled = data.installedPackages;
|
results.packagesInstalled = data.installedPackages;
|
||||||
}
|
}
|
||||||
} catch (parseError) {
|
} catch (parseError) {
|
||||||
console.debug('Error parsing terminal output:', parseError);
|
console.debug('Error parsing terminal output:', parseError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -599,9 +599,9 @@ export async function POST(request: NextRequest) {
|
|||||||
normalizedPath = normalizedPath.substring(1);
|
normalizedPath = normalizedPath.substring(1);
|
||||||
}
|
}
|
||||||
if (!normalizedPath.startsWith('src/') &&
|
if (!normalizedPath.startsWith('src/') &&
|
||||||
!normalizedPath.startsWith('public/') &&
|
!normalizedPath.startsWith('public/') &&
|
||||||
normalizedPath !== 'index.html' &&
|
normalizedPath !== 'index.html' &&
|
||||||
!configFiles.includes(normalizedPath.split('/').pop() || '')) {
|
!configFiles.includes(normalizedPath.split('/').pop() || '')) {
|
||||||
normalizedPath = 'src/' + normalizedPath;
|
normalizedPath = 'src/' + normalizedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user