( moonshotBody: Record<string, unknown>, )
| 138 | } |
| 139 | |
| 140 | function createMoonshotThinking( |
| 141 | moonshotBody: Record<string, unknown>, |
| 142 | ): Record<string, unknown> { |
| 143 | const reasoning = |
| 144 | moonshotBody.reasoning && typeof moonshotBody.reasoning === 'object' |
| 145 | ? (moonshotBody.reasoning as { enabled?: boolean }) |
| 146 | : undefined |
| 147 | if (reasoning?.enabled === false) { |
| 148 | return { type: 'disabled' } |
| 149 | } |
| 150 | |
| 151 | const existingThinking = |
| 152 | moonshotBody.thinking && typeof moonshotBody.thinking === 'object' |
| 153 | ? (moonshotBody.thinking as Record<string, unknown>) |
| 154 | : {} |
| 155 | if (existingThinking.type === 'disabled') { |
| 156 | return { type: 'disabled' } |
| 157 | } |
| 158 | |
| 159 | return { |
| 160 | ...existingThinking, |
| 161 | type: 'enabled', |
| 162 | keep: 'all', |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | function normalizeMoonshotMessages( |
| 167 | messages: ChatCompletionRequestBody['messages'], |
no outgoing calls
no test coverage detected