| @@ -49,8 +49,9 @@ | ||
| 49 | 49 | 'glossaries_write_with_ai', |
| 50 | 50 | 'faq_write_with_ai', |
| 51 | 51 | 'sample_docs', |
| 52 | 52 | 'ai_suggest_terms', |
| 53 | + 'api_docs_ai', | |
| 53 | 54 | ]; |
| 54 | 55 | |
| 55 | 56 | /** |
| 56 | 57 | * Record one successful AI invocation. |
| @@ -147,13 +148,17 @@ | ||
| 147 | 148 | * - generate-doc / generate-outline / expand-outline (and any future prompt-driven |
| 148 | 149 | * action) → prompt |
| 149 | 150 | * |
| 150 | 151 | * @param array<string,int> $actions |
| 151 | - * @return array{prompt:int,source:int,git:int} | |
| 152 | + * @return array{prompt:int,source:int,git:int,attachment:int,recording:int} | |
| 152 | 153 | */ |
| 153 | 154 | protected static function write_with_ai_modes( $actions ) { |
| 154 | - $modes = [ 'prompt' => 0, 'source' => 0, 'git' => 0 ]; | |
| 155 | + $modes = [ 'prompt' => 0, 'source' => 0, 'git' => 0, 'attachment' => 0, 'recording' => 0 ]; | |
| 155 | 156 | |
| 157 | + // Anything unrecognised lands in `prompt`, which is why `attachment` and | |
| 158 | + // `recording` need explicit arms: without them every file-based | |
| 159 | + // generation was reported as a plain prompt, making the attachment tab | |
| 160 | + // look unused in the insights snapshot. | |
| 156 | 161 | foreach ( (array) $actions as $action => $count ) { |
| 157 | 162 | $count = (int) $count; |
| 158 | 163 | if ( 'from-source' === $action ) { |
| 159 | 164 | $modes['source'] += $count; |
| @@ -158,8 +163,14 @@ | ||
| 158 | 163 | if ( 'from-source' === $action ) { |
| 159 | 164 | $modes['source'] += $count; |
| 160 | 165 | } elseif ( 'from-git' === $action ) { |
| 161 | 166 | $modes['git'] += $count; |
| 167 | + } elseif ( 'from-attachment' === $action ) { | |
| 168 | + $modes['attachment'] += $count; | |
| 169 | + } elseif ( 'from-recording' === $action || 'transcribe-attachment' === $action ) { | |
| 170 | + // `from-recording` is the generation. `transcribe-attachment` is | |
| 171 | + // only kept so counts recorded before that split still land here. | |
| 172 | + $modes['recording'] += $count; | |
| 162 | 173 | } else { |
| 163 | 174 | $modes['prompt'] += $count; |
| 164 | 175 | } |
| 165 | 176 | } |