mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Allow to change supported OpenRouter parameters
This commit is contained in:
@@ -581,7 +581,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block" data-source="openai">
|
||||
<div class="range-block" data-source="openai,openrouter">
|
||||
<div class="range-block-title" data-i18n="Frequency Penalty">
|
||||
Frequency Penalty
|
||||
</div>
|
||||
@@ -596,7 +596,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block" data-source="openai">
|
||||
<div class="range-block" data-source="openai,openrouter">
|
||||
<div class="range-block-title" data-i18n="Presence Penalty">
|
||||
Presence Penalty
|
||||
</div>
|
||||
@@ -611,7 +611,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block" data-source="claude">
|
||||
<div class="range-block" data-source="claude,openrouter">
|
||||
<div class="range-block-title" data-i18n="Top K">
|
||||
Top K
|
||||
</div>
|
||||
@@ -626,7 +626,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block" data-source="openai,claude">
|
||||
<div class="range-block" data-source="openai,claude,openrouter">
|
||||
<div class="range-block-title" data-i18n="Top-p">
|
||||
Top P
|
||||
</div>
|
||||
|
@@ -741,7 +741,6 @@ async function sendOpenAIRequest(type, openai_msgs_tosend, signal) {
|
||||
"frequency_penalty": parseFloat(oai_settings.freq_pen_openai),
|
||||
"presence_penalty": parseFloat(oai_settings.pres_pen_openai),
|
||||
"top_p": parseFloat(oai_settings.top_p_openai),
|
||||
"top_k": parseFloat(oai_settings.top_k_openai),
|
||||
"max_tokens": oai_settings.openai_max_tokens,
|
||||
"stream": stream,
|
||||
"logit_bias": logit_bias,
|
||||
@@ -755,10 +754,12 @@ async function sendOpenAIRequest(type, openai_msgs_tosend, signal) {
|
||||
|
||||
if (isClaude) {
|
||||
generate_data['use_claude'] = true;
|
||||
generate_data['top_k'] = parseFloat(oai_settings.top_k_openai);
|
||||
}
|
||||
|
||||
if (isOpenRouter) {
|
||||
generate_data['use_openrouter'] = true;
|
||||
generate_data['top_k'] = parseFloat(oai_settings.top_k_openai);
|
||||
}
|
||||
|
||||
if (isScale) {
|
||||
@@ -1749,7 +1750,7 @@ async function onModelChange() {
|
||||
} else {
|
||||
const model = model_list.find(m => m.id == oai_settings.openrouter_model);
|
||||
if (model?.context_length) {
|
||||
$('#openai_max_context').attr('max', model.context_length - 1); // waiting for openrouter to fix this
|
||||
$('#openai_max_context').attr('max', model.context_length);
|
||||
} else {
|
||||
$('#openai_max_context').attr('max', max_4k); // placeholder
|
||||
}
|
||||
|
@@ -1031,7 +1031,7 @@ app.post("/editcharacter", urlencodedParser, async function (request, response)
|
||||
* Handle a POST request to edit a character attribute.
|
||||
*
|
||||
* This function reads the character data from a file, updates the specified attribute,
|
||||
* and writes the updated data back to the file.
|
||||
* and writes the updated data back to the file.
|
||||
*
|
||||
* @param {Object} request - The HTTP request object.
|
||||
* @param {Object} response - The HTTP response object.
|
||||
@@ -1069,7 +1069,7 @@ app.post("/editcharacterattribute", jsonParser, async function (request, respons
|
||||
charaWrite(avatarPath, char, (request.body.avatar_url).replace('.png', ''), response, 'Character saved');
|
||||
}).catch((err) => {
|
||||
console.error('An error occured, character edit invalidated.', err);
|
||||
} );
|
||||
} );
|
||||
}
|
||||
catch {
|
||||
console.error('An error occured, character edit invalidated.');
|
||||
@@ -3323,6 +3323,7 @@ app.post("/generate_openai", jsonParser, function (request, response_generate_op
|
||||
"presence_penalty": request.body.presence_penalty,
|
||||
"frequency_penalty": request.body.frequency_penalty,
|
||||
"top_p": request.body.top_p,
|
||||
"top_k": request.body.top_k,
|
||||
"stop": request.body.stop,
|
||||
"logit_bias": request.body.logit_bias
|
||||
},
|
||||
@@ -3456,7 +3457,7 @@ app.post("/tokenize_via_api", jsonParser, async function(request, response) {
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
const text = request.body.text || '';
|
||||
|
||||
|
||||
try {
|
||||
const args = {
|
||||
body: JSON.stringify({"prompt": text}),
|
||||
|
Reference in New Issue
Block a user