import type { Database } from 'src/ts/storage/database.svelte' export function templateCheck(db:Database){ const temp = db.promptTemplate if(!temp){ return [] } let mainPrompts = 0 let notePrompts = 0 let endRanges:number[] = [] let startRanges:number[] = [] let hasDescription = false let hasLorebook = false let reachEnd = false for(let i=0;i !endRanges.includes(x)).concat(endRanges.filter(x => !startRanges.includes(x))) if(mainPrompts === 0){ warnings.push('No main prompt entry found') } if(mainPrompts > 1){ warnings.push('Multiple main prompt entries found, this can result in unexpected behavior') } if(notePrompts === 0){ warnings.push('No global notes entry found') } if(notePrompts > 1){ warnings.push('Multiple global notes entries found, this can result in unexpected behavior') } if(!hasDescription){ warnings.push('No description entry found') } if(!hasLorebook){ warnings.push('No lorebook entry found') } if(!reachEnd){ warnings.push('No chat entry found with range end set to "Until chat end"') } if(unresolvedRanges.length > 0){ warnings.push(`Chat are not connected: [${unresolvedRanges.join(', ')}]`) } return warnings }