Fix OpenAI Fixer plugin
This commit is contained in:
@@ -96,6 +96,7 @@ export const languageEnglish = {
|
||||
metrica: 'Metric Systemizer is a plugin that converts metrics to imperial units when request, and vice versa on output to show user metric system while using imperial for performace. it is not recommended to use this plugin when using imperial units on chat.',
|
||||
lorePlus: "LoreBook+ is a experimental feature that uses vectordb instead of just string matching for better bot making experience and better matching performace.",
|
||||
topP: "Top P is a probability threshold for nucleus sampling. model considers the results of the tokens with top_p probability mass.",
|
||||
openAIFixer: "OpenAI Fixer is a plugin that fixes some of the problems of OpenAI.",
|
||||
},
|
||||
setup: {
|
||||
chooseProvider: "Choose AI Provider",
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<Check bind:check={$DataBase.officialplugins.metrica} name={language.able}/>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<span class="font-bold flex-grow">OpenAI Fixer <Help key="metrica" /> <span class="text-green-500 italic">(Official Plugin)</span></span>
|
||||
<span class="font-bold flex-grow">OpenAI Fixer <Help key="openAIFixer" /> <span class="text-green-500 italic">(Official Plugin)</span></span>
|
||||
</div>
|
||||
<div class="flex items-center mt-2">
|
||||
<Check bind:check={$DataBase.officialplugins.oaiFix} name={language.able}/>
|
||||
|
||||
@@ -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