Merge branch 'main' into lualore
This commit is contained in:
@@ -15,6 +15,7 @@ import { Mutex } from "../mutex";
|
||||
import { tokenize } from "../tokenizer";
|
||||
import { fetchNative } from "../globalApi.svelte";
|
||||
import { loadLoreBookV3Prompt } from './lorebook.svelte';
|
||||
import { getPersonaPrompt, getUserName } from '../util';
|
||||
|
||||
let luaFactory:LuaFactory
|
||||
let LuaSafeIds = new Set<string>()
|
||||
@@ -461,6 +462,26 @@ export async function runLua(code:string, arg:{
|
||||
return char.firstMessage
|
||||
})
|
||||
|
||||
luaEngine.global.set('getPersonaName', (id:string) => {
|
||||
if(!LuaSafeIds.has(id)){
|
||||
return
|
||||
}
|
||||
|
||||
return getUserName()
|
||||
})
|
||||
|
||||
luaEngine.global.set('getPersonaDescription', (id:string) => {
|
||||
if(!LuaSafeIds.has(id)){
|
||||
return
|
||||
}
|
||||
|
||||
const db = getDatabase()
|
||||
const selectedChar = get(selectedCharID)
|
||||
const char = db.characters[selectedChar]
|
||||
|
||||
return risuChatParser(getPersonaPrompt(), { chara: char })
|
||||
})
|
||||
|
||||
luaEngine.global.set('getBackgroundEmbedding', async (id:string) => {
|
||||
if(!LuaSafeIds.has(id)){
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user