[feat] cot

This commit is contained in:
kwaroran
2023-12-18 07:05:04 +09:00
parent 94aadc53cc
commit 8ac8e2f7ff
5 changed files with 43 additions and 1 deletions

View File

@@ -766,10 +766,12 @@ export function risuChatParser(da:string, arg:{
var?:{[key:string]:string}
tokenizeAccurate?:boolean
consistantChar?:boolean
visualize?:boolean
} = {}):string{
const chatID = arg.chatID ?? -1
const db = arg.db ?? get(DataBase)
const aChara = arg.chara
const visualize = arg.visualize ?? false
let chara:character|string = null
if(aChara){
@@ -880,6 +882,33 @@ export function risuChatParser(da:string, arg:{
}
break
}
case 'Thoughts':{
if(!visualize){
nested[0] += `<${dat}>`
break
}
if(!commentMode){
commentMode = true
commentLatest = nested.map((f) => f)
if(commentLatest[0].endsWith('\n')){
commentLatest[0] = commentLatest[0].substring(0, commentLatest[0].length - 1)
}
commentV = new Uint8Array(v)
}
break
}
case '/Thoughts':{
if(!visualize){
nested[0] += `<${dat}>`
break
}
if(commentMode){
nested = commentLatest
v = commentV
commentMode = false
}
break
}
default:{
const mc = (pureMode) ? null : smMatcher(dat, matcherObj)
nested[0] += mc ?? `<${dat}>`