File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
packages/core/src/codewhispererChat/controllers/chat Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -479,16 +479,19 @@ export class ChatController {
479479 // Check ~/.aws/prompts for saved prompts
480480 try {
481481 const systemPromptsDirectory = path . join ( fs . getUserHomeDir ( ) , '.aws' , 'prompts' )
482- const systemPromptFiles = await fs . readdir ( systemPromptsDirectory )
483- promptsCmd . children ?. [ 0 ] . commands . push (
484- ...systemPromptFiles
485- . filter ( ( [ name ] ) => name . endsWith ( '.prompt' ) )
486- . map ( ( [ name ] ) => ( {
487- command : name . replace ( / \. p r o m p t $ / , '' ) ,
488- icon : 'magic' as MynahIconsType ,
489- route : [ systemPromptsDirectory , name ] ,
490- } ) )
491- )
482+ const directoryExists = await fs . exists ( systemPromptsDirectory )
483+ if ( directoryExists ) {
484+ const systemPromptFiles = await fs . readdir ( systemPromptsDirectory )
485+ promptsCmd . children ?. [ 0 ] . commands . push (
486+ ...systemPromptFiles
487+ . filter ( ( [ name ] ) => name . endsWith ( '.prompt' ) )
488+ . map ( ( [ name ] ) => ( {
489+ command : name . replace ( / \. p r o m p t $ / , '' ) ,
490+ icon : 'magic' as MynahIconsType ,
491+ route : [ systemPromptsDirectory , name ] ,
492+ } ) )
493+ )
494+ }
492495 } catch ( e ) {
493496 getLogger ( ) . verbose ( `Could not read prompts from ~/.aws/prompts: ${ e } ` )
494497 }
You can’t perform that action at this time.
0 commit comments