mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: 对接
This commit is contained in:
parent
89ab58b3d7
commit
eee1285e2f
11 changed files with 221 additions and 26 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { ChaiteStorage } from 'chaite'
|
||||
import { ChaiteStorage, Channel } from 'chaite'
|
||||
|
||||
export class LowDBChannelStorage extends ChaiteStorage {
|
||||
/**
|
||||
|
|
@ -21,7 +21,8 @@ export class LowDBChannelStorage extends ChaiteStorage {
|
|||
* @returns {Promise<import('chaite').Channel>}
|
||||
*/
|
||||
async getItem (key) {
|
||||
return this.collection.findOne({ id: key })
|
||||
const obj = await this.collection.findOne({ id: key })
|
||||
return new Channel({}).fromString(JSON.stringify(obj))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -53,7 +54,8 @@ export class LowDBChannelStorage extends ChaiteStorage {
|
|||
* @returns {Promise<import('chaite').Channel[]>}
|
||||
*/
|
||||
async listItems () {
|
||||
return this.collection.findAll()
|
||||
const list = await this.collection.findAll()
|
||||
return list.map(item => new Channel({}).fromString(JSON.stringify(item)))
|
||||
}
|
||||
|
||||
async clear () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue