From 646dc866b401fe5ca77bd28b84f031cbe7f90c99 Mon Sep 17 00:00:00 2001 From: fomichev Date: Thu, 30 Apr 2026 18:08:09 +0300 Subject: [PATCH] =?utf8?q?feat(ERP-292):=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB?= =?utf8?q?=D1=8C=20=E2=80=94=20METHOD=5FLLM,=20llm=5Fverdict=20=D0=BF?= =?utf8?q?=D0=BE=D0=BB=D1=8F=20=D0=B8=20=D0=B2=D0=B0=D0=BB=D0=B8=D0=B4?= =?utf8?q?=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../records/Products1cAutomarkPrediction.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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']); -- 2.39.5