[feat] added character api to plugin

This commit is contained in:
kwaroran
2023-05-07 22:16:16 +09:00
parent 10863cee51
commit 2d1fb23fc8
2 changed files with 50 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import { DataBase } from "../database";
import { checkNullish, selectSingleFile, sleep } from "../util";
import type { OpenAIChat } from ".";
import { globalFetch } from "../globalApi";
import { selectedCharID } from "../stores";
export const customProviderStore = writable([] as string[])
@@ -229,6 +230,20 @@ export async function loadPlugins() {
}
break
}
case "getChar":{
const db = get(DataBase)
const charid = get(selectedCharID)
const char = db.characters[charid]
postMsgPluginWorker('fetchData',{
id: data.body.id,
data: char
})
}
case "setChar":{
const db = get(DataBase)
const charid = get(selectedCharID)
db.characters[charid] = data.body
}
case "log":{
console.log(data.body)
break