Replace cloneDeep to native structuredclone and remove unused import
This commit is contained in:
@@ -13,7 +13,6 @@ import { exampleMessage } from "./exampleMessages";
|
||||
import { sayTTS } from "./tts";
|
||||
import { supaMemory } from "./memory/supaMemory";
|
||||
import { v4 } from "uuid";
|
||||
import { cloneDeep } from "lodash";
|
||||
import { groupOrder } from "./group";
|
||||
import { runTrigger } from "./triggers";
|
||||
import { HypaProcesser } from "./memory/hypamemory";
|
||||
@@ -207,7 +206,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
'personaPrompt':([] as OpenAIChat[])
|
||||
}
|
||||
|
||||
let promptTemplate = cloneDeep(db.promptTemplate)
|
||||
let promptTemplate = structuredClone(db.promptTemplate)
|
||||
const usingPromptTemplate = !!promptTemplate
|
||||
if(promptTemplate){
|
||||
let hasPostEverything = false
|
||||
@@ -394,7 +393,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
for(const card of template){
|
||||
switch(card.type){
|
||||
case 'persona':{
|
||||
let pmt = cloneDeep(unformated.personaPrompt)
|
||||
let pmt = structuredClone(unformated.personaPrompt)
|
||||
if(card.innerFormat && pmt.length > 0){
|
||||
for(let i=0;i<pmt.length;i++){
|
||||
pmt[i].content = risuChatParser(card.innerFormat, {chara: currentChar}).replace('{{slot}}', pmt[i].content)
|
||||
@@ -405,7 +404,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
break
|
||||
}
|
||||
case 'description':{
|
||||
let pmt = cloneDeep(unformated.description)
|
||||
let pmt = structuredClone(unformated.description)
|
||||
if(card.innerFormat && pmt.length > 0){
|
||||
for(let i=0;i<pmt.length;i++){
|
||||
pmt[i].content = risuChatParser(card.innerFormat, {chara: currentChar}).replace('{{slot}}', pmt[i].content)
|
||||
@@ -416,7 +415,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
break
|
||||
}
|
||||
case 'authornote':{
|
||||
let pmt = cloneDeep(unformated.authorNote)
|
||||
let pmt = structuredClone(unformated.authorNote)
|
||||
if(card.innerFormat && pmt.length > 0){
|
||||
for(let i=0;i<pmt.length;i++){
|
||||
pmt[i].content = risuChatParser(card.innerFormat, {chara: currentChar}).replace('{{slot}}', pmt[i].content || card.defaultText || '')
|
||||
@@ -759,7 +758,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
//make into one
|
||||
|
||||
let formated:OpenAIChat[] = []
|
||||
const formatOrder = cloneDeep(db.formatingOrder)
|
||||
const formatOrder = structuredClone(db.formatingOrder)
|
||||
if(formatOrder){
|
||||
formatOrder.push('postEverything')
|
||||
}
|
||||
@@ -803,7 +802,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
for(const card of template){
|
||||
switch(card.type){
|
||||
case 'persona':{
|
||||
let pmt = cloneDeep(unformated.personaPrompt)
|
||||
let pmt = structuredClone(unformated.personaPrompt)
|
||||
if(card.innerFormat && pmt.length > 0){
|
||||
for(let i=0;i<pmt.length;i++){
|
||||
pmt[i].content = risuChatParser(card.innerFormat, {chara: currentChar}).replace('{{slot}}', pmt[i].content)
|
||||
@@ -814,7 +813,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
break
|
||||
}
|
||||
case 'description':{
|
||||
let pmt = cloneDeep(unformated.description)
|
||||
let pmt = structuredClone(unformated.description)
|
||||
if(card.innerFormat && pmt.length > 0){
|
||||
for(let i=0;i<pmt.length;i++){
|
||||
pmt[i].content = risuChatParser(card.innerFormat, {chara: currentChar}).replace('{{slot}}', pmt[i].content)
|
||||
@@ -825,7 +824,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
break
|
||||
}
|
||||
case 'authornote':{
|
||||
let pmt = cloneDeep(unformated.authorNote)
|
||||
let pmt = structuredClone(unformated.authorNote)
|
||||
if(card.innerFormat && pmt.length > 0){
|
||||
for(let i=0;i<pmt.length;i++){
|
||||
pmt[i].content = risuChatParser(card.innerFormat, {chara: currentChar}).replace('{{slot}}', pmt[i].content || card.defaultText || '')
|
||||
@@ -917,7 +916,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
break
|
||||
}
|
||||
case 'memory':{
|
||||
let pmt = cloneDeep(memories)
|
||||
let pmt = structuredClone(memories)
|
||||
if(card.innerFormat && pmt.length > 0){
|
||||
for(let i=0;i<pmt.length;i++){
|
||||
pmt[i].content = risuChatParser(card.innerFormat, {chara: currentChar}).replace('{{slot}}', pmt[i].content)
|
||||
|
||||
Reference in New Issue
Block a user