feat(pi): add 'max' thinking level (#1032)

* feat(pi): add 'max' thinking level

Pi's --thinking flag accepts 7 levels: off, minimal, low, medium, high,
xhigh, max. The shared constant and UI only exposed 6 levels (missing max).

Add 'max' to PI_THINKING_LEVELS and PI_THINKING_LEVEL_LABELS. Like xhigh,
max requires explicit opt-in via the model's thinkingLevelMap — models that
support it will include max in their map and the UI will show it
accordingly.

* fix(pi): close max thinking-level branch
This commit is contained in:
KorenKrita
2026-07-16 12:30:55 +08:00
committed by GitHub
parent 53406b2e97
commit 3290bc9ca9
3 changed files with 7 additions and 5 deletions
+2 -1
View File
@@ -1,6 +1,6 @@
// Pi thinking levels (from Pi's rpc-types.ts ThinkingLevel)
// Controls how much reasoning/thinking the model performs.
export const PI_THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh'] as const
export const PI_THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'] as const
export type PiThinkingLevel = typeof PI_THINKING_LEVELS[number]
export const PI_THINKING_LEVEL_LABELS: Record<PiThinkingLevel, string> = {
@@ -10,4 +10,5 @@ export const PI_THINKING_LEVEL_LABELS: Record<PiThinkingLevel, string> = {
medium: 'Medium',
high: 'High',
xhigh: 'XHigh',
max: 'Max'
}
@@ -3,7 +3,7 @@ import type { PiThinkingLevelMap } from '@/types/api'
import { FloatingOverlay } from '@/components/ChatInput/FloatingOverlay'
import { isThinkingLevelSupported } from './piThinkingLevelOptions'
const ALL_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh'] as const
const ALL_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'] as const
/**
* Determine which thinking levels a model supports.
@@ -57,16 +57,17 @@ export function getPiThinkingLevelOptions(
/** Check whether a thinking level is supported by the model's thinkingLevelMap */
export function isThinkingLevelSupported(level: string, map?: PiThinkingLevelMap): boolean {
// xhigh requires explicit opt-in via the map
if (level === 'xhigh') {
// xhigh and max require explicit opt-in via the map
if (level === 'xhigh' || level === 'max') {
if (!map || !(level in map)) return false
return map[level] !== null
}
if (!map || !(level in map)) return true
return map[level] !== null
}
/** A level is excluded if it maps to `null` in the thinkingLevelMap, or xhigh without explicit opt-in */
/** A level is excluded if it maps to `null` in the thinkingLevelMap, or xhigh/max without explicit opt-in */
function isLevelExcluded(level: string, map?: PiThinkingLevelMap): boolean {
return !isThinkingLevelSupported(level, map)
}