43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\controller\api;
|
|
|
|
use app\model\AiModel;
|
|
use app\service\AgentCatalog;
|
|
use app\service\CosyVoiceService;
|
|
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(),
|
|
'voice_persona' => CosyVoiceService::publicPersona(),
|
|
]);
|
|
}
|
|
|
|
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());
|
|
}
|
|
}
|