@@ -8,12 +8,12 @@ const external = (file: string): boolean => {
88} ;
99
1010export const path = async ( file : string ) : Promise < string > => {
11- if ( ! external ( file ) ) return `${ SCRIPTS_PATH } /${ file } .gpt` ;
11+ if ( ! external ( file ) ) return `${ SCRIPTS_PATH ( ) } /${ file } .gpt` ;
1212 return file ;
1313} ;
1414
1515export const fetchFullScript = async ( file : string ) : Promise < Block [ ] > => {
16- if ( ! external ( file ) ) file = `${ SCRIPTS_PATH } /${ file } .gpt` ;
16+ if ( ! external ( file ) ) file = `${ SCRIPTS_PATH ( ) } /${ file } .gpt` ;
1717
1818 const gptscript = new GPTScript ( ) ;
1919 try {
@@ -24,7 +24,7 @@ export const fetchFullScript = async (file: string): Promise<Block[]> => {
2424}
2525
2626export const fetchScript = async ( file : string ) : Promise < Tool > => {
27- if ( ! external ( file ) ) file = `${ SCRIPTS_PATH } /${ file } .gpt` ;
27+ if ( ! external ( file ) ) file = `${ SCRIPTS_PATH ( ) } /${ file } .gpt` ;
2828
2929 const gptscript = new GPTScript ( ) ;
3030 try {
@@ -44,15 +44,15 @@ export const fetchScript = async (file: string): Promise<Tool> => {
4444
4545export const fetchScripts = async ( ) : Promise < Record < string , string > > => {
4646 try {
47- const files = await fs . readdir ( SCRIPTS_PATH ) ;
47+ const files = await fs . readdir ( SCRIPTS_PATH ( ) ) ;
4848 const gptFiles = files . filter ( file => file . endsWith ( '.gpt' ) ) ;
4949
5050 if ( gptFiles . length === 0 ) throw new Error ( 'no files found in scripts directory' ) ;
5151
5252 const gptscript = new GPTScript ( ) ;
5353 const scripts : Record < string , string > = { } ;
5454 for ( const file of gptFiles ) {
55- const script = await gptscript . parse ( `${ SCRIPTS_PATH } /${ file } ` ) ;
55+ const script = await gptscript . parse ( `${ SCRIPTS_PATH ( ) } /${ file } ` ) ;
5656 let description = '' ;
5757 for ( let tool of script ) {
5858 if ( tool . type === 'text' ) continue ;
@@ -73,7 +73,7 @@ export const fetchScripts = async (): Promise<Record<string, string>> => {
7373export const fetchScriptCode = async ( file : string ) : Promise < string > => {
7474 file = file . includes ( '.gpt' ) ? file : `${ file } .gpt` ;
7575 try {
76- return await fs . readFile ( `${ SCRIPTS_PATH } /${ file } ` , 'utf-8' ) ;
76+ return await fs . readFile ( `${ SCRIPTS_PATH ( ) } /${ file } ` , 'utf-8' ) ;
7777 } catch ( e ) {
7878 throw e ;
7979 }
0 commit comments