[fix] lorebook formating

This commit is contained in:
kwaroran
2023-05-13 02:59:16 +09:00
parent 9bfbe4c981
commit c7901ca41d
2 changed files with 4 additions and 3 deletions

View File

@@ -22,7 +22,7 @@ jobs:
node-version: 18 node-version: 18
- id: set_var - id: set_var
run: | run: |
echo "VERSION_JSON=$(jq -c . < package.json)" >> $GITHUB_ENV echo "VERSION_JSON=$(jq -c . < version.json)" >> $GITHUB_ENV
- name: install pnpm - name: install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:

View File

@@ -84,7 +84,7 @@ export async function loadLoreBookPrompt(){
return b.order - a.order return b.order - a.order
}) })
const formatedChat = currentChat.slice(currentChat.length - loreDepth,currentChat.length).map((msg) => { const formatedChatMain = currentChat.slice(currentChat.length - loreDepth,currentChat.length).map((msg) => {
return msg.data return msg.data
}).join('||').replace(rmRegex,'').toLocaleLowerCase() }).join('||').replace(rmRegex,'').toLocaleLowerCase()
@@ -92,6 +92,7 @@ export async function loadLoreBookPrompt(){
while(loreListUpdated){ while(loreListUpdated){
loreListUpdated = false loreListUpdated = false
const formatedChat = formatedChatMain + activatiedPrompt.join('').replace(rmRegex,'').toLocaleLowerCase()
for(let i=0;i<formatedLore.length;i++){ for(let i=0;i<formatedLore.length;i++){
const lore = formatedLore[i] const lore = formatedLore[i]
if(lore.activatied){ if(lore.activatied){
@@ -101,7 +102,7 @@ export async function loadLoreBookPrompt(){
if(totalTokens > loreToken){ if(totalTokens > loreToken){
break break
} }
if(lore.keys === 'always'){ if(lore.keys === 'always'){
activatiedPrompt.push(lore.content) activatiedPrompt.push(lore.content)
lore.activatied = true lore.activatied = true