fix recursive scanning not working sometimes
This commit is contained in:
@@ -229,12 +229,16 @@ export async function loadLoreBookV3Prompt(){
|
|||||||
searchDepth:number,
|
searchDepth:number,
|
||||||
regex:boolean
|
regex:boolean
|
||||||
fullWordMatching:boolean
|
fullWordMatching:boolean
|
||||||
|
recursiveAdditionalPrompt:string
|
||||||
}) => {
|
}) => {
|
||||||
const sliced = messages.slice(messages.length - arg.searchDepth,messages.length)
|
const sliced = messages.slice(messages.length - arg.searchDepth,messages.length)
|
||||||
arg.keys = arg.keys.map(key => key.trim()).filter(key => key.length > 0)
|
arg.keys = arg.keys.map(key => key.trim()).filter(key => key.length > 0)
|
||||||
let mText = sliced.map((msg) => {
|
let mText = sliced.map((msg) => {
|
||||||
return msg.data
|
return msg.data
|
||||||
}).join('||')
|
}).join('||')
|
||||||
|
if(arg.recursiveAdditionalPrompt){
|
||||||
|
mText += arg.recursiveAdditionalPrompt
|
||||||
|
}
|
||||||
if(arg.regex){
|
if(arg.regex){
|
||||||
for(const regexString of arg.keys){
|
for(const regexString of arg.keys){
|
||||||
if(!regexString.startsWith('/')){
|
if(!regexString.startsWith('/')){
|
||||||
@@ -289,6 +293,7 @@ export async function loadLoreBookV3Prompt(){
|
|||||||
}[] = []
|
}[] = []
|
||||||
let activatedIndexes:number[] = []
|
let activatedIndexes:number[] = []
|
||||||
let disabledUIPrompts:string[] = []
|
let disabledUIPrompts:string[] = []
|
||||||
|
let matchTimes = 0
|
||||||
while(matching){
|
while(matching){
|
||||||
matching = false
|
matching = false
|
||||||
for(let i=0;i<fullLore.length;i++){
|
for(let i=0;i<fullLore.length;i++){
|
||||||
@@ -450,7 +455,8 @@ export async function loadLoreBookV3Prompt(){
|
|||||||
keys: query.keys,
|
keys: query.keys,
|
||||||
searchDepth: scanDepth,
|
searchDepth: scanDepth,
|
||||||
regex: fullLore[i].useRegex,
|
regex: fullLore[i].useRegex,
|
||||||
fullWordMatching: fullWordMatching
|
fullWordMatching: fullWordMatching,
|
||||||
|
recursiveAdditionalPrompt: recursiveAdditionalPrompt
|
||||||
})
|
})
|
||||||
if(query.negative){
|
if(query.negative){
|
||||||
if(result){
|
if(result){
|
||||||
|
|||||||
Reference in New Issue
Block a user