mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Refactor getReasoningEffort
This commit is contained in:
@ -1947,34 +1947,29 @@ async function sendAltScaleRequest(messages, logit_bias, signal, type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getReasoningEffort() {
|
function getReasoningEffort() {
|
||||||
// Do not set the field. Let the model decide.
|
// These sources expect the effort as string.
|
||||||
if (oai_settings.reasoning_effort === reasoning_effort_types.auto) {
|
const reasoningEffortSources = [
|
||||||
return undefined;
|
chat_completion_sources.OPENAI,
|
||||||
}
|
chat_completion_sources.CUSTOM,
|
||||||
|
chat_completion_sources.XAI,
|
||||||
// These sources require effort as a string
|
];
|
||||||
if (oai_settings.reasoning_effort === reasoning_effort_types.min) {
|
|
||||||
switch (oai_settings.chat_completion_source) {
|
|
||||||
case chat_completion_sources.OPENAI:
|
|
||||||
case chat_completion_sources.CUSTOM:
|
|
||||||
case chat_completion_sources.XAI:
|
|
||||||
return reasoning_effort_types.low;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Same here, but max effort
|
|
||||||
if (oai_settings.reasoning_effort === reasoning_effort_types.max) {
|
|
||||||
switch (oai_settings.chat_completion_source) {
|
|
||||||
case chat_completion_sources.OPENAI:
|
|
||||||
case chat_completion_sources.CUSTOM:
|
|
||||||
case chat_completion_sources.XAI:
|
|
||||||
return reasoning_effort_types.high;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!reasoningEffortSources.includes(oai_settings.chat_completion_source)) {
|
||||||
return oai_settings.reasoning_effort;
|
return oai_settings.reasoning_effort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (oai_settings.reasoning_effort) {
|
||||||
|
case reasoning_effort_types.auto:
|
||||||
|
return undefined;
|
||||||
|
case reasoning_effort_types.min:
|
||||||
|
return reasoning_effort_types.low;
|
||||||
|
case reasoning_effort_types.max:
|
||||||
|
return reasoning_effort_types.high;
|
||||||
|
default:
|
||||||
|
return oai_settings.reasoning_effort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a chat completion request to backend
|
* Send a chat completion request to backend
|
||||||
* @param {string} type (impersonate, quiet, continue, etc)
|
* @param {string} type (impersonate, quiet, continue, etc)
|
||||||
|
Reference in New Issue
Block a user