[test] lua code dummy, for future
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
"showdown": "^2.1.0",
|
"showdown": "^2.1.0",
|
||||||
"sweetalert2": "^11.7.3",
|
"sweetalert2": "^11.7.3",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
|
"wasmoon": "^1.15.0",
|
||||||
"web-streams-polyfill": "^3.2.1"
|
"web-streams-polyfill": "^3.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
14
pnpm-lock.yaml
generated
14
pnpm-lock.yaml
generated
@@ -91,6 +91,9 @@ dependencies:
|
|||||||
uuid:
|
uuid:
|
||||||
specifier: ^9.0.0
|
specifier: ^9.0.0
|
||||||
version: 9.0.0
|
version: 9.0.0
|
||||||
|
wasmoon:
|
||||||
|
specifier: ^1.15.0
|
||||||
|
version: 1.15.0
|
||||||
web-streams-polyfill:
|
web-streams-polyfill:
|
||||||
specifier: ^3.2.1
|
specifier: ^3.2.1
|
||||||
version: 3.2.1
|
version: 3.2.1
|
||||||
@@ -747,6 +750,10 @@ packages:
|
|||||||
'@types/jsdom': 21.1.1
|
'@types/jsdom': 21.1.1
|
||||||
'@types/trusted-types': 2.0.3
|
'@types/trusted-types': 2.0.3
|
||||||
|
|
||||||
|
/@types/emscripten@1.39.5:
|
||||||
|
resolution: {integrity: sha512-DIOOg+POSrYl+OlNRHQuIEqCd8DCtynG57H862UCce16nXJX7J8eWxNGgOcf8Eyge8zXeSs27mz1UcFu8L/L7g==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@types/jsdom@21.1.1:
|
/@types/jsdom@21.1.1:
|
||||||
resolution: {integrity: sha512-cZFuoVLtzKP3gmq9eNosUL1R50U+USkbLtUQ1bYVgl/lKp0FZM7Cq4aIHAL8oIvQ17uSHi7jXPtfDOdjPwBE7A==}
|
resolution: {integrity: sha512-cZFuoVLtzKP3gmq9eNosUL1R50U+USkbLtUQ1bYVgl/lKp0FZM7Cq4aIHAL8oIvQ17uSHi7jXPtfDOdjPwBE7A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3204,6 +3211,13 @@ packages:
|
|||||||
xml-name-validator: 4.0.0
|
xml-name-validator: 4.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/wasmoon@1.15.0:
|
||||||
|
resolution: {integrity: sha512-QU33AnnMTgbcGOJLzcqM2UBcSksmLvwkvB/Bcgkf5hS+EFoHxB6nyiQiDG+ZnALN8mn/ezeeMSm6eY1zs0cKTg==}
|
||||||
|
hasBin: true
|
||||||
|
dependencies:
|
||||||
|
'@types/emscripten': 1.39.5
|
||||||
|
dev: false
|
||||||
|
|
||||||
/web-streams-polyfill@3.2.1:
|
/web-streams-polyfill@3.2.1:
|
||||||
resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==}
|
resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { getHordeModels } from "src/ts/horde/getModels";
|
import { getHordeModels } from "src/ts/horde/getModels";
|
||||||
import Arcodion from "./Arcodion.svelte";
|
import Arcodion from "./Arcodion.svelte";
|
||||||
import { language } from "src/lang";
|
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 value = ""
|
||||||
export let onChange: (v:string) => void = (v) => {}
|
export let onChange: (v:string) => void = (v) => {}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!currentChar.utilityBot){
|
if(!currentChar.utilityBot){
|
||||||
const mainp = currentChar.systemPrompt || db.mainPrompt
|
const mainp = currentChar.systemPrompt.replaceAll('{{original}}', db.mainPrompt) || db.mainPrompt
|
||||||
|
|
||||||
|
|
||||||
function formatPrompt(data:string){
|
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.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){
|
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