[fix] not working groupchat regex
This commit is contained in:
@@ -226,7 +226,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
|
|
||||||
const chat:OpenAIChat = {
|
const chat:OpenAIChat = {
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content: processScript(currentChar,
|
content: processScript(nowChatroom,
|
||||||
replacePlaceholders(firstMsg, currentChar.name),
|
replacePlaceholders(firstMsg, currentChar.name),
|
||||||
'editprocess')
|
'editprocess')
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
|
|
||||||
const ms = currentChat.message
|
const ms = currentChat.message
|
||||||
for(const msg of ms){
|
for(const msg of ms){
|
||||||
let formedChat = processScript(currentChar,replacePlaceholders(msg.data, currentChar.name), 'editprocess')
|
let formedChat = processScript(nowChatroom,replacePlaceholders(msg.data, currentChar.name), 'editprocess')
|
||||||
let name = ''
|
let name = ''
|
||||||
if(msg.role === 'char'){
|
if(msg.role === 'char'){
|
||||||
if(msg.saying){
|
if(msg.saying){
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
import { CharEmotion, selectedCharID } from "../stores";
|
import { CharEmotion, selectedCharID } from "../stores";
|
||||||
import { DataBase, setDatabase, type character, type customscript } from "../storage/database";
|
import { DataBase, setDatabase, type character, type customscript, type groupChat } from "../storage/database";
|
||||||
import { downloadFile } from "../storage/globalApi";
|
import { downloadFile } from "../storage/globalApi";
|
||||||
import { alertError, alertNormal } from "../alert";
|
import { alertError, alertNormal } from "../alert";
|
||||||
import { language } from "src/lang";
|
import { language } from "src/lang";
|
||||||
@@ -11,7 +11,7 @@ const randomness = /\|\|\|/g
|
|||||||
|
|
||||||
type ScriptMode = 'editinput'|'editoutput'|'editprocess'|'editdisplay'
|
type ScriptMode = 'editinput'|'editoutput'|'editprocess'|'editdisplay'
|
||||||
|
|
||||||
export function processScript(char:character, data:string, mode:ScriptMode){
|
export function processScript(char:character|groupChat, data:string, mode:ScriptMode){
|
||||||
return processScriptFull(char, data, mode).data
|
return processScriptFull(char, data, mode).data
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ export async function importRegex(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function processScriptFull(char:character, data:string, mode:ScriptMode){
|
export function processScriptFull(char:character|groupChat, data:string, mode:ScriptMode){
|
||||||
let db = get(DataBase)
|
let db = get(DataBase)
|
||||||
let emoChanged = false
|
let emoChanged = false
|
||||||
const scripts = (db.globalscript ?? []).concat(char.customscript)
|
const scripts = (db.globalscript ?? []).concat(char.customscript)
|
||||||
|
|||||||
Reference in New Issue
Block a user