File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -10,20 +10,19 @@ export const getRegistry = async (client: v1.DockerDesktopClient) => {
10
10
}
11
11
return { } ;
12
12
}
13
+ const writeRegistryIfNotExists = async ( ) => {
14
+ const registry = await readFileInPromptsVolume ( client , 'registry.yaml' )
15
+
16
+ if ( ! registry ) {
17
+ console . log ( 'writeRegistryIfNotExists: no registry' )
18
+ await writeFileToPromptsVolume ( client , JSON . stringify ( { files : [ { path : 'registry.yaml' , content : 'registry: {}' } ] } ) )
19
+ }
20
+ }
13
21
try {
22
+ await writeRegistryIfNotExists ( )
14
23
return await parseRegistry ( )
15
24
}
16
25
catch ( error ) {
17
- if ( typeof error === 'object' && error && 'stderr' in error && error . stderr && ( error . stderr as string ) . includes ( 'No such file or directory' ) ) {
18
- const payload = JSON . stringify ( {
19
- files : [ {
20
- path : 'registry.yaml' ,
21
- content : 'registry: {}'
22
- } ]
23
- } )
24
- await writeFileToPromptsVolume ( client , payload )
25
- return await parseRegistry ( ) ;
26
- }
27
26
client . desktopUI . toast . error ( 'Failed to get prompt registry: ' + error )
28
27
return { } ;
29
28
}
You can’t perform that action at this time.
0 commit comments