mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-07-29 04:31:50 +00:00
Merge branch 'master' into mcp
This commit is contained in:
commit
7c0b47d8f8
173 changed files with 27011 additions and 7959 deletions
|
|
@ -35,6 +35,8 @@ class AISettings
|
|||
{
|
||||
use SettingsTrait;
|
||||
|
||||
public const TIMEOUT_LIMIT = 600;
|
||||
|
||||
#[EmbeddedSettings]
|
||||
public ?McpSettings $mcp = null;
|
||||
|
||||
|
|
@ -43,4 +45,7 @@ class AISettings
|
|||
|
||||
#[EmbeddedSettings]
|
||||
public ?LMStudioSettings $lmstudio = null;
|
||||
|
||||
#[EmbeddedSettings]
|
||||
public ?OllamaSettings $ollama = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,16 +23,17 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Settings\AISettings;
|
||||
|
||||
use App\Form\Type\APIKeyType;
|
||||
use App\Services\AI\AIPlatformSettingsInterface;
|
||||
use App\Settings\SettingsIcon;
|
||||
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
|
||||
use Jbtronics\SettingsBundle\Settings\Settings;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsTrait;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Translation\StaticMessage;
|
||||
use Symfony\Component\Translation\TranslatableMessage as TM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[Settings(name: 'ai_lmstudio', label: new TM("settings.ai.lmstudio"))]
|
||||
#[SettingsIcon("fa-robot")]
|
||||
|
|
@ -46,6 +47,14 @@ class LMStudioSettings implements AIPlatformSettingsInterface
|
|||
envVar: "AI_LMSTUDIO_HOSTURL", envVarMode: EnvVarMode::OVERWRITE)]
|
||||
public ?string $hostURL = null;
|
||||
|
||||
#[SettingsParameter(label: new TM("settings.ai.timeout"),
|
||||
description: new TM("settings.ai.timeout.help"),
|
||||
formType: NumberType::class,
|
||||
formOptions: ["scale" => 0, "attr" => ["min" => 1]],
|
||||
)]
|
||||
#[Assert\Range(min: 1, max: AISettings::TIMEOUT_LIMIT)]
|
||||
public int $timeout = 180;
|
||||
|
||||
public function isAIPlatformEnabled(): bool
|
||||
{
|
||||
return $this->hostURL !== null && $this->hostURL !== "";
|
||||
|
|
|
|||
68
src/Settings/AISettings/OllamaSettings.php
Normal file
68
src/Settings/AISettings/OllamaSettings.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2026 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace App\Settings\AISettings;
|
||||
|
||||
use App\Form\Type\APIKeyType;
|
||||
use App\Services\AI\AIPlatformSettingsInterface;
|
||||
use App\Settings\SettingsIcon;
|
||||
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
|
||||
use Jbtronics\SettingsBundle\Settings\Settings;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsTrait;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Translation\StaticMessage;
|
||||
use Symfony\Component\Translation\TranslatableMessage as TM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[Settings(name: 'ai_ollama', label: new TM("settings.ai.ollama"))]
|
||||
#[SettingsIcon("fa-robot")]
|
||||
class OllamaSettings implements AIPlatformSettingsInterface
|
||||
{
|
||||
use SettingsTrait;
|
||||
|
||||
#[SettingsParameter(label: new TM("settings.ai.ollama.endpoint"),
|
||||
formType: UrlType::class,
|
||||
formOptions: ["attr" => ["placeholder" => new StaticMessage("http://localhost:11434")]],
|
||||
envVar: "AI_OLLAMA_ENDPOINT", envVarMode: EnvVarMode::OVERWRITE)]
|
||||
public ?string $endpoint = null;
|
||||
|
||||
#[SettingsParameter(label: new TM("settings.ai.ollama.apiKey"),
|
||||
formType: APIKeyType::class,
|
||||
envVar: "AI_OLLAMA_API_KEY", envVarMode: EnvVarMode::OVERWRITE)]
|
||||
public ?string $apiKey = null;
|
||||
|
||||
#[SettingsParameter(label: new TM("settings.ai.timeout"),
|
||||
description: new TM("settings.ai.timeout.help"),
|
||||
formType: NumberType::class,
|
||||
formOptions: ["scale" => 0, "attr" => ["min" => 1]]
|
||||
)]
|
||||
#[Assert\Range(min: 1, max: AISettings::TIMEOUT_LIMIT)]
|
||||
public int $timeout = 180;
|
||||
|
||||
public function isAIPlatformEnabled(): bool
|
||||
{
|
||||
return $this->endpoint !== null && $this->endpoint !== "";
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,9 @@ use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
|
|||
use Jbtronics\SettingsBundle\Settings\Settings;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsTrait;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Translation\TranslatableMessage as TM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[Settings(name: 'ai_openrouter', label: new TM("settings.ai.openrouter"), description: "settings.ai.openrouter.help")]
|
||||
#[SettingsIcon("fa-robot")]
|
||||
|
|
@ -43,6 +45,14 @@ class OpenRouterSettings implements AIPlatformSettingsInterface
|
|||
formOptions: ["help_html" => true], envVar: "AI_OPENROUTER_KEY", envVarMode: EnvVarMode::OVERWRITE)]
|
||||
public ?string $apiKey = null;
|
||||
|
||||
#[SettingsParameter(label: new TM("settings.ai.timeout"),
|
||||
description: new TM("settings.ai.timeout.help"),
|
||||
formType: NumberType::class,
|
||||
formOptions: ["scale" => 0, "attr" => ["min" => 1]],
|
||||
envVar: "int:AI_OPENROUTER_TIMEOUT", envVarMode: EnvVarMode::OVERWRITE)]
|
||||
#[Assert\Range(min: 1, max: AISettings::TIMEOUT_LIMIT)]
|
||||
public int $timeout = 90;
|
||||
|
||||
public function isAIPlatformEnabled(): bool
|
||||
{
|
||||
return $this->apiKey !== null && $this->apiKey !== "";
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class CanopySettings
|
|||
/**
|
||||
* @var string The domain used internally for the API requests. This is not necessarily the same as the domain shown to the user, which is determined by the keys of the ALLOWED_DOMAINS constant
|
||||
*/
|
||||
#[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: ChoiceType::class, formOptions: ["choices" => self::ALLOWED_DOMAINS, 'translation_domain' => false])]
|
||||
#[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: ChoiceType::class, formOptions: ["choices" => self::ALLOWED_DOMAINS, 'choice_translation_domain' => false])]
|
||||
public string $domain = "DE";
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue