[feat] added nai lorebook
This commit is contained in:
@@ -179,7 +179,7 @@ export async function importLoreBook(mode:'global'|'local'|'sglobal'){
|
|||||||
mode === 'global' ? db.characters[selectedID].globalLore :
|
mode === 'global' ? db.characters[selectedID].globalLore :
|
||||||
mode === 'sglobal' ? db.loreBook[db.loreBookPage].data :
|
mode === 'sglobal' ? db.loreBook[db.loreBookPage].data :
|
||||||
db.characters[selectedID].chats[page].localLore
|
db.characters[selectedID].chats[page].localLore
|
||||||
const lorebook = (await selectSingleFile(['json'])).data
|
const lorebook = (await selectSingleFile(['json', 'lorebook'])).data
|
||||||
if(!lorebook){
|
if(!lorebook){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -207,17 +207,27 @@ export async function importLoreBook(mode:'global'|'local'|'sglobal'){
|
|||||||
entry:string
|
entry:string
|
||||||
secondary_keys:string[]
|
secondary_keys:string[]
|
||||||
selective:boolean
|
selective:boolean
|
||||||
|
forceActivation:boolean
|
||||||
|
keys:string[]
|
||||||
|
displayName:string
|
||||||
|
text:string
|
||||||
|
contextConfig?: {
|
||||||
|
budgetPriority:number
|
||||||
|
prefix:string
|
||||||
|
suffix:string
|
||||||
|
}
|
||||||
}} = importedlore.entries
|
}} = importedlore.entries
|
||||||
for(const key in entries){
|
for(const key in entries){
|
||||||
const currentLore = entries[key]
|
const currentLore = entries[key]
|
||||||
lore.push({
|
lore.push({
|
||||||
key: currentLore.key ? currentLore.key.join(', ') :
|
key: currentLore.key ? currentLore.key.join(', ') :
|
||||||
|
currentLore.keys ? currentLore.keys.join(', ') :
|
||||||
currentLore.keywords ? currentLore.keywords.join(', ') : '',
|
currentLore.keywords ? currentLore.keywords.join(', ') : '',
|
||||||
insertorder: currentLore.order ?? currentLore.priority ?? 0,
|
insertorder: currentLore.order ?? currentLore.priority ?? currentLore?.contextConfig?.budgetPriority ?? 0,
|
||||||
comment: currentLore.comment || currentLore.name || '',
|
comment: currentLore.comment || currentLore.name || currentLore.displayName || '',
|
||||||
content: currentLore.content || currentLore.entry || '',
|
content: currentLore.content || currentLore.entry || currentLore.text || '',
|
||||||
mode: "normal",
|
mode: "normal",
|
||||||
alwaysActive: currentLore.constant ?? false,
|
alwaysActive: currentLore.constant ?? currentLore.forceActivation ?? false,
|
||||||
secondkey: currentLore.secondary_keys ? currentLore.secondary_keys.join(', ') : "",
|
secondkey: currentLore.secondary_keys ? currentLore.secondary_keys.join(', ') : "",
|
||||||
selective: currentLore.selective ?? false
|
selective: currentLore.selective ?? false
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user