2026-03-22 11:59:36 +05:30
< ? 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\InfoProviderSystem ;
2026-04-26 15:19:52 +02:00
use App\Form\Settings\AiModelsType ;
2026-04-26 01:10:00 +02:00
use App\Form\Settings\AiPlatformChoiceType ;
use App\Services\AI\AIPlatforms ;
2026-03-22 11:59:36 +05:30
use App\Settings\SettingsIcon ;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode ;
use Jbtronics\SettingsBundle\Settings\Settings ;
use Jbtronics\SettingsBundle\Settings\SettingsParameter ;
use Jbtronics\SettingsBundle\Settings\SettingsTrait ;
2026-04-26 15:39:52 +02:00
use Symfony\AI\Platform\Capability ;
2026-04-26 22:11:27 +02:00
use Symfony\Component\Form\Extension\Core\Type\LanguageType ;
2026-03-22 11:59:36 +05:30
use Symfony\Component\Translation\TranslatableMessage as TM ;
2026-04-26 22:11:27 +02:00
use Symfony\Component\Validator\Constraints\Language ;
2026-03-22 11:59:36 +05:30
#[Settings(name: "ai_extractor", label: new TM("settings.ips.ai_extractor"), description: new TM("settings.ips.ai_extractor.description"))]
2026-04-26 15:48:17 +02:00
#[SettingsIcon("fa-plug")]
2026-03-22 11:59:36 +05:30
class AIExtractorSettings
{
2026-04-26 15:19:52 +02:00
private const MODEL_SELECTOR_LABEL = 'ai_extractor' ;
2026-03-22 11:59:36 +05:30
use SettingsTrait ;
2026-04-26 15:48:17 +02:00
#[SettingsParameter(label: new TM("settings.ips.ai_extractor.ai_platform"),
2026-04-26 15:19:52 +02:00
formType : AiPlatformChoiceType :: class , formOptions : [ 'platform_selector_label' => self :: MODEL_SELECTOR_LABEL ],
2026-03-22 11:59:36 +05:30
)]
2026-04-26 01:10:00 +02:00
public ? AIPlatforms $platform = null ;
2026-03-22 11:59:36 +05:30
2026-04-26 15:48:17 +02:00
#[SettingsParameter(label: new TM("settings.ips.ai_extractor.model"), description: new TM("settings.ips.ai_extractor.model.help"),
2026-04-26 15:39:52 +02:00
formType : AiModelsType :: class , formOptions : [ 'platform_selector' => self :: MODEL_SELECTOR_LABEL , 'filter_capability' => Capability :: OUTPUT_STRUCTURED ],
2026-03-22 11:59:36 +05:30
)]
2026-04-26 15:48:17 +02:00
public ? string $model = null ;
2026-03-22 11:59:36 +05:30
2026-04-26 15:48:17 +02:00
#[SettingsParameter(label: new TM("settings.ips.ai_extractor.max_content_length"),
description : new TM ( " settings.ips.ai_extractor.max_content_length.description " ),
2026-03-22 11:59:36 +05:30
)]
public int $maxContentLength = 50000 ;
2026-04-26 22:11:27 +02:00
#[Language]
#[SettingsParameter(label: new TM("settings.ips.ai_extractor.output_language"), description: new TM("settings.ips.ai_extractor.output_language.description"),
formType : LanguageType :: class ,
)]
public ? string $outputLanguage = null ;
2026-03-22 11:59:36 +05:30
}