* [task#151915] add intelligent session mounting knowledge base.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user