[test] lua code dummy, for future
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { getHordeModels } from "src/ts/horde/getModels";
|
||||
import Arcodion from "./Arcodion.svelte";
|
||||
import { language } from "src/lang";
|
||||
import { isNodeServer, isTauri } from "src/ts/storage/globalApi";
|
||||
import { isNodeServer, isTauri } from "src/ts/storage/globalApi";
|
||||
|
||||
export let value = ""
|
||||
export let onChange: (v:string) => void = (v) => {}
|
||||
|
||||
@@ -159,7 +159,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
}
|
||||
|
||||
if(!currentChar.utilityBot){
|
||||
const mainp = currentChar.systemPrompt || db.mainPrompt
|
||||
const mainp = currentChar.systemPrompt.replaceAll('{{original}}', db.mainPrompt) || db.mainPrompt
|
||||
|
||||
|
||||
function formatPrompt(data:string){
|
||||
@@ -188,7 +188,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
unformated.jailbreak.push(...formatPrompt(replacePlaceholders(db.jailbreak, currentChar.name)))
|
||||
}
|
||||
|
||||
unformated.globalNote.push(...formatPrompt(replacePlaceholders(currentChar.replaceGlobalNote || db.globalNote, currentChar.name)))
|
||||
unformated.globalNote.push(...formatPrompt(replacePlaceholders(currentChar.replaceGlobalNote.replaceAll('{{original}}', db.globalNote) || db.globalNote, currentChar.name)))
|
||||
}
|
||||
|
||||
if(currentChat.note){
|
||||
|
||||
33
src/ts/process/lua.ts
Normal file
33
src/ts/process/lua.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { get } from "svelte/store";
|
||||
import { DataBase, type character } from "../storage/database";
|
||||
import type {LuaEngine} from 'wasmoon'
|
||||
import { selectedCharID } from "../stores";
|
||||
|
||||
let lua: LuaEngine = null
|
||||
|
||||
|
||||
export class CharacterLua{
|
||||
char:character
|
||||
constructor(char:character){
|
||||
this.char = char
|
||||
}
|
||||
async init(){
|
||||
if(!lua){
|
||||
const factory = new (await import("wasmoon")).LuaFactory
|
||||
lua = await factory.createEngine()
|
||||
lua.global.set('getChat', () => {
|
||||
const cha = get(DataBase).characters[get(selectedCharID)]
|
||||
return cha.chats[cha.chatPage].message
|
||||
})
|
||||
lua.global.set('setChat', () => {
|
||||
const cha = get(DataBase).characters[get(selectedCharID)]
|
||||
return cha.chats[cha.chatPage].message
|
||||
})
|
||||
lua.global.set('doSend', (a:string) => {
|
||||
console.log(a)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user