Skip to content

Commit 3056744

Browse files
committed
fix(gpt-runner-core): fix smol-ai generated
1 parent eac4c93 commit 3056744

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/gpt-runner-core/src/openai/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export class Openai {
1111
'Content-Type': 'application/json',
1212
'Authorization': `Bearer ${openaiKey}`,
1313
},
14+
rejectUnauthorized: false, // ignore ssl certificate errors
15+
1416
},
1517
(response) => {
1618
let responseData = ''

packages/gpt-runner-core/src/smol-ai/create-anything.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ export async function createAnything({
4141
})
4242

4343
try {
44-
const filepaths = JSON.parse(filepathsJson) as string[]
44+
// eslint-disable-next-line no-eval
45+
const filepaths = eval(filepathsJson) as string[]
4546

4647
let sharedDependenciesInfo = await FileManager.readFile({
4748
directory,
@@ -105,5 +106,6 @@ export async function createAnything({
105106
}
106107
catch (e) {
107108
console.error('Failed to parse result:', filepathsJson)
109+
console.error(e)
108110
}
109111
}

packages/gpt-runner-core/src/smol-ai/file-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class FileManager {
4646
directory,
4747
exclude,
4848
}: ReadDirParams) {
49-
const isExit = await fs.stat(directory).then(stat => stat.isDirectory())
49+
const isExit = existsSync(directory) && statSync(directory).isDirectory()
5050
const relativePathContentMap: Record<string, string> = {}
5151

5252
if (!isExit)
@@ -104,7 +104,7 @@ export class FileManager {
104104
directory,
105105
exclude,
106106
}: CleanDirParams) {
107-
const isExit = await fs.stat(directory).then(stat => stat.isDirectory())
107+
const isExit = existsSync(directory) && statSync(directory).isDirectory()
108108
if (!isExit)
109109
return
110110

0 commit comments

Comments
 (0)