From 44a2eaf580fd00f7f2234ddebc7cc6fc3aedadd3 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Tue, 11 Nov 2025 17:14:35 +0800 Subject: [PATCH] * [task#151915] add intelligent session mounting knowledge base. --- module/index/ui/index.html.php | 7 +++++++ www/js/zui3/ai.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/module/index/ui/index.html.php b/module/index/ui/index.html.php index 7ec67c299c..12fc836aac 100644 --- a/module/index/ui/index.html.php +++ b/module/index/ui/index.html.php @@ -231,6 +231,13 @@ else { $zaiLang->zaiConfigNotValid = $lang->aiapp->langData->zaiConfigNotValid; } + +if($config->edition != 'pms') +{ + $this->app->loadLang('ai'); + $zaiLang->knowledgeLib = $lang->ai->knowledgeLib; +} + $zaiConfigUrl = createLink('zai', 'setting'); $zaiLang->zaiConfigNotValid = str_replace('{zaiConfigUrl}', $zaiConfigUrl, $lang->aiapp->langData->zaiConfigNotValid); if(isset($zaiLang->unauthorizedError)) $zaiLang->unauthorizedError = str_replace('{zaiConfigUrl}', $zaiConfigUrl, $lang->aiapp->langData->unauthorizedError); diff --git a/www/js/zui3/ai.js b/www/js/zui3/ai.js index a707039a0e..4ab592808f 100644 --- a/www/js/zui3/ai.js +++ b/www/js/zui3/ai.js @@ -202,6 +202,39 @@ function registerZentaoAIPlugin(lang) } }); + if(lang.knowledgeLib) + { + window.knowledgeLibs = []; + plugin.defineContextProvider({ + code : 'knowledgeLibs', + title: lang.knowledgeLib, + icon : 'book', + contexts : function() + { + return new Promise((resolve) => { + zui.Modal.open({url: $.createLink('ai', 'selectknowledgelib', `selectedID=&callback=getKnowledgeLibsByForm`), size: 'sm'}); + window.getKnowledgeLibsByForm = function(libs) + { + if(!libs.length) return resolve(); + + const res = []; + libs.forEach(item => { + res.push({ + title: item.name, + hint: item.name, + code: `zentao-knowledgeLib-${item.id}`, + data: { + memory: {collections: [`zentao:${item.id}`]} + } + }) + }); + resolve(res); + } + }); + }, + }); + } + const objectIcons = { story : 'file-text', demand : 'file-text',