/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
backend/controllers/select/ai/ModelController.php
64 строки
2 KB
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php namespace backend\controllers\select\ai; use common\controllers\base\DataController; use common\models\ModelAI; use common\models\Project; use common\models\Provider; use common\traits\Select2Trait; use Yii; use yii\bootstrap\Html; /** * Работа с моделями * * @author Dmitry E. Semenov <sde.tomsk@gmail.com> * @copyright Self (c) 2024-2025 */ class ModelController extends DataController { use Select2Trait; /** * Список Моделей */ public function actionList($provider_id, $project_id = null) { $this->model = new ModelAI(); $this->query = ModelAI::find() ->prepareProvider($provider_id) ->published(); if ($provider_id == Provider::GPT) { if ($project_id != Project::DEFAULT_PROJECT) { $this->query->prepareProject($project_id); } } $this->filter_from_begin = false; $this->split_filter = false; $this->orderByCondition = [ 'title' => SORT_ASC ]; $this->titleFields = [ 'title', 'model_id' ]; $this->searchFields = [ 'title', 'model_id', 'description' ]; $this->format_callback = function ($id, $title, $model) { return [ $id => $model->id, $title => $model->title, 'html' => $model->title . Html::tag('div', $model->model_id, ['class' => 'text-muted']) ]; }; } }