mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +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, ToolDTO } from 'chaite'
|
||||
|
||||
/**
|
||||
* @extends {ChaiteStorage<import('chaite').ToolDTO>}
|
||||
|
|
@ -24,7 +24,8 @@ export class LowDBToolsStorage extends ChaiteStorage {
|
|||
* @returns {Promise<import('chaite').ToolDTO>}
|
||||
*/
|
||||
async getItem (key) {
|
||||
return this.collection.findOne({ id: key })
|
||||
const obj = await this.collection.findOne({ id: key })
|
||||
return new ToolDTO({}).fromString(JSON.stringify(obj))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -56,7 +57,8 @@ export class LowDBToolsStorage extends ChaiteStorage {
|
|||
* @returns {Promise<import('chaite').ToolDTO[]>}
|
||||
*/
|
||||
async listItems () {
|
||||
return this.collection.findAll()
|
||||
const list = await this.collection.findAll()
|
||||
return list.map(item => new ToolDTO({}).fromString(JSON.stringify(item)))
|
||||
}
|
||||
|
||||
async clear () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue