Add cbs non-underline variant

This commit is contained in:
kwaroran
2025-05-19 17:34:25 +09:00
parent efab44e4c1
commit 57568ed7bc

View File

@@ -842,6 +842,7 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
const chara = matcherArg.chara
switch(lowerCased){
case 'previous_char_chat':
case 'previouscharchat':
case 'lastcharmessage':{
const selchar = db.characters[get(selectedCharID)]
const chat = selchar.chats[selchar.chatPage]
@@ -855,6 +856,7 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
return chat.fmIndex === -1 ? selchar.firstMessage : selchar.alternateGreetings[chat.fmIndex]
}
case 'previous_user_chat':
case 'previoususerchat':
case 'lastusermessage':{
if(chatID !== -1){
const selchar = db.characters[get(selectedCharID)]
@@ -897,7 +899,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
return getUserName()
}
case 'personality':
case 'char_persona':{
case 'char_persona':
case 'charpersona': {
const argChara = chara
const achara = (argChara && typeof(argChara) !== 'string') ? argChara : (db.characters[get(selectedCharID)])
if(achara.type === 'group'){
@@ -906,7 +909,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
return risuChatParser(achara.personality, matcherArg)
}
case 'description':
case 'char_desc':{
case 'char_desc':
case 'chardesc':{
const argChara = chara
const achara = (argChara && typeof(argChara) !== 'string') ? argChara : (db.characters[get(selectedCharID)])
if(achara.type === 'group'){
@@ -923,7 +927,9 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
return risuChatParser(achara.scenario, matcherArg)
}
case 'example_dialogue':
case 'example_message':{
case 'example_message':
case 'exampledialogue':
case 'examplemessage':{
const argChara = chara
const achara = (argChara && typeof(argChara) !== 'string') ? argChara : (db.characters[get(selectedCharID)])
if(achara.type === 'group'){
@@ -932,15 +938,19 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
return risuChatParser(achara.exampleMessage, matcherArg)
}
case 'persona':
case 'user_persona':{
case 'user_persona':
case 'userpersona':{
return risuChatParser(getPersonaPrompt(), matcherArg)
}
case 'main_prompt':
case 'system_prompt':{
case 'system_prompt':
case 'systemprompt':
case 'mainprompt':{
return risuChatParser(db.mainPrompt, matcherArg)
}
case 'lorebook':
case 'world_info':{
case 'world_info':
case 'worldinfo':{
const argChara = chara
const achara = (argChara && typeof(argChara) !== 'string') ? argChara : (db.characters[get(selectedCharID)])
const selchar = db.characters[get(selectedCharID)]
@@ -967,7 +977,9 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
}
case 'user_history':
case 'user_messages':{
case 'user_messages':
case 'userhistory':
case 'usermessages':{
const selchar = db.characters[get(selectedCharID)]
const chat = selchar.chats[selchar.chatPage]
return makeArray(chat.message.filter((v) => {
@@ -979,7 +991,9 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
}))
}
case 'char_history':
case 'char_messages':{
case 'char_messages':
case 'charhistory':
case 'charmessages':{
const selchar = db.characters[get(selectedCharID)]
const chat = selchar.chats[selchar.chatPage]
return makeArray(chat.message.filter((v) => {
@@ -996,13 +1010,18 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
}
case 'ujb':
case 'global_note':
case 'system_note':{
case 'system_note':
case 'globalnote':
case 'systemnote':{
return risuChatParser(db.globalNote, matcherArg)
}
case 'chat_index':{
case 'chat_index':
case 'chatindex':{
return chatID.toString()
}
case 'first_msg_index':{
case 'first_msg_index':
case 'firstmessageindex':
case 'firstmsgindex':{
const selchar = db.characters[get(selectedCharID)]
const chat = selchar.chats[selchar.chatPage]
return chat.fmIndex.toString()
@@ -1011,7 +1030,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
case 'none':{
return ''
}
case 'message_time':{
case 'message_time':
case 'messagetime':{
if(matcherArg.tokenizeAccurate){
return `00:00:00`
}
@@ -1029,7 +1049,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
//output time in format like 10:30 AM
return date.toLocaleTimeString()
}
case 'message_date':{
case 'message_date':
case 'messagedate':{
if(matcherArg.tokenizeAccurate){
return `00:00:00`
}
@@ -1046,7 +1067,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
//output date in format like Aug 23, 2021
return date.toLocaleDateString()
}
case 'message_unixtime_array':{
case 'message_unixtime_array':
case 'messageunixtimearray':{
const selchar = db.characters[get(selectedCharID)]
const chat = selchar.chats[selchar.chatPage]
return makeArray(chat.message.map((f) => {
@@ -1073,7 +1095,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
const now = new Date()
return `${now.getUTCFullYear()}-${now.getUTCMonth() + 1}-${now.getUTCDate()}`
}
case 'message_idle_duration':{
case 'message_idle_duration':
case 'messageidleduration':{
if(matcherArg.tokenizeAccurate){
return `00:00:00`
}
@@ -1126,7 +1149,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
//output, like 1:30:00
return hours.toString() + ':' + minutes.toString().padStart(2,'0') + ':' + seconds.toString().padStart(2,'0')
}
case 'idle_duration':{
case 'idle_duration':
case 'idleduration':{
if(matcherArg.tokenizeAccurate){
return `00:00:00`
}
@@ -1232,13 +1256,17 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
return f[0]
}))
}
case 'prefill_supported':{
case 'prefill_supported':
case 'prefillsupported':
case 'prefill':{
return db.aiModel.startsWith('claude') ? '1' : '0'
}
case 'screen_width':{
case 'screen_width':
case 'screenwidth':{
return get(SizeStore).w.toString()
}
case 'screen_height':{
case 'screen_height':
case 'screenheight':{
return get(SizeStore).h.toString()
}
case 'cbr':
@@ -1589,7 +1617,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
}
return dateTimeFormat(arra[1],t)
}
case 'module_enabled':{
case 'module_enabled':
case 'moduleenabled':{
const modules = getModules()
for(const module of modules){
if(module.namespace === arra[1]){
@@ -1598,7 +1627,8 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
}
return '0'
}
case 'module_assetlist':{
case 'module_assetlist':
case 'moduleassetlist':{
const module = getModules()?.find((f) => {
return f.namespace === arra[1]
})
@@ -1700,6 +1730,14 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
case 'unicodedecode':{
return String.fromCharCode(Number(arra[1]))
}
case 'u':
case 'unicodedecodefromhex':{
return String.fromCharCode(parseInt(arra[1], 16))
}
case 'ue':
case 'unicodeencodefromhex':{
return String.fromCharCode(parseInt(arra[1], 16))
}
case 'hash':{
return ((pickHashRand(0, arra[1]) * 10000000) + 1).toFixed(0).padStart(7, '0')
}