php-agentic/Configs/AIConfig.php
Snider ad83825f93 refactor: rename namespace Core\Agentic to Core\Mod\Agentic
Updates all classes to use the new modular namespace convention.
Adds Service/ layer with Core\Service\Agentic for service definition.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 16:12:58 +00:00

81 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
namespace Core\Mod\Agentic\Configs;
use Core\Config\Config;
use Core\Mod\Agentic\Services\AgenticManager;
use Illuminate\Validation\Rule;
/**
* AI provider configuration.
*
* Manages AI service provider selection and custom instructions
* for content generation in SocialHost.
*/
class AIConfig extends Config
{
/**
* Get the configuration group name.
*/
public function group(): string
{
return 'ai';
}
/**
* Get form field definitions with default values.
*
* @return array<string, mixed>
*/
public function form(): array
{
return [
'provider' => '',
'instructions' => '',
];
}
/**
* Get validation rules for form fields.
*
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'provider' => [
'sometimes',
'nullable',
Rule::in($this->getAvailableProviders()),
],
'instructions' => ['sometimes', 'nullable', 'string', 'max:1000'],
];
}
/**
* Get custom validation messages.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'provider.in' => 'The selected AI provider is not available.',
'instructions.max' => 'Instructions may not be greater than 1000 characters.',
];
}
/**
* Get list of available AI provider keys.
*
* @return array<int, string>
*/
private function getAvailableProviders(): array
{
$agenticManager = app(AgenticManager::class);
return array_keys($agenticManager->availableProviders());
}
}