mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-12 06:21:42 +00:00
Added an AI platform selector for settings
This commit is contained in:
parent
c9d2044949
commit
18bf07b19f
4 changed files with 72 additions and 10 deletions
|
|
@ -25,8 +25,10 @@ namespace App\Services\AI;
|
|||
|
||||
use App\Settings\AISettings\LMStudioSettings;
|
||||
use App\Settings\AISettings\OpenRouterSettings;
|
||||
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
enum AIPlatforms: string
|
||||
enum AIPlatforms: string implements TranslatableInterface
|
||||
{
|
||||
case OPENROUTER = 'openrouter';
|
||||
case LMSTUDIO = 'lmstudio';
|
||||
|
|
@ -54,4 +56,11 @@ enum AIPlatforms: string
|
|||
default => throw new \InvalidArgumentException(sprintf('No settings class defined for AI platform "%s".', $this->name)),
|
||||
};
|
||||
}
|
||||
|
||||
public function trans(TranslatorInterface $translator, ?string $locale = null): string
|
||||
{
|
||||
$key = 'settings.ai.' . $this->value;
|
||||
|
||||
return $translator->trans($key, locale: $locale);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue