fix: sqlite api

This commit is contained in:
ikechan8370 2025-04-10 12:09:23 +08:00
parent 0c602d6cb3
commit 64c77877ac
6 changed files with 86 additions and 0 deletions

View file

@ -185,7 +185,16 @@ export class SQLiteProcessorsStorage extends ChaiteStorage {
*/
async setItem (id, processor) {
await this.ensureInitialized()
if (!id) {
id = this._generateId()
}
// 加上时间戳
if (!processor.createdAt) {
processor.createdAt = new Date().toISOString()
}
processor.updatedAt = new Date().toISOString()
// 转换为数据库记录
const record = this._processorToRecord(processor)
record.id = id // 确保ID是指定的ID