[fix] oogabooga again
This commit is contained in:
@@ -112,6 +112,8 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
let bodyTemplate:any
|
let bodyTemplate:any
|
||||||
const proompt = stringlizeChat(formated, currentChar.name)
|
const proompt = stringlizeChat(formated, currentChar.name)
|
||||||
const isNewAPI = DURL.includes('api')
|
const isNewAPI = DURL.includes('api')
|
||||||
|
const stopStrings = [`\nUser:`,`\nuser:`,`\n${db.username}:`]
|
||||||
|
|
||||||
if(isNewAPI){
|
if(isNewAPI){
|
||||||
bodyTemplate = {
|
bodyTemplate = {
|
||||||
'max_new_tokens': 80,
|
'max_new_tokens': 80,
|
||||||
@@ -119,7 +121,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
'temperature': (db.temperature / 100),
|
'temperature': (db.temperature / 100),
|
||||||
'top_p': 0.9,
|
'top_p': 0.9,
|
||||||
'typical_p': 1,
|
'typical_p': 1,
|
||||||
'repetition_penalty': (db.PresensePenalty / 100),
|
'repetition_penalty': db.PresensePenalty < 85 ? 0.85 : (db.PresensePenalty / 100),
|
||||||
'encoder_repetition_penalty': 1,
|
'encoder_repetition_penalty': 1,
|
||||||
'top_k': 100,
|
'top_k': 100,
|
||||||
'min_length': 0,
|
'min_length': 0,
|
||||||
@@ -130,7 +132,7 @@ 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:`,`\nuser:`],
|
'stopping_strings': stopStrings,
|
||||||
'seed': -1,
|
'seed': -1,
|
||||||
add_bos_token: true,
|
add_bos_token: true,
|
||||||
prompt: proompt
|
prompt: proompt
|
||||||
@@ -145,7 +147,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
'temperature': (db.temperature / 100),
|
'temperature': (db.temperature / 100),
|
||||||
'top_p': 0.9,
|
'top_p': 0.9,
|
||||||
'typical_p': 1,
|
'typical_p': 1,
|
||||||
'repetition_penalty': (db.PresensePenalty / 100),
|
'repetition_penalty': db.PresensePenalty < 85 ? 0.85 : (db.PresensePenalty / 100),
|
||||||
'encoder_repetition_penalty': 1,
|
'encoder_repetition_penalty': 1,
|
||||||
'top_k': 100,
|
'top_k': 100,
|
||||||
'min_length': 0,
|
'min_length': 0,
|
||||||
@@ -156,7 +158,7 @@ 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:`,`\nuser:`],
|
'custom_stopping_strings': stopStrings,
|
||||||
'seed': -1,
|
'seed': -1,
|
||||||
add_bos_token: true,
|
add_bos_token: true,
|
||||||
}
|
}
|
||||||
@@ -175,15 +177,17 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
if(res.ok){
|
if(res.ok){
|
||||||
try {
|
try {
|
||||||
if(isNewAPI){
|
let result:string = isNewAPI ? dat.results[0].text : dat.data[0].substring(proompt.length)
|
||||||
return {
|
|
||||||
type: 'success',
|
for(const stopStr of stopStrings){
|
||||||
result: dat.results[0].text.substring(proompt.length)
|
if(result.endsWith(stopStr)){
|
||||||
|
result.substring(0,result.length - stopStr.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
result: dat.data[0].substring(proompt.length)
|
result: result
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user