mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-19 01:41:37 +00:00
Fixed phpstan issues
This commit is contained in:
parent
db86b8c330
commit
21bad81262
3 changed files with 3 additions and 5 deletions
|
|
@ -244,7 +244,7 @@ class TypeaheadController extends AbstractController
|
||||||
|
|
||||||
$capability_filter = $request->query->getEnum('capability', Capability::class);
|
$capability_filter = $request->query->getEnum('capability', Capability::class);
|
||||||
|
|
||||||
$models = $cache->get('ai_models_'.$platform->value.'_'.($capability_filter?->value ?? 'all'),
|
$models = $cache->get('ai_models_'.$platform->value.'_'.($capability_filter->value ?? 'all'),
|
||||||
function (ItemInterface $item) use ($platformRegistry, $platform, $capability_filter) {
|
function (ItemInterface $item) use ($platformRegistry, $platform, $capability_filter) {
|
||||||
$item->expiresAfter(3600); //Cache for 1 hour
|
$item->expiresAfter(3600); //Cache for 1 hour
|
||||||
if ($capability_filter === null) {
|
if ($capability_filter === null) {
|
||||||
|
|
@ -253,7 +253,7 @@ class TypeaheadController extends AbstractController
|
||||||
|
|
||||||
//Otherwise filter the models by the capability
|
//Otherwise filter the models by the capability
|
||||||
return array_filter($platformRegistry->getPlatform($platform)->getModelCatalog()->getModels(),
|
return array_filter($platformRegistry->getPlatform($platform)->getModelCatalog()->getModels(),
|
||||||
static fn(array $model) => in_array($capability_filter, $model['capabilities'] ?? [], true)
|
static fn(array $model) => in_array($capability_filter, $model['capabilities'], true)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ final class AiPlatformChoiceType extends AbstractType
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParent(): ?string
|
public function getParent(): string
|
||||||
{
|
{
|
||||||
return EnumType::class;
|
return EnumType::class;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,6 @@ enum AIPlatforms: string implements TranslatableInterface
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
self::LMSTUDIO => LMStudioSettings::class,
|
self::LMSTUDIO => LMStudioSettings::class,
|
||||||
self::OPENROUTER => OpenRouterSettings::class,
|
self::OPENROUTER => OpenRouterSettings::class,
|
||||||
|
|
||||||
default => throw new \InvalidArgumentException(sprintf('No settings class defined for AI platform "%s".', $this->name)),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue