File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111import { ai } from '@/ai/genkit' ;
1212import { z } from 'genkit' ;
1313
14- export const EditFileContentAIInputSchema = z . object ( {
14+ const EditFileContentAIInputSchema = z . object ( {
1515 currentContent : z . string ( ) . describe ( 'The current content of the file.' ) ,
1616 userPrompt : z . string ( ) . describe ( 'A prompt from the user describing the desired changes.' ) ,
1717} ) ;
1818export type EditFileContentAIInput = z . infer < typeof EditFileContentAIInputSchema > ;
1919
20- export const EditFileContentAIOutputSchema = z . object ( {
20+ const EditFileContentAIOutputSchema = z . object ( {
2121 newContent : z
2222 . string ( )
2323 . describe ( 'The complete, new content of the file after applying the edits.' ) ,
@@ -62,8 +62,11 @@ const editFileContentAIFlow = ai.defineFlow(
6262 // Fallback or error handling if AI doesn't return expected output
6363 console . error ( "AI did not return the expected new content for file editing." ) ;
6464 // Optionally, return original content or throw an error
65+ // For now, returning original content to avoid breaking the file completely if AI fails.
66+ // A more robust solution might involve user feedback or retries.
6567 return { newContent : input . currentContent } ;
6668 }
6769 return output ;
6870 }
6971) ;
72+
You can’t perform that action at this time.
0 commit comments