Commit c87de09
committed
Fix: AI Check model preference not being applied
The model preference was not being applied due to two issues:
1. method_exists() check was failing because WP_AI_Client_Prompt_Builder
uses magic __call() method. Changed to directly call the method with
try-catch error handling instead.
2. normalize_model_preference() was returning a nested array
[['provider', 'model']] instead of the expected ['provider', 'model']
format. Removed the extra array wrapper.
This ensures that when users specify a model preference like
'openai::gpt-5.4-pro', it is correctly passed to the WordPress AI
client instead of falling back to the default model.
Fixes #12121 parent df70fd7 commit c87de09
1 file changed
Lines changed: 14 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | 213 | | |
225 | | - | |
226 | 214 | | |
227 | | - | |
228 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
229 | 228 | | |
230 | | - | |
231 | | - | |
232 | 229 | | |
233 | 230 | | |
234 | 231 | | |
| |||
249 | 246 | | |
250 | 247 | | |
251 | 248 | | |
252 | | - | |
| 249 | + | |
253 | 250 | | |
254 | 251 | | |
255 | 252 | | |
| |||
0 commit comments