fix: error invoking remote method readdirsync (#2505)
This commit is contained in:
parent
8f230f330b
commit
84e1b09e84
@ -75,7 +75,7 @@ export default class JanAssistantExtension extends AssistantExtension {
|
|||||||
fileName,
|
fileName,
|
||||||
])
|
])
|
||||||
|
|
||||||
if (filePath.includes('.DS_Store')) continue
|
if (!(await fs.fileStat(filePath))?.isDirectory) continue
|
||||||
const jsonFiles: string[] = (await fs.readdirSync(filePath)).filter(
|
const jsonFiles: string[] = (await fs.readdirSync(filePath)).filter(
|
||||||
(file: string) => file === 'assistant.json'
|
(file: string) => file === 'assistant.json'
|
||||||
)
|
)
|
||||||
|
|||||||
@ -111,8 +111,7 @@ export default class JSONConversationalExtension extends ConversationalExtension
|
|||||||
threadDirPath,
|
threadDirPath,
|
||||||
JSONConversationalExtension._threadMessagesFileName,
|
JSONConversationalExtension._threadMessagesFileName,
|
||||||
])
|
])
|
||||||
if (!(await fs.existsSync(threadDirPath)))
|
if (!(await fs.existsSync(threadDirPath))) await fs.mkdir(threadDirPath)
|
||||||
await fs.mkdir(threadDirPath)
|
|
||||||
|
|
||||||
if (message.content[0]?.type === 'image') {
|
if (message.content[0]?.type === 'image') {
|
||||||
const filesPath = await joinPath([threadDirPath, 'files'])
|
const filesPath = await joinPath([threadDirPath, 'files'])
|
||||||
@ -218,11 +217,11 @@ export default class JSONConversationalExtension extends ConversationalExtension
|
|||||||
|
|
||||||
const threadDirs: string[] = []
|
const threadDirs: string[] = []
|
||||||
for (let i = 0; i < fileInsideThread.length; i++) {
|
for (let i = 0; i < fileInsideThread.length; i++) {
|
||||||
if (fileInsideThread[i].includes('.DS_Store')) continue
|
|
||||||
const path = await joinPath([
|
const path = await joinPath([
|
||||||
JSONConversationalExtension._threadFolder,
|
JSONConversationalExtension._threadFolder,
|
||||||
fileInsideThread[i],
|
fileInsideThread[i],
|
||||||
])
|
])
|
||||||
|
if (!(await fs.fileStat(path))?.isDirectory) continue
|
||||||
|
|
||||||
const isHavingThreadInfo = (await fs.readdirSync(path)).includes(
|
const isHavingThreadInfo = (await fs.readdirSync(path)).includes(
|
||||||
JSONConversationalExtension._threadInfoFileName
|
JSONConversationalExtension._threadInfoFileName
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user