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',