Fix OpenAI Fixer plugin
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
export function OaifixEmdash(bias:{[key:number]:number}){
|
||||
import { get } from "svelte/store"
|
||||
import { DataBase } from "../storage/database"
|
||||
|
||||
export function OaifixBias(bias:{[key:number]:number}){
|
||||
const db = get(DataBase)
|
||||
const emdashes = [
|
||||
2001, 2345, 8713, 16620, 17223,
|
||||
22416, 29096, 29472, 30697, 35192,
|
||||
@@ -11,8 +15,15 @@ export function OaifixEmdash(bias:{[key:number]:number}){
|
||||
90863, 93830, 96197, 99563
|
||||
]
|
||||
|
||||
for (const emdash of emdashes) {
|
||||
bias[emdash] = -100
|
||||
const biases = []
|
||||
|
||||
if(db.officialplugins.oaiFixEmdash){
|
||||
biases.push(...emdashes)
|
||||
}
|
||||
|
||||
|
||||
for (const key of biases) {
|
||||
bias[key] = -100
|
||||
}
|
||||
|
||||
return bias
|
||||
|
||||
@@ -18,7 +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";
|
||||
import { OaifixBias } from "../plugins/fixer";
|
||||
import { Capacitor } from "@capacitor/core";
|
||||
import { getFreeOpenRouterModel } from "../model/openrouter";
|
||||
import { runTransformers } from "./embedding/transformers";
|
||||
@@ -243,10 +243,9 @@ 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)
|
||||
if(raiModel.startsWith('gpt')){
|
||||
if(db.officialplugins.oaiFix){
|
||||
bias = OaifixBias(bias)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user