From 0e2fdbda167be1342ebe7341bf3a4e5894822465 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 21 Nov 2025 14:46:25 +0800 Subject: [PATCH] + [task#152538] add the initAIPrompts function. --- module/upgrade/model.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 22399c4e2c..2cbe075140 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -11347,6 +11347,32 @@ class upgradeModel extends model return true; } + /** + * 内置AI禅道智能体。 + * Initialize the AI prompts. + * + * @access public + * @return bool + */ + public function initAIPrompts(): void + { + $this->app->loadConfig('ai'); + $promptTableName = $this->config->db->prefix . 'ai_prompt'; + foreach($this->config->ai->initAIPrompts as $aiPrompt) + { + if(!$this->checkAIPromptUnique($aiPrompt)) return; + + $index = $aiPrompt->id; + unset($aiPrompt->id); + $aiPrompt->createdBy = 'system'; + $aiPrompt->createdDate = helper::now(); + $this->dao->insert("`$promptTableName`")->data($aiPrompt)->autoCheck()->exec(); + + $promptID = $this->dao->lastInsertID(); + $this->initAIPromptFields($index, $promptID); + } + } + /** * 检查AI禅道智能体唯一性。 * Check AI zentao agent unique.