Commit d999834
authored
fix(provider): let vision() and embed() use the default configuration (#859)
Fixes #851: `vision()` and `embed()` now resolve the backend-managed
default configuration when the caller pins no provider, which `chat()`
has done since ADR-034.
**What was happening.** Both handed the provider key straight to the
registry, so a `null` key threw `No provider specified and no default
provider configured` — on installations that have a perfectly good
default. That is the usage the feature services invite: options without
a provider, because model selection is nr-llm's job rather than the
caller's.
**Two user-visible failures on typo3-demo came from this one gap.** An
image upload in the AI-chat module answered `HTTP 500`, because
`mfd/ai-filemetadata` generates an alt text inside the upload request
and nr-llm-compat routes that through `VisionServiceInterface`. And with
vision resolution failing, `getProviderCapabilities()` reported
`visionSupported: false`, so a *selected* image was never expanded into
the message and the assistant answered that it saw no image. The
instance log carries the exception with `request_url =
/typo3/ajax/ai-chat/file-upload`.
**What the fix does, and what it deliberately does not.** The resolved
configuration drives the call rather than merely unblocking it: its
model reaches the provider (which would otherwise fall back to its own
hardcoded default), and the pipeline context carries the real
configuration instead of a synthesised ad-hoc one, so budget and
telemetry attribute the call to it. The caller keeps precedence — an
explicitly pinned provider skips the resolution entirely, and a model
named in the options is left alone. With no default configuration, or
one that is model-less or access-restricted, the call still refuses: the
resolver's existing guards apply unchanged, so this resolves a default
rather than inventing one.
`embed()` had the identical asymmetry and is fixed in the same commit;
the issue asked for the siblings to be checked rather than only the
reported one. The specialized services (image, speech, DeepL) resolve
differently and are not touched here — their attribution gap is #844.
**Tests.** Three new cases: the default configuration is used and its
model arrives at the provider; a caller-named model survives; and with
no default configuration the call still throws. Watched failing before
being kept — removing the fallback again reproduces the demo's exception
verbatim in two of them.
Gates run locally: cgl, PHPStan level 10, the full unit suite (7288
tests), and the changelog check. CI covers the eight-cell matrix.
_Assisted by claude-code:claude-fable-5 —
[Session](https://claude.ai/code/session_0144iD1P22LotW8rxmxrNGro)_3 files changed
Lines changed: 178 additions & 2 deletions
File tree
- Classes/Service
- Tests/Unit/Service
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| 622 | + | |
622 | 623 | | |
623 | 624 | | |
624 | 625 | | |
| |||
640 | 641 | | |
641 | 642 | | |
642 | 643 | | |
643 | | - | |
| 644 | + | |
644 | 645 | | |
645 | 646 | | |
646 | 647 | | |
| |||
681 | 682 | | |
682 | 683 | | |
683 | 684 | | |
| 685 | + | |
684 | 686 | | |
685 | 687 | | |
686 | 688 | | |
| |||
711 | 713 | | |
712 | 714 | | |
713 | 715 | | |
714 | | - | |
| 716 | + | |
715 | 717 | | |
716 | 718 | | |
717 | 719 | | |
| |||
1356 | 1358 | | |
1357 | 1359 | | |
1358 | 1360 | | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
1359 | 1413 | | |
1360 | 1414 | | |
1361 | 1415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
2066 | 2067 | | |
2067 | 2068 | | |
2068 | 2069 | | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
2069 | 2178 | | |
2070 | 2179 | | |
2071 | 2180 | | |
| |||
2917 | 3026 | | |
2918 | 3027 | | |
2919 | 3028 | | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
2920 | 3037 | | |
2921 | 3038 | | |
2922 | 3039 | | |
| |||
3045 | 3162 | | |
3046 | 3163 | | |
3047 | 3164 | | |
| 3165 | + | |
3048 | 3166 | | |
3049 | 3167 | | |
3050 | 3168 | | |
| |||
0 commit comments