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

View File

@@ -263,7 +263,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
if(db.chainOfThought){ if(db.chainOfThought){
unformated.postEverything.push({ unformated.postEverything.push({
role: 'system', 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>`
}) })
} }