[fix] cot

This commit is contained in:
kwaroran
2023-12-18 09:46:46 +09:00
parent d4ca2be8ac
commit fd718efbbf
2 changed files with 12 additions and 1 deletions

View File

@@ -802,6 +802,7 @@ export function risuChatParser(da:string, arg:{
let commentMode = false
let commentLatest:string[] = [""]
let commentV = new Uint8Array(512)
let thinkingMode = false
const matcherObj = {
chatID: chatID,
chara: chara,
@@ -865,6 +866,7 @@ export function risuChatParser(da:string, arg:{
}
case 'Comment':{
if(!commentMode){
thinkingMode = false
commentMode = true
commentLatest = nested.map((f) => f)
if(commentLatest[0].endsWith('\n')){
@@ -888,6 +890,7 @@ export function risuChatParser(da:string, arg:{
break
}
if(!commentMode){
thinkingMode = true
commentMode = true
commentLatest = nested.map((f) => f)
if(commentLatest[0].endsWith('\n')){
@@ -924,6 +927,14 @@ export function risuChatParser(da:string, arg:{
}
pointer++
}
if(commentMode){
nested = commentLatest
v = commentV
if(thinkingMode){
nested[0] += `<div>Thinking...</div>`
}
commentMode = false
}
if(nested.length === 1){
return nested[0]
}

View File

@@ -263,7 +263,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
if(db.chainOfThought){
unformated.postEverything.push({
role: 'system',
content: `<instruction>before responding everything, Think step by step how would you respond inside <Thoughts> xml tag.</instruction>`
content: `<instruction>before respond everything, Think step by step as a ai assistant how would you respond inside <Thoughts> xml tag.</instruction>`
})
}