Update inlay syntax to support 'inlayed' type and adjust parsing logic

This commit is contained in:
Kwaroran
2024-12-13 00:09:13 +09:00
parent 361e65fad6
commit a984b823a6
3 changed files with 19 additions and 14 deletions

View File

@@ -688,10 +688,10 @@ export async function sendChat(chatProcessIndex = -1,arg:{
}
let inlays:string[] = []
if(msg.role === 'char'){
formatedChat = formatedChat.replace(/{{inlay::(.+?)}}/g, '')
formatedChat = formatedChat.replace(/{{(inlay|inlayed)::(.+?)}}/g, '')
}
else{
const inlayMatch = formatedChat.match(/{{inlay::(.+?)}}/g)
const inlayMatch = formatedChat.match(/{{(inlay|inlayed)::(.+?)}}/g)
if(inlayMatch){
for(const inlay of inlayMatch){
inlays.push(inlay)
@@ -703,7 +703,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{
const modelinfo = getModelInfo(DBState.db.aiModel)
if(inlays.length > 0){
for(const inlay of inlays){
const inlayName = inlay.replace('{{inlay::', '').replace('}}', '')
const inlayName = inlay.replace('{{inlayed::', '').replace('{{inlay::', '').replace('}}', '')
const inlayData = await getInlayAsset(inlayName)
if(inlayData?.type === 'image'){
if(modelinfo.flags.includes(LLMFlags.hasImageInput)){