Added URL delegation feature to AI provider and added option to skip that delegation

This commit is contained in:
Jan Böhmer 2026-05-02 23:42:26 +02:00
parent aac5b8e0be
commit 889aa08b4e
9 changed files with 121 additions and 52 deletions

View file

@ -240,12 +240,16 @@ class InfoProviderController extends AbstractController
$method = $form->get('method')->getData();
$no_cache = $form->get('no_cache')->getData();
$skip_delegation = $form->get('skip_delegation')->getData();
try {
//It's okay if we use the cached results here, as its just for convenience
$searchResult = $this->infoRetriever->searchByKeyword(
keyword: $url,
providers: [$method],
options: [
InfoProviderInterface::OPTION_SKIP_DELEGATION => $skip_delegation,
]
);
if (count($searchResult) === 0) {
@ -257,6 +261,7 @@ class InfoProviderController extends AbstractController
'providerKey' => $searchResult->provider_key,
'providerId' => $searchResult->provider_id,
'no_cache' => $no_cache ? 1 : null,
'skip_delegation' => $skip_delegation ? 1 : null,
]);
}
} catch (ExceptionInterface $e) {

View file

@ -286,8 +286,12 @@ final class PartController extends AbstractController
//Force info providers to not use cache, when retrieving part details for creating a new part, because otherwise we might end up with outdated information
$no_cache = $request->query->getBoolean('no_cache', false);
$skip_delegation = $request->query->getBoolean('skip_delegation', false);
$dto = $infoRetriever->getDetails($providerKey, $providerId, [InfoProviderInterface::OPTION_NO_CACHE => $no_cache]);
$dto = $infoRetriever->getDetails($providerKey, $providerId, [
InfoProviderInterface::OPTION_NO_CACHE => $no_cache,
InfoProviderInterface::OPTION_SKIP_DELEGATION => $skip_delegation,
]);
$new_part = $infoRetriever->dtoToPart($dto);
if ($new_part->getCategory() === null || $new_part->getCategory()->getID() === null) {