mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-05-21 07:06:53 +02:00
Add files via upload
This commit is contained in:
+12
-12
@@ -178,11 +178,11 @@ func (h *ConfigHandler) GetConfig(c *gin.Context) {
|
||||
Enabled: tool.Enabled,
|
||||
IsExternal: false,
|
||||
})
|
||||
// 如果没有简短描述,使用详细描述的前100个字符
|
||||
// 如果没有简短描述,使用详细描述的前10000个字符
|
||||
if tools[len(tools)-1].Description == "" {
|
||||
desc := tool.Description
|
||||
if len(desc) > 100 {
|
||||
desc = desc[:100] + "..."
|
||||
if len(desc) > 10000 {
|
||||
desc = desc[:10000] + "..."
|
||||
}
|
||||
tools[len(tools)-1].Description = desc
|
||||
}
|
||||
@@ -201,8 +201,8 @@ func (h *ConfigHandler) GetConfig(c *gin.Context) {
|
||||
if description == "" {
|
||||
description = mcpTool.Description
|
||||
}
|
||||
if len(description) > 100 {
|
||||
description = description[:100] + "..."
|
||||
if len(description) > 10000 {
|
||||
description = description[:10000] + "..."
|
||||
}
|
||||
tools = append(tools, ToolConfigInfo{
|
||||
Name: mcpTool.Name,
|
||||
@@ -295,11 +295,11 @@ func (h *ConfigHandler) GetTools(c *gin.Context) {
|
||||
Enabled: tool.Enabled,
|
||||
IsExternal: false,
|
||||
}
|
||||
// 如果没有简短描述,使用详细描述的前100个字符
|
||||
// 如果没有简短描述,使用详细描述的前10000个字符
|
||||
if toolInfo.Description == "" {
|
||||
desc := tool.Description
|
||||
if len(desc) > 100 {
|
||||
desc = desc[:100] + "..."
|
||||
if len(desc) > 10000 {
|
||||
desc = desc[:10000] + "..."
|
||||
}
|
||||
toolInfo.Description = desc
|
||||
}
|
||||
@@ -354,8 +354,8 @@ func (h *ConfigHandler) GetTools(c *gin.Context) {
|
||||
if description == "" {
|
||||
description = mcpTool.Description
|
||||
}
|
||||
if len(description) > 100 {
|
||||
description = description[:100] + "..."
|
||||
if len(description) > 10000 {
|
||||
description = description[:10000] + "..."
|
||||
}
|
||||
|
||||
toolInfo := ToolConfigInfo{
|
||||
@@ -1255,8 +1255,8 @@ func (h *ConfigHandler) formatToolDescription(shortDesc, fullDesc string) string
|
||||
if description == "" {
|
||||
description = fullDesc
|
||||
}
|
||||
if len(description) > 100 {
|
||||
description = description[:100] + "..."
|
||||
if len(description) > 10000 {
|
||||
description = description[:10000] + "..."
|
||||
}
|
||||
return description
|
||||
}
|
||||
|
||||
@@ -224,17 +224,17 @@ func (e *Executor) RegisterTools(mcpServer *mcp.Server) {
|
||||
toolName := toolConfig.Name
|
||||
toolConfigCopy := toolConfig
|
||||
|
||||
// 使用简短描述(如果存在),否则使用详细描述的前100个字符
|
||||
// 使用简短描述(如果存在),否则使用详细描述的前10000个字符
|
||||
shortDesc := toolConfigCopy.ShortDescription
|
||||
if shortDesc == "" {
|
||||
// 如果没有简短描述,从详细描述中提取第一行或前100个字符
|
||||
// 如果没有简短描述,从详细描述中提取第一行或前10000个字符
|
||||
desc := toolConfigCopy.Description
|
||||
if len(desc) > 100 {
|
||||
if len(desc) > 10000 {
|
||||
// 尝试找到第一个换行符
|
||||
if idx := strings.Index(desc, "\n"); idx > 0 && idx < 100 {
|
||||
if idx := strings.Index(desc, "\n"); idx > 0 && idx < 10000 {
|
||||
shortDesc = strings.TrimSpace(desc[:idx])
|
||||
} else {
|
||||
shortDesc = desc[:100] + "..."
|
||||
shortDesc = desc[:10000] + "..."
|
||||
}
|
||||
} else {
|
||||
shortDesc = desc
|
||||
|
||||
Reference in New Issue
Block a user