Files
2026-07-22 10:18:59 +08:00

41 lines
1013 B
PHP

<?php
namespace app\controller\api;
use app\model\AiModel;
use app\service\AgentCatalog;
use app\service\SettingsService;
class Settings extends BaseApi
{
public function features()
{
return $this->success(SettingsService::getFeatures());
}
public function publicSettings()
{
$allow = SettingsService::get('allow_register', true);
return $this->success([
'site_name' => SettingsService::get('site_name', 'AI Chat'),
'allow_register' => $allow === true || $allow === 'true',
'features' => SettingsService::getFeatures(),
]);
}
public function models()
{
$list = AiModel::where('enabled', 1)
->field('id,name,provider,model_id,is_default,support_context,support_image')
->order('sort_order,id')
->select();
return $this->success($list);
}
public function agents()
{
return $this->success(AgentCatalog::publicList());
}
}