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
a711ec13d7
commit
66905640e4
15 changed files with 242 additions and 29 deletions
|
|
@ -22,7 +22,10 @@ export class LowDBChannelStorage extends ChaiteStorage {
|
|||
*/
|
||||
async getItem (key) {
|
||||
const obj = await this.collection.findOne({ id: key })
|
||||
return new Channel({}).fromString(JSON.stringify(obj))
|
||||
if (!obj) {
|
||||
return null
|
||||
}
|
||||
return new Channel(obj)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +35,7 @@ export class LowDBChannelStorage extends ChaiteStorage {
|
|||
* @returns {Promise<string>}
|
||||
*/
|
||||
async setItem (id, channel) {
|
||||
if (id) {
|
||||
if (id && await this.getItem(id)) {
|
||||
await this.collection.updateById(id, channel)
|
||||
return id
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue