This commit is contained in:
gotoeasy 2024-04-14 17:06:24 +08:00
parent 7d9797ffa7
commit eeb26e0b8b
5 changed files with 26 additions and 0 deletions

View File

@ -60,6 +60,7 @@ var tokenSalt string
var aryWhite []string
var aryBlack []string
var ipAddCity bool
var enableChatAi bool
func init() {
UpdateConfigByEnv()
@ -104,6 +105,12 @@ func UpdateConfigByEnv() {
nearSearchSize = getNearSearchSizeConf(cmn.GetEnvInt("GLC_NEAR_SEARCH_SIZE", 200)) // 定位相邻检索的查询件数默认200有效范围50~1000
mulitLineSearch = cmn.GetEnvBool("GLC_SEARCH_MULIT_LINE", false) // 是否检索日志的全部行日志可能有换行默认false仅第一行
testMode = cmn.GetEnvBool("GLC_TEST_MODE", false) // 是否测试模式默认false
enableChatAi = cmn.GetEnvBool("GLC_ENABLE_CHATAI", true) // 是否开启GLC智能助手默认true
}
// 取配置: 是否开启GLC智能助手
func IsEnableChatAi() bool {
return enableChatAi
}
// 取配置: 定位相邻检索的查询件数可通过环境变量“GLC_NEAR_SEARCH_SIZE”设定默认200件

View File

@ -54,6 +54,7 @@ func Run() {
gweb.RegisterController(method.POST, contextPath+conf.SysUserTransferChgPsw, controller.UserTransferChangePswController) // [用户]转发修改自己密码
gweb.RegisterController(method.POST, contextPath+conf.SysUserTransferSave, controller.UserTransferSaveController) // [用户]转发保存
gweb.RegisterController(method.POST, contextPath+conf.SysUserTransferDel, controller.UserTransferDelController) // [用户]转发删除
gweb.RegisterController(method.POST, contextPath+"/v1/sys/chatai", controller.ChatAiController) // 查询是否开启智能助手
// 集群操作接口
gweb.RegisterController(method.POST, contextPath+"/sys/cluster/info", controller.ClusterGetClusterInfoController) // 获取集群信息

View File

@ -16,6 +16,11 @@ import (
var glcLatest string = ""
var glcOrigin string = ""
// 查询是否开启智能助手
func ChatAiController(req *gweb.HttpRequest) *gweb.HttpResult {
return gweb.Result(conf.IsEnableChatAi())
}
// 查询是否测试模式
func TestModeController(req *gweb.HttpRequest) *gweb.HttpResult {
return gweb.Result(conf.IsTestMode())

View File

@ -67,5 +67,17 @@ export const getUserMenu = async () => {
openInner: true,
role: 'admin',
});
const rs = await $post('/v1/sys/chatai', {}, null, { 'Content-Type': 'application/x-www-form-urlencoded' });
if (rs.success && rs.result) {
menus.push({
path: '/glc/chatai',
title: 'GLC智能助手',
icon: 'ai',
component: 'https://ai.youdao.com/saas/qanything/#/bots/C9BA280AA796491F/share',
openInner: true,
});
}
return (menuState.aryMenu = menus);
};

View File

@ -0,0 +1 @@
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M384 419.84a42.666667 42.666667 0 0 0-42.666667 42.666667v85.333333a42.666667 42.666667 0 1 0 85.333334 0v-85.333333a42.666667 42.666667 0 0 0-42.666667-42.666667zM597.333333 462.506667a42.666667 42.666667 0 1 1 85.333334 0v85.333333a42.666667 42.666667 0 1 1-85.333334 0v-85.333333zM433.066667 648.789333a14.208 14.208 0 0 0-14.165334 14.208c0 43.52 35.328 78.890667 78.933334 78.890667h28.373333a78.933333 78.933333 0 0 0 78.890667-78.933333 14.208 14.208 0 0 0-14.208-14.165334H433.066667z"></path><path fill="currentColor" d="M554.752 212.906667a85.333333 85.333333 0 1 0-85.333333 0v32.128H277.333333a128 128 0 0 0-128 128V746.666667a128 128 0 0 0 128 128h63.914667v71.509333a51.2 51.2 0 0 0 74.112 45.824l225.621333-112.810667a42.624 42.624 0 0 1 19.072-4.522666h86.613334a128 128 0 0 0 128-128V373.034667a128 128 0 0 0-128-128h-191.914667V212.906667zM234.666667 372.992a42.666667 42.666667 0 0 1 42.666666-42.666667h469.333334a42.666667 42.666667 0 0 1 42.666666 42.666667V746.666667a42.666667 42.666667 0 0 1-42.666666 42.666666h-86.613334a128 128 0 0 0-57.216 13.525334l-176.256 88.106666V840.533333a51.2 51.2 0 0 0-51.2-51.2H277.333333a42.666667 42.666667 0 0 1-42.666666-42.666666V373.034667zM20.906667 482.56c0-34.602667 28.074667-62.72 62.72-62.72a22.613333 22.613333 0 0 1 22.613333 22.613333v210.773334a22.613333 22.613333 0 0 1-22.613333 22.613333 62.72 62.72 0 0 1-62.72-62.72v-130.56zM940.544 420.693333c34.645333 0 62.72 28.117333 62.72 62.762667v130.517333a62.72 62.72 0 0 1-62.72 62.72 22.613333 22.613333 0 0 1-22.613333-22.570666V443.306667a22.613333 22.613333 0 0 1 22.613333-22.613334z"></path></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB