(model: ManagedKimiCodeModelInfo)
| 76 | } |
| 77 | |
| 78 | export function capabilitiesForModel(model: ManagedKimiCodeModelInfo): string[] | undefined { |
| 79 | const caps = new Set<string>(); |
| 80 | // supports_thinking_type is the full three-state declaration and wins over |
| 81 | // the legacy supports_reasoning boolean; absent (older servers) falls back. |
| 82 | switch (model.supportsThinkingType) { |
| 83 | case 'only': |
| 84 | caps.add('thinking'); |
| 85 | caps.add('always_thinking'); |
| 86 | break; |
| 87 | case 'both': |
| 88 | caps.add('thinking'); |
| 89 | break; |
| 90 | case 'no': |
| 91 | break; |
| 92 | case undefined: |
| 93 | if (model.supportsReasoning) caps.add('thinking'); |
| 94 | break; |
| 95 | } |
| 96 | if (model.supportsImageIn) caps.add('image_in'); |
| 97 | if (model.supportsVideoIn) caps.add('video_in'); |
| 98 | if (model.supportsToolUse ?? true) caps.add('tool_use'); |
| 99 | return caps.size > 0 ? [...caps] : undefined; |
| 100 | } |
| 101 | |
| 102 | export class OpenPlatformApiError extends Error { |
| 103 | readonly status: number; |
no test coverage detected