From: fomichev Date: Thu, 30 Apr 2026 15:08:09 +0000 (+0300) Subject: feat(ERP-292): модель — METHOD_LLM, llm_verdict поля и валидация X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=646dc866b401fe5ca77bd28b84f031cbe7f90c99;p=erp24_rep%2Fyii-erp24%2F.git feat(ERP-292): модель — METHOD_LLM, llm_verdict поля и валидация --- diff --git a/erp24/records/Products1cAutomarkPrediction.php b/erp24/records/Products1cAutomarkPrediction.php index 8ed27579..46b46372 100644 --- a/erp24/records/Products1cAutomarkPrediction.php +++ b/erp24/records/Products1cAutomarkPrediction.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace yii_app\records; use yii\db\ActiveQuery; -use yii_app\records\Products1c; /** * Предсказание авторазметки товара из 1С. @@ -23,6 +22,9 @@ use yii_app\records\Products1c; * @property string $method * @property int $status * @property int|null $approved_by + * @property string|null $llm_verdict + * @property string|null $llm_verified_at + * @property string|null $llm_comment * @property string $created_at * @property string|null $updated_at */ @@ -34,6 +36,10 @@ class Products1cAutomarkPrediction extends \yii\db\ActiveRecord public const METHOD_RULE = 'rule'; public const METHOD_SIMILARITY = 'similarity'; + public const METHOD_LLM = 'llm'; + + public const LLM_VERDICT_APPROVED = 'approved'; + public const LLM_VERDICT_REJECTED = 'rejected'; public static function tableName(): string { @@ -45,12 +51,15 @@ class Products1cAutomarkPrediction extends \yii\db\ActiveRecord return [ [['product_id', 'confidence', 'method', 'status'], 'required'], [['product_id', 'category', 'subcategory', 'species', 'sort', 'type', 'color', 'method'], 'string', 'max' => 255], + [['llm_verdict', 'llm_comment'], 'string', 'max' => 500], [['size', 'status', 'approved_by'], 'integer'], [['confidence'], 'number', 'min' => 0, 'max' => 1], - [['method'], 'in', 'range' => [self::METHOD_RULE, self::METHOD_SIMILARITY]], + [['method'], 'in', 'range' => [self::METHOD_RULE, self::METHOD_SIMILARITY, self::METHOD_LLM]], [['status'], 'in', 'range' => [self::STATUS_PENDING, self::STATUS_APPROVED, self::STATUS_REJECTED]], - [['created_at', 'updated_at'], 'safe'], - [['category', 'subcategory', 'species', 'sort', 'type', 'color', 'approved_by', 'updated_at', 'size'], 'default', 'value' => null], + [['llm_verdict'], 'in', 'range' => [self::LLM_VERDICT_APPROVED, self::LLM_VERDICT_REJECTED], 'skipOnEmpty' => true], + [['created_at', 'updated_at', 'llm_verified_at'], 'safe'], + [['category', 'subcategory', 'species', 'sort', 'type', 'color', 'approved_by', 'updated_at', 'size', + 'llm_verdict', 'llm_verified_at', 'llm_comment'], 'default', 'value' => null], ]; } @@ -69,6 +78,11 @@ class Products1cAutomarkPrediction extends \yii\db\ActiveRecord return $this->status === self::STATUS_REJECTED; } + public function isLlmVerified(): bool + { + return $this->llm_verdict !== null; + } + public function getProduct(): ActiveQuery { return $this->hasOne(Products1c::class, ['id' => 'product_id']);