From b2d006cb43fffd1a7f74134ff11d7e762ee9db08 Mon Sep 17 00:00:00 2001 From: liwenrui Date: Wed, 19 Jul 2023 13:52:48 +0800 Subject: [PATCH] * add changes logging to prompt actions, task #97648. --- module/ai/model.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module/ai/model.php b/module/ai/model.php index e06c9da387..b7cccd2d12 100644 --- a/module/ai/model.php +++ b/module/ai/model.php @@ -456,6 +456,11 @@ class aiModel extends model { $actionType = $prompt->status == 'draft' ? 'unpublished' : 'published'; } + else + { + $changes = common::createChanges($originalPrompt, $prompt); + } + } $prompt->editedDate = helper::now(); @@ -473,7 +478,9 @@ class aiModel extends model ->exec(); if(dao::isError()) return false; - $this->loadModel('action')->create('prompt', $prompt->id, $actionType); + $actionId = $this->loadModel('action')->create('prompt', $prompt->id, $actionType); + if(!empty($changes)) $this->action->logHistory($actionId, $changes); + return true; }