Commit e7c5f54
committed
AI: Introduce
This includes a `WP_AI_SUPPORT` constant and a `wp_supports_ai` filter.
When false,
- `_wp_connectors_get_provider_settings()` will return an empty array (short-circuiting the other functionality).
- `WP_AI_Client_Prompt_Builder()` will short-circuit the construction with a `WP_Error()`. `wp_ai_client_prompt()` will still return an instance, to allow for fluidity to remain intact.
Priority: `WP_AI_SUPPORT` > `add_filter( 'wp_supports_ai', ...) > (default: true)`
Follow-up to [61943], [61749], [61943].
Props justlevine, westonruter, gziolo, flixos90, romainmrhenry, ahortin, chrismcelroyseo, SergeyBiryukov.
See #64706.
git-svn-id: https://develop.svn.wordpress.org/trunk@62067 602fd350-edb4-49c9-b593-d223f7449a82wp_supports_ai() function to control LLM-related features.1 parent 4f26f0e commit e7c5f54
7 files changed
Lines changed: 168 additions & 216 deletions
File tree
- src/wp-includes
- ai-client
- tests/phpunit/tests
- ai-client
- connectors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
12 | 36 | | |
13 | 37 | | |
14 | 38 | | |
| |||
Lines changed: 32 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
| |||
289 | 291 | | |
290 | 292 | | |
291 | 293 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
301 | 308 | | |
302 | 309 | | |
303 | 310 | | |
304 | 311 | | |
305 | 312 | | |
306 | 313 | | |
307 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
308 | 319 | | |
309 | 320 | | |
310 | 321 | | |
311 | | - | |
| 322 | + | |
312 | 323 | | |
313 | 324 | | |
314 | 325 | | |
| |||
423 | 434 | | |
424 | 435 | | |
425 | 436 | | |
426 | | - | |
| 437 | + | |
| 438 | + | |
427 | 439 | | |
428 | 440 | | |
429 | 441 | | |
| |||
434 | 446 | | |
435 | 447 | | |
436 | 448 | | |
437 | | - | |
| 449 | + | |
438 | 450 | | |
439 | 451 | | |
440 | 452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
| |||
0 commit comments