[feat] better ain formating

This commit is contained in:
kwaroran
2023-06-26 17:54:10 +09:00
parent 85db744019
commit 35afc5f61c
6 changed files with 214 additions and 32 deletions

View File

@@ -433,16 +433,19 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
await sayTTS(currentChar, result)
}
else{
const result2 = processScriptFull(nowChatroom, reformatContent(req.result), 'editoutput')
result = result2.data
emoChanged = result2.emoChanged
db.characters[selectedChar].chats[selectedChat].message.push({
role: 'char',
data: result,
saying: currentChar.chaId
})
await sayTTS(currentChar, result)
setDatabase(db)
const msgs = req.type === 'success' ? [['char',req.result]] as const : req.type === 'multiline' ? req.result : []
for(const msg of msgs){
const result2 = processScriptFull(nowChatroom, reformatContent(msg[1]), 'editoutput')
result = result2.data
emoChanged = result2.emoChanged
db.characters[selectedChar].chats[selectedChat].message.push({
role: msg[0],
data: result,
saying: currentChar.chaId
})
await sayTTS(currentChar, result)
setDatabase(db)
}
}
if(req.special){
@@ -547,7 +550,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
maxTokens: 30,
}, 'submodel')
if(rq.type === 'fail' || rq.type === 'streaming'){
if(rq.type === 'fail' || rq.type === 'streaming' || rq.type === 'multiline'){
alertError(`${rq.result}`)
return true
}