[feat] cot
This commit is contained in:
@@ -60,7 +60,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function displaya(message:string){
|
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)=>{
|
const setStatusMessage = (message:string, timeout:number = 0)=>{
|
||||||
|
|||||||
@@ -89,6 +89,11 @@
|
|||||||
<Help key="experimental"/>
|
<Help key="experimental"/>
|
||||||
</Check>
|
</Check>
|
||||||
</div>
|
</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">
|
<div class="flex items-center mt-4">
|
||||||
<Check check={$DataBase.tpo} name="Alpha DevMode" onChange={() => {
|
<Check check={$DataBase.tpo} name="Alpha DevMode" onChange={() => {
|
||||||
// access code is "tendo"
|
// access code is "tendo"
|
||||||
|
|||||||
@@ -766,10 +766,12 @@ export function risuChatParser(da:string, arg:{
|
|||||||
var?:{[key:string]:string}
|
var?:{[key:string]:string}
|
||||||
tokenizeAccurate?:boolean
|
tokenizeAccurate?:boolean
|
||||||
consistantChar?:boolean
|
consistantChar?:boolean
|
||||||
|
visualize?:boolean
|
||||||
} = {}):string{
|
} = {}):string{
|
||||||
const chatID = arg.chatID ?? -1
|
const chatID = arg.chatID ?? -1
|
||||||
const db = arg.db ?? get(DataBase)
|
const db = arg.db ?? get(DataBase)
|
||||||
const aChara = arg.chara
|
const aChara = arg.chara
|
||||||
|
const visualize = arg.visualize ?? false
|
||||||
let chara:character|string = null
|
let chara:character|string = null
|
||||||
|
|
||||||
if(aChara){
|
if(aChara){
|
||||||
@@ -880,6 +882,33 @@ export function risuChatParser(da:string, arg:{
|
|||||||
}
|
}
|
||||||
break
|
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:{
|
default:{
|
||||||
const mc = (pureMode) ? null : smMatcher(dat, matcherObj)
|
const mc = (pureMode) ? null : smMatcher(dat, matcherObj)
|
||||||
nested[0] += mc ?? `<${dat}>`
|
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})
|
let description = risuChatParser((db.promptPreprocess ? db.descriptionPrefix: '') + currentChar.desc, {chara: currentChar})
|
||||||
|
|
||||||
|
|||||||
@@ -560,6 +560,7 @@ export interface Database{
|
|||||||
projectId: string
|
projectId: string
|
||||||
}
|
}
|
||||||
mistralKey?:string
|
mistralKey?:string
|
||||||
|
chainOfThought?:boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface customscript{
|
export interface customscript{
|
||||||
|
|||||||
Reference in New Issue
Block a user