Skip to content

Commit

Permalink
fix: error invoking remote method readdirsync (janhq#2505)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Mar 26, 2024
1 parent 8f230f3 commit 84e1b09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion extensions/assistant-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default class JanAssistantExtension extends AssistantExtension {
fileName,
])

if (filePath.includes('.DS_Store')) continue
if (!(await fs.fileStat(filePath))?.isDirectory) continue
const jsonFiles: string[] = (await fs.readdirSync(filePath)).filter(
(file: string) => file === 'assistant.json'
)
Expand Down
5 changes: 2 additions & 3 deletions extensions/conversational-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ export default class JSONConversationalExtension extends ConversationalExtension
threadDirPath,
JSONConversationalExtension._threadMessagesFileName,
])
if (!(await fs.existsSync(threadDirPath)))
await fs.mkdir(threadDirPath)
if (!(await fs.existsSync(threadDirPath))) await fs.mkdir(threadDirPath)

if (message.content[0]?.type === 'image') {
const filesPath = await joinPath([threadDirPath, 'files'])
Expand Down Expand Up @@ -218,11 +217,11 @@ export default class JSONConversationalExtension extends ConversationalExtension

const threadDirs: string[] = []
for (let i = 0; i < fileInsideThread.length; i++) {
if (fileInsideThread[i].includes('.DS_Store')) continue
const path = await joinPath([
JSONConversationalExtension._threadFolder,
fileInsideThread[i],
])
if (!(await fs.fileStat(path))?.isDirectory) continue

const isHavingThreadInfo = (await fs.readdirSync(path)).includes(
JSONConversationalExtension._threadInfoFileName
Expand Down

0 comments on commit 84e1b09

Please sign in to comment.