diff --git a/src/lib/Setting/Pages/BotSettings.svelte b/src/lib/Setting/Pages/BotSettings.svelte
index 3524c272..d11e8582 100644
--- a/src/lib/Setting/Pages/BotSettings.svelte
+++ b/src/lib/Setting/Pages/BotSettings.svelte
@@ -181,18 +181,76 @@
{:else if $DataBase.aiModel === 'gpt35_16k' || $DataBase.aiModel === 'gpt35_16k_0613'}
-{:else if $DataBase.aiModel === 'gpt4' || $DataBase.aiModel === 'textgen_webui'}
+{:else if $DataBase.aiModel === 'gpt4'}
{:else if $DataBase.aiModel === 'custom'}
{:else}
{/if}
+
{language.maxResponseSize}
{language.temperature}
{($DataBase.temperature / 100).toFixed(2)}
+{#if $DataBase.aiModel === 'textgen_webui'}
+Top K
+
+{($DataBase.ooba.top_k).toFixed(2)}
+Top P
+
+{($DataBase.ooba.top_p).toFixed(2)}
+Typical P
+
+{($DataBase.ooba.typical_p).toFixed(2)}
+Top A
+
+{($DataBase.ooba.top_a).toFixed(2)}
+Tail Free Sampling
+
+{($DataBase.ooba.tfs).toFixed(2)}
+Epsilon Cutoff
+
+{($DataBase.ooba.epsilon_cutoff).toFixed(2)}
+Eta Cutoff
+
+{($DataBase.ooba.eta_cutoff).toFixed(2)}
+Number of Beams
+
+{($DataBase.ooba.num_beams).toFixed(2)}
+Length Penalty
+
+{($DataBase.ooba.length_penalty).toFixed(2)}
+Penalty Alpha
+
+{($DataBase.ooba.penalty_alpha).toFixed(2)}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{#if $DataBase.ooba.formating.custom}
+
+ User Prefix
+
+ Assistant Prefix
+
+ Seperator
+
+
+{/if}
+{:else}
{language.frequencyPenalty}
{($DataBase.frequencyPenalty / 100).toFixed(2)}
@@ -203,7 +261,7 @@
{language.autoSuggest}
{tokens.autoSuggest} {language.tokens}
-
+{/if}
{/if}
diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts
index 652b0be6..93312bbe 100644
--- a/src/ts/process/request.ts
+++ b/src/ts/process/request.ts
@@ -358,16 +358,16 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
'max_new_tokens': db.maxResponse,
'do_sample': true,
'temperature': (db.temperature / 100),
- 'top_p': 0.9,
- 'typical_p': 1,
- 'repetition_penalty': db.PresensePenalty,
- 'encoder_repetition_penalty': 1,
- 'top_k': 100,
- 'min_length': 0,
- 'no_repeat_ngram_size': 0,
- 'num_beams': 1,
- 'penalty_alpha': 0,
- 'length_penalty': 1,
+ 'top_p': db.ooba.top_p,
+ 'typical_p': db.ooba.typical_p,
+ 'repetition_penalty': db.ooba.repetition_penalty,
+ 'encoder_repetition_penalty': db.ooba.encoder_repetition_penalty,
+ 'top_k': db.ooba.top_k,
+ 'min_length': db.ooba.min_length,
+ 'no_repeat_ngram_size': db.ooba.no_repeat_ngram_size,
+ 'num_beams': db.ooba.num_beams,
+ 'penalty_alpha': db.ooba.penalty_alpha,
+ 'length_penalty': db.ooba.length_penalty,
'early_stopping': false,
'truncation_length': maxTokens,
'ban_eos_token': false,
diff --git a/src/ts/process/stringlize.ts b/src/ts/process/stringlize.ts
index fb130d44..546924b6 100644
--- a/src/ts/process/stringlize.ts
+++ b/src/ts/process/stringlize.ts
@@ -24,7 +24,26 @@ export function stringlizeChat(formated:OpenAIChat[], char:string = ''){
}
export function stringlizeChatOba(formated:OpenAIChat[], char:string = ''){
+ const db = get(DataBase)
let resultString:string[] = []
+ if(db.ooba.formating.custom){
+ for(const form of formated){
+ if(form.role === 'system'){
+ resultString.push(form.content)
+ }
+ else if(form.name){
+ resultString.push(db.ooba.formating.userPrefix + form.content + db.ooba.formating.seperator)
+ }
+ else if(form.role === 'assistant' && char){
+ resultString.push(db.ooba.formating.assistantPrefix + form.content + db.ooba.formating.seperator)
+
+ }
+ else{
+ resultString.push(form.content)
+ }
+ }
+ return resultString.join('\n\n') + `\n\n${db.ooba.formating.assistantPrefix}:`
+ }
for(const form of formated){
if(form.role === 'system'){
resultString.push(form.content)
diff --git a/src/ts/storage/database.ts b/src/ts/storage/database.ts
index 41b5a55c..1dab4814 100644
--- a/src/ts/storage/database.ts
+++ b/src/ts/storage/database.ts
@@ -3,7 +3,7 @@ import { checkNullish, selectSingleFile } from '../util';
import { changeLanguage, language } from '../../lang';
import type { RisuPlugin } from '../plugins/plugins';
import { downloadFile, saveAsset as saveImageGlobal } from './globalApi';
-import { cloneDeep } from 'lodash';
+import { clone, cloneDeep } from 'lodash';
import { defaultAutoSuggestPrompt, defaultJailbreak, defaultMainPrompt } from './defaultPrompts';
import { alertNormal } from '../alert';
@@ -265,9 +265,8 @@ export function setDatabase(data:Database){
if(checkNullish(data.imageCompression)){
data.imageCompression = true
}
- if(checkNullish(data.classicMaxWidth)){
- data.classicMaxWidth = false
- }
+ data.classicMaxWidth ??= false
+ data.ooba ??= cloneDeep(defaultOoba)
changeLanguage(data.language)
DataBase.set(data)
}
@@ -410,6 +409,7 @@ export interface botPreset{
bias: [string, number][]
koboldURL?: string
proxyKey:string
+ ooba: OobaSettings
}
export interface Database{
@@ -536,6 +536,7 @@ export interface Database{
usePlainFetch:boolean
hypaMemory:boolean
proxyRequestModel:string
+ ooba:OobaSettings
}
interface hordeConfig{
@@ -584,9 +585,75 @@ export interface Message{
chatId?:string
}
+interface OobaSettings{
+ max_new_tokens: number,
+ do_sample: boolean,
+ temperature: number,
+ top_p: number,
+ typical_p: number,
+ repetition_penalty: number,
+ encoder_repetition_penalty: number,
+ top_k: number,
+ min_length: number,
+ no_repeat_ngram_size: number,
+ num_beams: number,
+ penalty_alpha: number,
+ length_penalty: number,
+ early_stopping: boolean,
+ seed: number,
+ add_bos_token: boolean,
+ truncation_length: number,
+ ban_eos_token: boolean,
+ skip_special_tokens: boolean,
+ top_a: number,
+ tfs: number,
+ epsilon_cutoff: number,
+ eta_cutoff: number,
+ formating:{
+ custom:boolean,
+ userPrefix:string,
+ assistantPrefix:string
+ seperator:string
+ useName:boolean
+ }
+}
+
export const saveImage = saveImageGlobal
+export const defaultOoba:OobaSettings = {
+ max_new_tokens: 180,
+ do_sample: true,
+ temperature: 0.5,
+ top_p: 0.9,
+ typical_p: 1,
+ repetition_penalty: 1.1,
+ encoder_repetition_penalty: 1,
+ top_k: 0,
+ min_length: 0,
+ no_repeat_ngram_size: 0,
+ num_beams: 1,
+ penalty_alpha: 0,
+ length_penalty: 1,
+ early_stopping: false,
+ seed: -1,
+ add_bos_token: true,
+ truncation_length: 2048,
+ ban_eos_token: false,
+ skip_special_tokens: true,
+ top_a: 0,
+ tfs: 1,
+ epsilon_cutoff: 0,
+ eta_cutoff: 0,
+ formating:{
+ custom:false,
+ userPrefix:'user:',
+ assistantPrefix:'assistant:',
+ seperator:'',
+ useName:false,
+ }
+}
+
export const presetTemplate:botPreset = {
name: "New Preset",
apiType: "gpt35",
@@ -608,7 +675,8 @@ export const presetTemplate:botPreset = {
forceReplaceUrl2: '',
promptPreprocess: false,
proxyKey: '',
- bias: []
+ bias: [],
+ ooba: cloneDeep(defaultOoba)
}
const defaultSdData:[string,string][] = [
@@ -681,7 +749,8 @@ export function saveCurrentPreset(){
promptPreprocess: db.promptPreprocess,
bias: db.bias,
koboldURL: db.koboldURL,
- proxyKey: db.proxyKey
+ proxyKey: db.proxyKey,
+ ooba: db.ooba
}
db.botPresets = pres
DataBase.set(db)
@@ -726,6 +795,7 @@ export function changeToPreset(id =0, savecurrent = true){
db.bias = newPres.bias ?? db.bias
db.koboldURL = newPres.koboldURL ?? db.koboldURL
db.proxyKey = newPres.proxyKey ?? db.proxyKey
+ db.ooba = cloneDeep(newPres.ooba ?? db.ooba)
DataBase.set(db)
}