[fix] oogabooga new api support
This commit is contained in:
@@ -109,20 +109,10 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
}
|
}
|
||||||
case "textgen_webui":{
|
case "textgen_webui":{
|
||||||
let DURL = db.textgenWebUIURL
|
let DURL = db.textgenWebUIURL
|
||||||
if((!DURL.endsWith('textgen')) && (!DURL.endsWith('textgen/'))){
|
let bodyTemplate:any
|
||||||
if(DURL.endsWith('/')){
|
|
||||||
DURL += 'run/textgen'
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
DURL += '/run/textgen'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const proompt = stringlizeChat(formated, currentChar.name)
|
const proompt = stringlizeChat(formated, currentChar.name)
|
||||||
|
if(DURL.includes('api')){
|
||||||
const payload = [
|
bodyTemplate = {
|
||||||
proompt,
|
|
||||||
{
|
|
||||||
'max_new_tokens': 80,
|
'max_new_tokens': 80,
|
||||||
'do_sample': true,
|
'do_sample': true,
|
||||||
'temperature': (db.temperature / 100),
|
'temperature': (db.temperature / 100),
|
||||||
@@ -139,14 +129,41 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
'early_stopping': false,
|
'early_stopping': false,
|
||||||
'truncation_length': maxTokens,
|
'truncation_length': maxTokens,
|
||||||
'ban_eos_token': false,
|
'ban_eos_token': false,
|
||||||
'custom_stopping_strings': [`\nUser:`],
|
'custom_stopping_strings': [`\nUser:`,`\nuser:`],
|
||||||
'seed': -1,
|
'seed': -1,
|
||||||
add_bos_token: true,
|
add_bos_token: true,
|
||||||
|
prompt: proompt
|
||||||
}
|
}
|
||||||
];
|
}
|
||||||
|
else{
|
||||||
const bodyTemplate = { "data": [JSON.stringify(payload)] };
|
const payload = [
|
||||||
|
proompt,
|
||||||
|
{
|
||||||
|
'max_new_tokens': 80,
|
||||||
|
'do_sample': true,
|
||||||
|
'temperature': (db.temperature / 100),
|
||||||
|
'top_p': 0.9,
|
||||||
|
'typical_p': 1,
|
||||||
|
'repetition_penalty': (db.PresensePenalty / 100),
|
||||||
|
'encoder_repetition_penalty': 1,
|
||||||
|
'top_k': 100,
|
||||||
|
'min_length': 0,
|
||||||
|
'no_repeat_ngram_size': 0,
|
||||||
|
'num_beams': 1,
|
||||||
|
'penalty_alpha': 0,
|
||||||
|
'length_penalty': 1,
|
||||||
|
'early_stopping': false,
|
||||||
|
'truncation_length': maxTokens,
|
||||||
|
'ban_eos_token': false,
|
||||||
|
'custom_stopping_strings': [`\nUser:`,`\nuser:`],
|
||||||
|
'seed': -1,
|
||||||
|
add_bos_token: true,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
bodyTemplate = { "data": [JSON.stringify(payload)] };
|
||||||
|
|
||||||
|
}
|
||||||
const res = await globalFetch(DURL, {
|
const res = await globalFetch(DURL, {
|
||||||
body: bodyTemplate,
|
body: bodyTemplate,
|
||||||
headers: {}
|
headers: {}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ export function stringlizeChat(formated:OpenAIChat[], char:string = ''){
|
|||||||
resultString.push("'System Note: " + form.content)
|
resultString.push("'System Note: " + form.content)
|
||||||
}
|
}
|
||||||
else if(form.role === 'user'){
|
else if(form.role === 'user'){
|
||||||
resultString.push("User: " + form.content)
|
resultString.push("user: " + form.content)
|
||||||
}
|
}
|
||||||
else if(form.role === 'assistant'){
|
else if(form.role === 'assistant'){
|
||||||
resultString.push("Assistant: " + form.content)
|
resultString.push("assistant: " + form.content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resultString.join('\n\n') + `\n\n${char}:`
|
return resultString.join('\n\n') + `\n\n${char}:`
|
||||||
|
|||||||
Reference in New Issue
Block a user