feat: use sqlite instead of lowdb

This commit is contained in:
ikechan8370 2025-04-09 16:27:21 +08:00
parent 9c41251164
commit fd197abb33
22 changed files with 3519 additions and 39 deletions

View file

@ -1,4 +1,7 @@
import * as crypto from 'node:crypto'
import path from 'path'
import ChatGPTConfig from '../config/config.js'
import fs from 'fs'
export function md5 (str) {
return crypto.createHash('md5').update(str).digest('hex')
}
@ -63,3 +66,8 @@ function formatDate (date, format) {
function padZero (num) {
return num < 10 ? '0' + num : num.toString()
}
export const dataDir = path.resolve('./plugins/chatgpt-plugin', ChatGPTConfig.chaite.dataDir)
if (!fs.existsSync(dataDir)) {
fs.mkdirSync(dataDir, { recursive: true })
}