mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
fix: chaite
This commit is contained in:
parent
fbcf4e6c08
commit
a16538f322
12 changed files with 60 additions and 50 deletions
|
|
@ -25,7 +25,7 @@ export class LowDBStorage {
|
|||
|
||||
this.filePath = path.join(directory, filename)
|
||||
this.adapter = new JSONFile(this.filePath)
|
||||
this.db = new Low(this.adapter)
|
||||
this.db = new Low(this.adapter, { collections: {} })
|
||||
this.initialized = false
|
||||
}
|
||||
|
||||
|
|
@ -348,11 +348,18 @@ export class LowDBCollection {
|
|||
}
|
||||
}
|
||||
|
||||
const dataDir = path.resolve('./plugins/chatgpt-plugin', ChatGPTConfig.dataDir)
|
||||
if (!fs.existsSync(dataDir)) {
|
||||
fs.mkdirSync(dataDir, { recursive: true })
|
||||
}
|
||||
const storageLocation = path.resolve(dataDir, 'storage.json')
|
||||
if (!fs.existsSync(storageLocation)) {
|
||||
fs.writeFileSync(storageLocation, JSON.stringify({ collections: {} }))
|
||||
}
|
||||
|
||||
const ChatGPTStorage = new LowDBStorage({
|
||||
filename: 'storage.json',
|
||||
directory: ChatGPTConfig.dataDir
|
||||
directory: dataDir
|
||||
})
|
||||
|
||||
ChatGPTStorage.init()
|
||||
|
||||
export default ChatGPTStorage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue