Update Kobold

This commit is contained in:
kwaroran
2024-08-05 21:52:34 +09:00
parent 6eb6743fb2
commit 90d1660582
3 changed files with 55 additions and 11 deletions

View File

@@ -1356,19 +1356,24 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
}
case "kobold":{
const prompt = stringlizeChat(formated, currentChar?.name ?? '', arg.continue)
const prompt = applyChatTemplate(formated)
const url = new URL(db.koboldURL)
if(url.pathname.length < 3){
url.pathname = 'api/v1/generate'
}
const body:KoboldGenerationInputSchema = {
"prompt": prompt,
"temperature": (db.temperature / 100),
"top_p": db.top_p,
max_length: maxTokens,
max_context_length: db.maxContext,
n: 1
}
const da = await globalFetch(url.toString(), {
method: "POST",
body: {
"prompt": prompt,
"temperature": (db.temperature / 100),
"top_p": 0.9
},
body: body,
headers: {
"content-type": "application/json",
},
@@ -2280,7 +2285,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
}
if(aiModel.startsWith("horde:::")){
const prompt = stringlizeChat(formated, currentChar?.name ?? '', arg.continue)
const prompt = applyChatTemplate(formated)
const realModel = aiModel.split(":::")[1]
@@ -2446,3 +2451,41 @@ function getOpenUserString(){
console.log(userString)
return userString
}
export interface KoboldSamplerSettingsSchema {
rep_pen?: number;
rep_pen_range?: number;
rep_pen_slope?: number;
top_k?: number;
top_a?: number;
top_p?: number;
tfs?: number;
typical?: number;
temperature?: number;
}
export interface KoboldGenerationInputSchema extends KoboldSamplerSettingsSchema {
prompt: string;
use_memory?: boolean;
use_story?: boolean;
use_authors_note?: boolean;
use_world_info?: boolean;
use_userscripts?: boolean;
soft_prompt?: string;
max_length?: number;
max_context_length?: number;
n: number;
disable_output_formatting?: boolean;
frmttriminc?: boolean;
frmtrmblln?: boolean;
frmtrmspch?: boolean;
singleline?: boolean;
disable_input_formatting?: boolean;
frmtadsnsp?: boolean;
quiet?: boolean;
sampler_order?: number[];
sampler_seed?: number;
sampler_full_determinism?: boolean;
}