Rework catalog and add trash

This commit is contained in:
kwaroran
2024-05-23 08:13:20 +09:00
parent f1b9247f20
commit d126e52788
6 changed files with 156 additions and 58 deletions

View File

@@ -772,6 +772,7 @@ export interface character{
vits?: OnnxModelFiles
realmId?:string
imported?:boolean
trashTime?:number
}
@@ -815,6 +816,7 @@ export interface groupChat{
oneAtTime?:boolean
virtualscript?:string
lorePlus?:boolean
trashTime?:number
}
export interface botPreset{

View File

@@ -977,6 +977,14 @@ async function checkNewFormat() {
if(db.mainPrompt === oldJailbreak){
db.mainPrompt = defaultJailbreak
}
for(let i=0;i<db.characters.length;i++){
const trashTime = db.characters[i].trashTime
const targetTrashTime = trashTime ? trashTime + 1000 * 60 * 60 * 24 * 3 : 0
if(trashTime && targetTrashTime < Date.now()){
db.characters.splice(i,1)
i--
}
}
setDatabase(db)
checkCharOrder()
}
@@ -997,10 +1005,13 @@ export function checkCharOrder() {
let charIdList:string[] = []
for(let i=0;i<db.characters.length;i++){
const charId = db.characters[i].chaId
charIdList.push(charId)
const char = db.characters[i]
const charId = char.chaId
if(!char.trashTime){
charIdList.push(charId)
}
if(!ordered.includes(charId)){
if(charId !== '§temp' && charId !== '§playground'){
if(charId !== '§temp' && charId !== '§playground' && !char.trashTime){
db.characterOrder.push(charId)
}
}