* [task#151915] add intelligent session mounting knowledge base.

This commit is contained in:
wangzemei
2025-12-02 16:32:07 +08:00
committed by sunhao
parent 7c32d9a3f4
commit 44a2eaf580
2 changed files with 40 additions and 0 deletions
+7
View File
@@ -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);
+33
View File
@@ -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',