Perplexity: unlock reasoning effort

489d46b9a09ed0961c55b59094bf229c5af53d70

Cohee <18619528+Cohee1207@users.noreply.github.com>

3 files changed, +6 -3Ignore whitespace
public/index.html+2 -2
@@ -2078,7 +2078,7 @@
2078 </span>2078 </span>
2079 </div>2079 </div>
2080 </div>2080 </div>
2081 <div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,claude,xai,makersuite,vertexai,aimlapi,openrouter,pollinations">2081 <div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,claude,xai,makersuite,vertexai,aimlapi,openrouter,pollinations,perplexity">
2082 <div class="flex-container oneline-dropdown" title="Constrains effort on reasoning for reasoning models.&#10;Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response." data-i18n="[title]Constrains effort on reasoning for reasoning models.">2082 <div class="flex-container oneline-dropdown" title="Constrains effort on reasoning for reasoning models.&#10;Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response." data-i18n="[title]Constrains effort on reasoning for reasoning models.">
2083 <label for="openai_reasoning_effort">2083 <label for="openai_reasoning_effort">
2084 <span data-i18n="Reasoning Effort">Reasoning Effort</span>2084 <span data-i18n="Reasoning Effort">Reasoning Effort</span>
@@ -2092,7 +2092,7 @@
2092 <option data-i18n="openai_reasoning_effort_high" value="high">High</option>2092 <option data-i18n="openai_reasoning_effort_high" value="high">High</option>
2093 <option data-i18n="openai_reasoning_effort_maximum" value="max">Maximum</option>2093 <option data-i18n="openai_reasoning_effort_maximum" value="max">Maximum</option>
2094 </select>2094 </select>
2095 <div class="toggle-description justifyLeft marginBot5" data-source="openai,custom,xai,aimlapi,openrouter" data-i18n="OpenAI-style options: low, medium, high. Minimum and maximum are aliased to low and high. Auto does not send an effort level.">2095 <div class="toggle-description justifyLeft marginBot5" data-source="openai,custom,xai,aimlapi,openrouter,perplexity" data-i18n="OpenAI-style options: low, medium, high. Minimum and maximum are aliased to low and high. Auto does not send an effort level.">
2096 OpenAI-style options: low, medium, high. Minimum and maximum are aliased to low and high. Auto does not send an effort level.2096 OpenAI-style options: low, medium, high. Minimum and maximum are aliased to low and high. Auto does not send an effort level.
2097 </div>2097 </div>
2098 <div class="toggle-description justifyLeft marginBot5" data-source="claude" data-i18n="Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.">2098 <div class="toggle-description justifyLeft marginBot5" data-source="claude" data-i18n="Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.">
public/scripts/openai.js+1 -0
@@ -2160,6 +2160,7 @@ function getReasoningEffort() {
2160 chat_completion_sources.AIMLAPI,2160 chat_completion_sources.AIMLAPI,
2161 chat_completion_sources.OPENROUTER,2161 chat_completion_sources.OPENROUTER,
2162 chat_completion_sources.POLLINATIONS,2162 chat_completion_sources.POLLINATIONS,
2163 chat_completion_sources.PERPLEXITY,
2163 ];2164 ];
21642165
2165 if (!reasoningEffortSources.includes(oai_settings.chat_completion_source)) {2166 if (!reasoningEffortSources.includes(oai_settings.chat_completion_source)) {
src/endpoints/backends/chat-completions.js+3 -1
@@ -1507,7 +1507,9 @@ router.post('/generate', function (request, response) {
1507 apiUrl = API_PERPLEXITY;1507 apiUrl = API_PERPLEXITY;
1508 apiKey = readSecret(request.user.directories, SECRET_KEYS.PERPLEXITY);1508 apiKey = readSecret(request.user.directories, SECRET_KEYS.PERPLEXITY);
1509 headers = {};1509 headers = {};
1510 bodyParams = {};1510 bodyParams = {
1511 reasoning_effort: request.body.reasoning_effort,
1512 };
1511 request.body.messages = postProcessPrompt(request.body.messages, PROMPT_PROCESSING_TYPE.STRICT, getPromptNames(request));1513 request.body.messages = postProcessPrompt(request.body.messages, PROMPT_PROCESSING_TYPE.STRICT, getPromptNames(request));
1512 } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.GROQ) {1514 } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.GROQ) {
1513 apiUrl = API_GROQ;1515 apiUrl = API_GROQ;