| 1947 | } | 1947 | } |
| 1948 | | 1948 | |
| 1949 | function getReasoningEffort() { | 1949 | function getReasoningEffort() { |
| 1950 | // Do not set the field. Let the model decide. | 1950 | // These sources expect the effort as string. |
| 1951 | if (oai_settings.reasoning_effort === reasoning_effort_types.auto) { | 1951 | const reasoningEffortSources = [ |
| 1952 | return undefined; | 1952 | chat_completion_sources.OPENAI, |
| 1953 | } | 1953 | chat_completion_sources.CUSTOM, |
| | 1954 | chat_completion_sources.XAI, |
| | 1955 | ]; |
| 1954 | | 1956 | |
| 1955 | // These sources require effort as a string | 1957 | if (!reasoningEffortSources.includes(oai_settings.chat_completion_source)) { |
| 1956 | if (oai_settings.reasoning_effort === reasoning_effort_types.min) { | 1958 | return oai_settings.reasoning_effort; |
| 1957 | switch (oai_settings.chat_completion_source) { | | |
| 1958 | case chat_completion_sources.OPENAI: | | |
| 1959 | case chat_completion_sources.CUSTOM: | | |
| 1960 | case chat_completion_sources.XAI: | | |
| 1961 | return reasoning_effort_types.low; | | |
| 1962 | } | | |
| 1963 | } | 1959 | } |
| 1964 | | 1960 | |
| 1965 | // Same here, but max effort | 1961 | switch (oai_settings.reasoning_effort) { |
| 1966 | if (oai_settings.reasoning_effort === reasoning_effort_types.max) { | 1962 | case reasoning_effort_types.auto: |
| 1967 | switch (oai_settings.chat_completion_source) { | 1963 | return undefined; |
| 1968 | case chat_completion_sources.OPENAI: | 1964 | case reasoning_effort_types.min: |
| 1969 | case chat_completion_sources.CUSTOM: | 1965 | return reasoning_effort_types.low; |
| 1970 | case chat_completion_sources.XAI: | 1966 | case reasoning_effort_types.max: |
| 1971 | return reasoning_effort_types.high; | 1967 | return reasoning_effort_types.high; |
| 1972 | } | 1968 | default: |
| | 1969 | return oai_settings.reasoning_effort; |
| 1973 | } | 1970 | } |
| 1974 | | | |
| 1975 | return oai_settings.reasoning_effort; | | |
| 1976 | } | 1971 | } |
| 1977 | | 1972 | |
| 1978 | /** | 1973 | /** |