[Task processing] Fix preferred providers#47177
Conversation
…, fix task type values according to preferred provider Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
| $server = $context->getServerContainer(); | ||
| $config = $server->getConfig(); | ||
| if ($config->getAppValue('testing', 'enable_alt_user_backend', 'no') === 'yes') { | ||
| if ($config->getAppValue(self::APP_ID, 'enable_alt_user_backend', 'no') === 'yes') { |
Check notice
Code scanning / Psalm
DeprecatedMethod
| } | ||
|
|
||
| return [ | ||
| 'output' => 'This is a fake result: ' . "\n\n- Prompt: " . $prompt . "\n- Model: " . $model . "\n- Maximum number of words: " . $maxTokens, |
Check notice
Code scanning / Psalm
PossiblyNullOperand
164dcf6 to
eb48853
Compare
|
Do we have documentation on what "Preferred Provider" is? What will be its purpose after this PR? Application Application It was removed or disabled. Shouldn't application I just thought that "Preferred Provider" is a priority, that you can always choose the provider that has the highest priority and will always be chosen if it is available - but apparently I am confused. |
|
@bigcat88 So IMO it works fine in both things that were fixed:
|
|
|
||
| $coreLanguages = $this->getCoreLanguagesByCode(); | ||
|
|
||
| $toLanguage = $coreLanguages[$input['target_language']] ?? $input['target_language']; |
Check notice
Code scanning / Psalm
PossiblyInvalidArrayOffset
|
|
||
| $toLanguage = $coreLanguages[$input['target_language']] ?? $input['target_language']; | ||
| if ($input['origin_language'] !== 'detect_language') { | ||
| $fromLanguage = $coreLanguages[$input['origin_language']] ?? $input['origin_language']; |
Check notice
Code scanning / Psalm
PossiblyInvalidArrayOffset
| $prompt = 'Fake Translation to ' . $toLanguage . ': ' . $inputText; | ||
| } | ||
|
|
||
| $fakeResult = $prompt . "\n\nModel: " . $model . "\nMax tokens: " . $maxTokens; |
Check notice
Code scanning / Psalm
PossiblyNullOperand
93689e2 to
d3fe116
Compare
…ribe and translate providers in the testing app Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
d3fe116 to
475d008
Compare
The first available provider is selected when running a sync task and when populating the available task type values (optional shapes, enum values etc...).
IManager:getAvailableTaskTypes(): Use the preferred provider to extend task type values@marcelklehr Should something be fixed for async workers (when exApps are getting a task via the API)?