[feat] oaifixer
This commit is contained in:
@@ -557,29 +557,6 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
||||
currentTokens += await tokenizer.tokenizeChat(chat)
|
||||
}
|
||||
|
||||
if(db.officialplugins.romanizer){
|
||||
const romanizer = await import('../plugins/romanizer')
|
||||
const r = romanizer.romanizer(chats.map((v) => {
|
||||
return v.content
|
||||
}))
|
||||
|
||||
for(let i=0;i<chats.length;i++){
|
||||
const pchat = cloneDeep(chats[i])
|
||||
pchat.content = r.result[i]
|
||||
if(await tokenizer.tokenizeChat(chats[i]) > await tokenizer.tokenizeChat(pchat)){
|
||||
chats[i] = pchat
|
||||
}
|
||||
}
|
||||
|
||||
if(r.mostUsed !== 'roman'){
|
||||
|
||||
unformated.postEverything.push({
|
||||
role: 'system',
|
||||
content: `user and assistant are chatting with romanized ${r.mostUsed}, but always respond with ${r.mostUsed} with ${r.mostUsed} letters.`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if(nowChatroom.supaMemory && db.supaMemoryType !== 'none'){
|
||||
const sp = await supaMemory(chats, currentTokens, maxContextTokens, currentChat, nowChatroom, tokenizer, {
|
||||
asHyper: db.supaMemoryType !== 'subModel' && db.hypaMemory
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Sha256 } from "@aws-crypto/sha256-js";
|
||||
import { v4 } from "uuid";
|
||||
import { cloneDeep } from "lodash";
|
||||
import { supportsInlayImage } from "../image";
|
||||
import { OaifixEmdash } from "../plugins/fixer";
|
||||
|
||||
|
||||
|
||||
@@ -236,6 +237,12 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
||||
}
|
||||
}
|
||||
|
||||
if(db.officialplugins.oaiFix && db.officialplugins.oaiFixEmdash){
|
||||
if(raiModel.startsWith('gpt35') || raiModel.startsWith('gpt4')){
|
||||
bias = OaifixEmdash(bias)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -273,7 +280,6 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
||||
}
|
||||
|
||||
|
||||
console.log(bias)
|
||||
db.cipherChat = false
|
||||
let body = ({
|
||||
model: aiModel === 'openrouter' ? db.openrouterRequestModel :
|
||||
|
||||
@@ -9,6 +9,7 @@ import { risuChatParser as risuChatParserOrg, type simpleCharacterArgument } fro
|
||||
import { autoMarkPlugin } from "../plugins/automark";
|
||||
import { runCharacterJS } from "../plugins/embedscript";
|
||||
import { metricaPlugin } from "../plugins/metrica";
|
||||
import { OaiFixKorean } from "../plugins/fixer";
|
||||
|
||||
const dreg = /{{data}}/g
|
||||
const randomness = /\|\|\|/g
|
||||
@@ -69,6 +70,9 @@ export async function processScriptFull(char:character|groupChat|simpleCharacter
|
||||
if(db.officialplugins.metrica && (mode === 'editinput' || mode === 'editoutput' || mode === 'editprocess')){
|
||||
data = metricaPlugin(data, 'imperial')
|
||||
}
|
||||
if(db.officialplugins.oaiFixLetters && db.officialplugins.oaiFix && (mode === 'editoutput' || mode === 'editdisplay')){
|
||||
data = OaiFixKorean(data)
|
||||
}
|
||||
data = await runCharacterJS({
|
||||
code: char.virtualscript ?? null,
|
||||
mode,
|
||||
|
||||
Reference in New Issue
Block a user