[feat] cot
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
function displaya(message:string){
|
||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx, rmVar: true})
|
||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx, rmVar: true, visualize: true})
|
||||
}
|
||||
|
||||
const setStatusMessage = (message:string, timeout:number = 0)=>{
|
||||
|
||||
@@ -89,6 +89,11 @@
|
||||
<Help key="experimental"/>
|
||||
</Check>
|
||||
</div>
|
||||
<div class="flex items-center mt-4">
|
||||
<Check bind:check={$DataBase.chainOfThought} name="Chain of Thoughts">
|
||||
<Help key="experimental"/>
|
||||
</Check>
|
||||
</div>
|
||||
<div class="flex items-center mt-4">
|
||||
<Check check={$DataBase.tpo} name="Alpha DevMode" onChange={() => {
|
||||
// access code is "tendo"
|
||||
|
||||
@@ -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}>`
|
||||
|
||||
@@ -259,6 +259,13 @@ 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>`
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
let description = risuChatParser((db.promptPreprocess ? db.descriptionPrefix: '') + currentChar.desc, {chara: currentChar})
|
||||
|
||||
|
||||
@@ -560,6 +560,7 @@ export interface Database{
|
||||
projectId: string
|
||||
}
|
||||
mistralKey?:string
|
||||
chainOfThought?:boolean
|
||||
}
|
||||
|
||||
export interface customscript{
|
||||
|
||||
Reference in New Issue
Block a user