handler

package
v0.0.0-...-3cbcbbf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGroupDocument

func AddGroupDocument(c *gin.Context)

func AddMemberToGroup

func AddMemberToGroup(c *gin.Context)

func AddToBlacklist

func AddToBlacklist(c *gin.Context)

func AddUserToDepartment

func AddUserToDepartment(c *gin.Context)

func AdminDeleteChannel

func AdminDeleteChannel(c *gin.Context)

func AdminDeleteGroup

func AdminDeleteGroup(c *gin.Context)

func AdminGetChannels

func AdminGetChannels(c *gin.Context)

func AdminGetDashboardStats

func AdminGetDashboardStats(c *gin.Context)

AdminGetDashboardStats 获取仪表盘统计数据

func AdminGetDashboardTrend

func AdminGetDashboardTrend(c *gin.Context)

AdminGetDashboardTrend 获取仪表盘趋势数据(用户增长 + 消息活跃度)

func AdminGetGroups

func AdminGetGroups(c *gin.Context)

func AdminGetRecentRegistrations

func AdminGetRecentRegistrations(c *gin.Context)

func AdminGetStatistics

func AdminGetStatistics(c *gin.Context)

func AdminGetUserAIConfigs

func AdminGetUserAIConfigs(c *gin.Context)

AdminGetUserAIConfigs 管理员获取指定用户的AI配置列表

func AdminGetUsers

func AdminGetUsers(c *gin.Context)

func AdminGetVectorCollectionData

func AdminGetVectorCollectionData(c *gin.Context)

func AdminListVectorCollections

func AdminListVectorCollections(c *gin.Context)

func AdminUpdateChannel

func AdminUpdateChannel(c *gin.Context)

func AdminUpdateUserAIConfig

func AdminUpdateUserAIConfig(c *gin.Context)

AdminUpdateUserAIConfig 管理员更新指定用户的AI配置

func AnalyzeNote

func AnalyzeNote(c *gin.Context)

func ApplyJoinGroup

func ApplyJoinGroup(c *gin.Context)

func ApproveJoin

func ApproveJoin(c *gin.Context)

func BatchAssignUserRoles

func BatchAssignUserRoles(c *gin.Context)

BatchAssignUserRoles 批量分配用户角色

func BatchCreateSensitiveWords

func BatchCreateSensitiveWords(c *gin.Context)
func BatchCreateShortLinks(c *gin.Context)

BatchCreateShortLinks 批量创建短链接

func BatchDeleteShortLinks(c *gin.Context)

BatchDeleteShortLinks 批量删除短链接

func BatchGetMessageReadUsers

func BatchGetMessageReadUsers(c *gin.Context)

func BatchOperation

func BatchOperation(c *gin.Context)

func BatchProcessDocuments

func BatchProcessDocuments(c *gin.Context)

BatchProcessDocuments 批量处理文档

func BatchRetryDocuments

func BatchRetryDocuments(c *gin.Context)

BatchRetryDocuments 批量重试失败文档

func BroadcastAIMessage

func BroadcastAIMessage(conversationID uint, content string, assistantName string) error

func BroadcastMessage

func BroadcastMessage(c *gin.Context)

func CancelUpload

func CancelUpload(c *gin.Context)

CancelUpload 取消上传

func CheckSensitiveWords

func CheckSensitiveWords(c *gin.Context)

func CheckTwoFAStatus

func CheckTwoFAStatus(c *gin.Context)

func CheckUpdateHealth

func CheckUpdateHealth(c *gin.Context)

CheckUpdateHealth 检查更新服务健康状态 GET /api/v1/updates/health

func ClearAllNotifications

func ClearAllNotifications(c *gin.Context)

func CommentChannelMessage

func CommentChannelMessage(c *gin.Context)

func CompleteUpload

func CompleteUpload(c *gin.Context)

CompleteUpload 完成上传

func CreateAIProvider

func CreateAIProvider(c *gin.Context)

CreateAIProvider 创建AI提供商

func CreateApp

func CreateApp(c *gin.Context)

func CreateBot

func CreateBot(c *gin.Context)

CreateBot 创建 Bot

func CreateBotConversation

func CreateBotConversation(c *gin.Context)

CreateBotConversation 创建或获取 Bot 会话

func CreateChannel

func CreateChannel(c *gin.Context)

func CreateChannelMessage

func CreateChannelMessage(c *gin.Context)

func CreateConversation

func CreateConversation(c *gin.Context)

CreateConversation 统一会话创建入口 请求体:

{
  "type": "single|bot|group|discussion",
  ...具体类型对应的字段
}

该 handler 仅作为分发,复用原有具体类型的 handler 逻辑。

func CreateDepartment

func CreateDepartment(c *gin.Context)

func CreateDiscussionConversation

func CreateDiscussionConversation(c *gin.Context)

func CreateEvent

func CreateEvent(c *gin.Context)

func CreateFolder

func CreateFolder(c *gin.Context)

func CreateGroupConversation

func CreateGroupConversation(c *gin.Context)

func CreateMiniApp

func CreateMiniApp(c *gin.Context)

func CreateNote

func CreateNote(c *gin.Context)

func CreateRole

func CreateRole(c *gin.Context)

func CreateSensitiveWord

func CreateSensitiveWord(c *gin.Context)

func CreateSession

func CreateSession(c *gin.Context)

CreateSession 创建实时会话

func CreateShortLink(c *gin.Context)

func CreateSingleConversation

func CreateSingleConversation(c *gin.Context)

func CreateSystemMessage

func CreateSystemMessage(c *gin.Context)

func CreateTask

func CreateTask(c *gin.Context)

func CreateUser

func CreateUser(c *gin.Context)

func CreateVersion

func CreateVersion(c *gin.Context)

func DeleteAIProvider

func DeleteAIProvider(c *gin.Context)

DeleteAIProvider 删除AI提供商

func DeleteApp

func DeleteApp(c *gin.Context)

func DeleteConversation

func DeleteConversation(c *gin.Context)

func DeleteDepartment

func DeleteDepartment(c *gin.Context)

DeleteDepartment 删除部门

func DeleteEvent

func DeleteEvent(c *gin.Context)

func DeleteFile

func DeleteFile(c *gin.Context)

func DeleteFolder

func DeleteFolder(c *gin.Context)

func DeleteMessage

func DeleteMessage(c *gin.Context)

func DeleteMiniApp

func DeleteMiniApp(c *gin.Context)

func DeleteMyBot

func DeleteMyBot(c *gin.Context)

DeleteMyBot 删除我的 Bot

func DeleteNote

func DeleteNote(c *gin.Context)

func DeleteRole

func DeleteRole(c *gin.Context)

func DeleteSensitiveWord

func DeleteSensitiveWord(c *gin.Context)
func DeleteShortLink(c *gin.Context)

func DeleteTask

func DeleteTask(c *gin.Context)

func DeleteUser

func DeleteUser(c *gin.Context)

DeleteUser 删除用户

func DeleteVersion

func DeleteVersion(c *gin.Context)

func DissolveGroup

func DissolveGroup(c *gin.Context)

func DownloadFile

func DownloadFile(c *gin.Context)

func EndSession

func EndSession(c *gin.Context)

func ExitGroup

func ExitGroup(c *gin.Context)

func ExportNote

func ExportNote(c *gin.Context)

func ExportOperationLogs

func ExportOperationLogs(c *gin.Context)

func ExportSensitiveWords

func ExportSensitiveWords(c *gin.Context)

func GetAIConfig

func GetAIConfig(c *gin.Context)

func GetAIProviders

func GetAIProviders(c *gin.Context)

GetAIProviders 获取所有AI提供商

func GetAIUsageLogs

func GetAIUsageLogs(c *gin.Context)

GetAIUsageLogs 获取 AI 使用审计日志(管理员)

func GetActiveSessions

func GetActiveSessions(c *gin.Context)

func GetAdminFileStatistics

func GetAdminFileStatistics(c *gin.Context)

func GetAdminLargeFiles

func GetAdminLargeFiles(c *gin.Context)

func GetAllApps

func GetAllApps(c *gin.Context)

func GetApps

func GetApps(c *gin.Context)

func GetBlacklist

func GetBlacklist(c *gin.Context)

func GetBots

func GetBots(c *gin.Context)

func GetBuiltInApps

func GetBuiltInApps(c *gin.Context)

GetBuiltInApps 获取内置应用列表

func GetChannelMessageComments

func GetChannelMessageComments(c *gin.Context)

func GetChannelMessageLikes

func GetChannelMessageLikes(c *gin.Context)

func GetChannelMessages

func GetChannelMessages(c *gin.Context)

func GetChannels

func GetChannels(c *gin.Context)

func GetConversation

func GetConversation(c *gin.Context)

func GetConversations

func GetConversations(c *gin.Context)

func GetCurrentUser

func GetCurrentUser(c *gin.Context)

向后兼容的包装函数

func GetDepartmentEmployees

func GetDepartmentEmployees(c *gin.Context)

GetDepartmentEmployees 获取部门员工列表

func GetDocumentProcessStatus

func GetDocumentProcessStatus(c *gin.Context)

func GetEvent

func GetEvent(c *gin.Context)

func GetEvents

func GetEvents(c *gin.Context)

func GetFileStats

func GetFileStats(c *gin.Context)

func GetFiles

func GetFiles(c *gin.Context)

func GetFolderFiles

func GetFolderFiles(c *gin.Context)

func GetFolderTree

func GetFolderTree(c *gin.Context)

func GetGroupAISettings

func GetGroupAISettings(c *gin.Context)

func GetGroupDocuments

func GetGroupDocuments(c *gin.Context)

func GetGroupDocumentsWithStatus

func GetGroupDocumentsWithStatus(c *gin.Context)

func GetLatestYML

func GetLatestYML(c *gin.Context)

GetLatestYML 返回 electron-updater 需要的 latest.yml 格式 GET /api/v1/updates/:platform/latest.yml

func GetMessageQuoteChain

func GetMessageQuoteChain(c *gin.Context)

func GetMessageReadUsers

func GetMessageReadUsers(c *gin.Context)

func GetMessages

func GetMessages(c *gin.Context)

func GetMessagesByFilter

func GetMessagesByFilter(c *gin.Context)

func GetMiniApp

func GetMiniApp(c *gin.Context)

func GetMiniApps

func GetMiniApps(c *gin.Context)

func GetMyBotCount

func GetMyBotCount(c *gin.Context)

GetMyBotCount 获取我已创建的 Bot 数量

func GetMyBots

func GetMyBots(c *gin.Context)

GetMyBots 获取我创建的 Bot 列表

func GetNote

func GetNote(c *gin.Context)

func GetNotes

func GetNotes(c *gin.Context)

func GetNotifications

func GetNotifications(c *gin.Context)

func GetOperationLogDetail

func GetOperationLogDetail(c *gin.Context)

func GetOperationLogStats

func GetOperationLogStats(c *gin.Context)

func GetOperationLogs

func GetOperationLogs(c *gin.Context)

func GetOrganizationTree

func GetOrganizationTree(c *gin.Context)

func GetPendingRequests

func GetPendingRequests(c *gin.Context)

GetPendingRequests 获取待处理的共享请求(用户登录后调用)

func GetPublicSystemConfig

func GetPublicSystemConfig(c *gin.Context)

func GetRoleUsers

func GetRoleUsers(c *gin.Context)

func GetRoles

func GetRoles(c *gin.Context)

func GetSensitiveWords

func GetSensitiveWords(c *gin.Context)

func GetSession

func GetSession(c *gin.Context)

GetSession 获取会话详情

func GetShortLinks(c *gin.Context)

func GetStarredFiles

func GetStarredFiles(c *gin.Context)

func GetStatistics

func GetStatistics(c *gin.Context)

func GetSystemConfig

func GetSystemConfig(c *gin.Context)

func GetSystemMessages

func GetSystemMessages(c *gin.Context)

func GetTasks

func GetTasks(c *gin.Context)

func GetTemplates

func GetTemplates(c *gin.Context)

GetTemplates 获取模板 Bot 列表

func GetUpdateFile

func GetUpdateFile(c *gin.Context)

GetUpdateFile 下载更新文件 GET /api/v1/updates/:platform/files/:filename

func GetUser

func GetUser(c *gin.Context)

func GetUserByID

func GetUserByID(c *gin.Context)

func GetUserStatus

func GetUserStatus(c *gin.Context)

GetUserStatus 查询用户在线状态 兼容:

  • 单个:?user_id=1 返回对象 { user_id, status, last_online }
  • 批量:?user_ids=1,2,3 返回数组 [{...}, {...}]

func GetVersionDistribution

func GetVersionDistribution(c *gin.Context)

func GetVersions

func GetVersions(c *gin.Context)

func HandleBotMessage

func HandleBotMessage(userID uint, convID uint, content string)

func HandleNotificationAction

func HandleNotificationAction(c *gin.Context)

func HandleUpdateRequest

func HandleUpdateRequest(c *gin.Context)

HandleUpdateRequest 统一处理更新请求 GET /api/v1/updates/:platform/*action

func ImportSensitiveWords

func ImportSensitiveWords(c *gin.Context)

func InitAnomalyDetector

func InitAnomalyDetector()

InitAnomalyDetector initializes the anomaly detector

func InitSmartReplyEngine

func InitSmartReplyEngine(aiService *ai.AIService)

InitSmartReplyEngine initializes the smart reply engine with the given AI service

func InitSmartReplyGraph

func InitSmartReplyGraph() error

InitSmartReplyGraph initializes the Eino Graph for smart reply

func InitUpload

func InitUpload(c *gin.Context)

InitUpload 初始化上传

func InitWSHandlers

func InitWSHandlers()

InitWSHandlers 注册 WebSocket 消息处理回调,统一使用 MessageService

func LeaveSession

func LeaveSession(c *gin.Context)

func LikeChannelMessage

func LikeChannelMessage(c *gin.Context)

func LogAIUsage

func LogAIUsage(userID uint, botID uint, messagePreview string, callType string)

LogAIUsage 记录 AI 使用日志(内部调用)

func Login

func Login(c *gin.Context)

func Logout

func Logout(c *gin.Context)

func MarkAllNotificationsAsRead

func MarkAllNotificationsAsRead(c *gin.Context)

func MarkConversationAsRead

func MarkConversationAsRead(c *gin.Context)

func MarkNotificationAsRead

func MarkNotificationAsRead(c *gin.Context)

func NoteVectorSearch

func NoteVectorSearch(c *gin.Context)

func PatchNotification

func PatchNotification(c *gin.Context)

PatchNotification 统一通知更新接口 请求体可包含以下字段(任一或多个):

{
  "read": true,              // 标记已读(true 才生效)
  "pinned": true|false,      // 切换置顶(传 true 切换;传 false 切换为非置顶)
  "important": true|false,   // 切换重要
  "action": "accept|ignore|confirm|reschedule"  // 处理动作
}

注意:pinned / important 实际语义为「切换(toggle)」,与原接口保持一致。

func PinConversation

func PinConversation(c *gin.Context)

func PreviewFile

func PreviewFile(c *gin.Context)

func ProcessGroupDocument

func ProcessGroupDocument(c *gin.Context)

func PublicDownloadFile

func PublicDownloadFile(c *gin.Context)

PublicDownloadFile 公开下载文件(无需认证,用于客户端安装包等)

func RecallMessage

func RecallMessage(c *gin.Context)
func RedirectShortLink(c *gin.Context)

func RedirectUpdateFile

func RedirectUpdateFile(c *gin.Context, platformParam string, filename string)

func RefreshOAuthToken

func RefreshOAuthToken(c *gin.Context)

func RefreshToken

func RefreshToken(c *gin.Context)

func Register

func Register(c *gin.Context)

func RegisterAdminTools

func RegisterAdminTools(mcpServer *ai.MCPServer)

RegisterAdminTools 注册管理操作工具到 MCP 服务器

func RegisterSensitiveWordRoutes

func RegisterSensitiveWordRoutes(r *gin.RouterGroup)

func RejectJoin

func RejectJoin(c *gin.Context)

func RejectJoinRequest

func RejectJoinRequest(c *gin.Context)

func RemindMessage

func RemindMessage(c *gin.Context)

func RemoveBlacklistEntry

func RemoveBlacklistEntry(c *gin.Context)

func RemoveEmployeeFromDepartment

func RemoveEmployeeFromDepartment(c *gin.Context)

RemoveEmployeeFromDepartment 从部门移除员工

func RemoveGroupDocument

func RemoveGroupDocument(c *gin.Context)

func RemoveMemberFromGroup

func RemoveMemberFromGroup(c *gin.Context)

func RemoveUserRole

func RemoveUserRole(c *gin.Context)

func RequestJoin

func RequestJoin(c *gin.Context)

RequestJoin 申请加入会话

func RespondToShareRequest

func RespondToShareRequest(c *gin.Context)

func SearchMessages

func SearchMessages(c *gin.Context)

func SearchUsers

func SearchUsers(c *gin.Context)

func SendMessage

func SendMessage(c *gin.Context)

func SendToUserMessage

func SendToUserMessage(c *gin.Context)

func ServeScreenShare

func ServeScreenShare(hub *ws.Hub, c *gin.Context)

func ServeWs

func ServeWs(hub *ws.Hub, c *gin.Context)

func SetAvatarWorkerPool

func SetAvatarWorkerPool(pool *service.AvatarWorkerPool)

SetAvatarWorkerPool sets the avatar worker pool for the smart reply engine

func SetConfig

func SetConfig(c *config.Config)

func SetConversationMute

func SetConversationMute(c *gin.Context)

func SetMemberRole

func SetMemberRole(c *gin.Context)

func SetMemoryService

func SetMemoryService(ms *service.AvatarMemoryService)

SetMemoryService sets the avatar memory service for the smart reply engine

func SetUnifiedKnowledge

func SetUnifiedKnowledge(uk *service.UnifiedKnowledgeService)

SetUnifiedKnowledge sets the unified knowledge service for the smart reply engine

func StartAnomalyDetection

func StartAnomalyDetection(detector *AnomalyDetector)

StartAnomalyDetection 启动异常检测定时任务

func StreamMessage

func StreamMessage(c *gin.Context)

func SubscribeChannel

func SubscribeChannel(c *gin.Context)

func TestAIProviderConnection

func TestAIProviderConnection(c *gin.Context)

TestAIProviderConnection 测试AI提供商连接

func ToggleAIProviderStatus

func ToggleAIProviderStatus(c *gin.Context)

ToggleAIProviderStatus 切换AI提供商状态

func ToggleAppStatus

func ToggleAppStatus(c *gin.Context)

func ToggleImportantNotification

func ToggleImportantNotification(c *gin.Context)

func TogglePinNotification

func TogglePinNotification(c *gin.Context)

func ToggleSensitiveWordStatus

func ToggleSensitiveWordStatus(c *gin.Context)

func ToggleStar

func ToggleStar(c *gin.Context)

func ToggleVersionStatus

func ToggleVersionStatus(c *gin.Context)

func TransferOwner

func TransferOwner(c *gin.Context)

func UnifiedAuthCallback

func UnifiedAuthCallback(c *gin.Context)

func UnlikeChannelMessage

func UnlikeChannelMessage(c *gin.Context)

func UnsubscribeChannel

func UnsubscribeChannel(c *gin.Context)

func UpdateAIConfig

func UpdateAIConfig(c *gin.Context)

func UpdateAIProvider

func UpdateAIProvider(c *gin.Context)

UpdateAIProvider 更新AI提供商

func UpdateAnnouncement

func UpdateAnnouncement(c *gin.Context)

func UpdateApp

func UpdateApp(c *gin.Context)

func UpdateEvent

func UpdateEvent(c *gin.Context)

func UpdateFile

func UpdateFile(c *gin.Context)

func UpdateFolder

func UpdateFolder(c *gin.Context)

func UpdateGroupAISettings

func UpdateGroupAISettings(c *gin.Context)

func UpdateGroupInfo

func UpdateGroupInfo(c *gin.Context)

func UpdateMiniApp

func UpdateMiniApp(c *gin.Context)

func UpdateMyBot

func UpdateMyBot(c *gin.Context)

UpdateMyBot 更新我的 Bot(仅允许待审批和已拒绝状态)

func UpdateNote

func UpdateNote(c *gin.Context)

func UpdateNoteSummary

func UpdateNoteSummary(c *gin.Context)

func UpdateNoteTags

func UpdateNoteTags(c *gin.Context)

func UpdateRole

func UpdateRole(c *gin.Context)

func UpdateSensitiveWord

func UpdateSensitiveWord(c *gin.Context)

func UpdateSystemConfig

func UpdateSystemConfig(c *gin.Context)

func UpdateSystemMessage

func UpdateSystemMessage(c *gin.Context)

func UpdateTask

func UpdateTask(c *gin.Context)

func UpdateTaskStatus

func UpdateTaskStatus(c *gin.Context)

func UpdateUser

func UpdateUser(c *gin.Context)

func UpdateVersion

func UpdateVersion(c *gin.Context)

func UploadChunk

func UploadChunk(c *gin.Context)

UploadChunk 上传分片

func UploadFile

func UploadFile(c *gin.Context)

func VerifyTwoFA

func VerifyTwoFA(c *gin.Context)

Types

type AIAnalyzeResponse

type AIAnalyzeResponse struct {
	Summary     string   `json:"summary"`
	Tags        []string `json:"tags"`
	ActionItems []string `json:"action_items"`
}

type AIBotHandler

type AIBotHandler struct {
	// contains filtered or unexported fields
}

func NewAIBotHandler

func NewAIBotHandler(db *gorm.DB) *AIBotHandler

func (*AIBotHandler) CreateAIBot

func (h *AIBotHandler) CreateAIBot(c *gin.Context)

func (*AIBotHandler) DeleteAIBot

func (h *AIBotHandler) DeleteAIBot(c *gin.Context)

func (*AIBotHandler) GetAIBots

func (h *AIBotHandler) GetAIBots(c *gin.Context)

func (*AIBotHandler) ToggleAIBotStatus

func (h *AIBotHandler) ToggleAIBotStatus(c *gin.Context)

func (*AIBotHandler) UpdateAIBot

func (h *AIBotHandler) UpdateAIBot(c *gin.Context)

type AIHandler

type AIHandler struct {
	// contains filtered or unexported fields
}

AIHandler AI处理器

func NewAIHandler

func NewAIHandler(aiService *ai.AIService, mcpServer *ai.MCPServer) *AIHandler

NewAIHandler 创建AI处理器

func (*AIHandler) AISearch

func (h *AIHandler) AISearch(c *gin.Context)

AISearch 语义搜索消息

func (*AIHandler) CommandGeneration

func (h *AIHandler) CommandGeneration(c *gin.Context)

CommandGeneration 命令生成 @Summary 命令生成 @Description 根据描述生成运维命令 @Tags AI @Accept json @Produce json @Param request body CommandGenerationRequest true "命令生成请求" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/ai/ops/command [post]

func (*AIHandler) ExecuteTool

func (h *AIHandler) ExecuteTool(c *gin.Context)

ExecuteTool 执行MCP工具 @Summary 执行MCP工具 @Description 执行指定的MCP工具 @Tags AI @Accept json @Produce json @Param request body ExecuteToolRequest true "执行工具请求" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/ai/tools/execute [post]

func (*AIHandler) GenerateSummary

func (h *AIHandler) GenerateSummary(c *gin.Context)

GenerateSummary 生成会话摘要

func (*AIHandler) GetCompletion

func (h *AIHandler) GetCompletion(c *gin.Context)

GetCompletion 获取AI完成 @Summary 获取AI完成 @Description 根据消息获取AI完成 @Tags AI @Accept json @Produce json @Param request body GetCompletionRequest true "AI完成请求" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/ai/completion [post]

func (*AIHandler) GetCompletionStream

func (h *AIHandler) GetCompletionStream(c *gin.Context)

GetCompletionStream 流式获取AI完成 @Summary 流式获取AI完成 @Description 流式获取AI完成,使用服务器发送事件(SSE)返回统一JSON格式 @Tags AI @Accept json @Produce text/event-stream @Param request body GetCompletionRequest true "AI完成请求" @Success 200 {string} string "流式输出" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/ai/completion/stream [post]

func (*AIHandler) GetDigest

func (h *AIHandler) GetDigest(c *gin.Context)

GetDigest 获取智能消息速览

func (*AIHandler) GetKnowledgeGraph

func (h *AIHandler) GetKnowledgeGraph(c *gin.Context)

GetKnowledgeGraph 获取知识图谱数据 @Summary 获取知识图谱数据 @Description 获取指定集合的知识图谱节点和关系数据 @Tags 知识图谱 @Accept json @Produce json @Param collection query string true "集合名称" @Param query query string false "搜索查询" @Param max_nodes query int false "最大节点数" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/admin/knowledge-graph [get]

func (*AIHandler) IntelligentAlert

func (h *AIHandler) IntelligentAlert(c *gin.Context)

IntelligentAlert 智能告警处理 @Summary 智能告警处理 @Description 分析和处理告警 @Tags AI @Accept json @Produce json @Param request body IntelligentAlertRequest true "智能告警处理请求" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/ai/ops/alert [post]

func (*AIHandler) IntelligentTroubleshooting

func (h *AIHandler) IntelligentTroubleshooting(c *gin.Context)

IntelligentTroubleshooting 智能故障排查 @Summary 智能故障排查 @Description 分析服务器故障并提供解决方案 @Tags AI @Accept json @Produce json @Param request body IntelligentTroubleshootingRequest true "智能故障排查请求" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/ai/ops/troubleshooting [post]

func (*AIHandler) ListMCPTools

func (h *AIHandler) ListMCPTools(c *gin.Context)

ListMCPTools 列出所有MCP工具(包含启用状态) @Summary 列出所有MCP工具(管理后台) @Description 列出所有MCP工具及其启用状态,用于管理后台配置 @Tags MCP工具管理 @Produce json @Success 200 {object} AIResponse "成功响应" @Router /api/admin/mcp/tools [get]

func (*AIHandler) ListTools

func (h *AIHandler) ListTools(c *gin.Context)

ListTools 列出所有MCP工具 @Summary 列出所有MCP工具 @Description 列出所有可用的MCP工具 @Tags AI @Produce json @Success 200 {object} AIResponse "成功响应" @Router /api/ai/tools [get]

func (*AIHandler) LogAnalysis

func (h *AIHandler) LogAnalysis(c *gin.Context)

LogAnalysis 日志分析 @Summary 日志分析 @Description 分析服务器日志并提供建议 @Tags AI @Accept json @Produce json @Param request body LogAnalysisRequest true "日志分析请求" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/ai/ops/logs [post]

func (*AIHandler) OpsDashboard

func (h *AIHandler) OpsDashboard(c *gin.Context)

OpsDashboard 运维面板数据 @Summary 运维面板数据 @Description 获取AI运维面板的统计数据 @Tags AI @Produce json @Success 200 {object} AIResponse "成功响应" @Router /api/ai/ops/dashboard [get]

func (*AIHandler) OpsKnowledge

func (h *AIHandler) OpsKnowledge(c *gin.Context)

OpsKnowledge 运维知识问答 @Summary 运维知识问答 @Description 回答运维相关问题 @Tags AI @Accept json @Produce json @Param request body OpsKnowledgeRequest true "运维知识问答请求" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 500 {object} AIResponse "服务器错误" @Router /api/ai/ops/knowledge [post]

func (*AIHandler) PolishText

func (h *AIHandler) PolishText(c *gin.Context)

PolishText 润色文本

func (*AIHandler) RegisterRoutes

func (h *AIHandler) RegisterRoutes(router *gin.RouterGroup)

RegisterRoutes 注册路由

func (*AIHandler) RewriteText

func (h *AIHandler) RewriteText(c *gin.Context)

RewriteText 改写文本

func (*AIHandler) SetSmartDigestGraph

func (h *AIHandler) SetSmartDigestGraph(graph *service.SmartDigestGraph)

func (*AIHandler) SetSummaryGraph

func (h *AIHandler) SetSummaryGraph(graph *service.SummaryGraph)

func (*AIHandler) SetTextProcessGraph

func (h *AIHandler) SetTextProcessGraph(graph *service.TextProcessGraph)

func (*AIHandler) SetUnifiedSearchGraph

func (h *AIHandler) SetUnifiedSearchGraph(graph *service.UnifiedSearchGraph)

func (*AIHandler) TranslateImage

func (h *AIHandler) TranslateImage(c *gin.Context)

TranslateImage 图片翻译(AI 视觉识别 + 翻译)

func (*AIHandler) TranslateText

func (h *AIHandler) TranslateText(c *gin.Context)

TranslateText 翻译文本

func (*AIHandler) UpdateMCPToolConfig

func (h *AIHandler) UpdateMCPToolConfig(c *gin.Context)

UpdateMCPToolConfig 更新MCP工具配置 @Summary 更新MCP工具配置 @Description 启用或禁用指定的MCP工具 @Tags MCP工具管理 @Accept json @Produce json @Param tool_name path string true "工具名称" @Param request body MCPToolConfigRequest true "工具配置请求" @Success 200 {object} AIResponse "成功响应" @Failure 400 {object} AIResponse "参数错误" @Failure 404 {object} AIResponse "工具不存在" @Router /api/admin/mcp/tools/{tool_name} [put]

type AIResponse

type AIResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

AIResponse 标准AI响应结构体

type AISearchRequest

type AISearchRequest struct {
	ConversationID uint   `json:"conversation_id" binding:"required"`
	Query          string `json:"query" binding:"required"`
	SenderID       *uint  `json:"sender_id"`
	StartTime      string `json:"start_time"`
	EndTime        string `json:"end_time"`
	Limit          int    `json:"limit"`
}

AISearchRequest 语义搜索请求

type AISearchResult

type AISearchResult struct {
	MessageID      uint   `json:"message_id"`
	Content        string `json:"content"`
	SenderName     string `json:"sender_name"`
	Timestamp      string `json:"timestamp"`
	RelevanceScore int    `json:"relevance_score"`
	Highlighted    string `json:"highlighted"`
}

AISearchResult 搜索结果

type AlertHandler

type AlertHandler struct {
	// contains filtered or unexported fields
}

func NewAlertHandler

func NewAlertHandler(db *gorm.DB) *AlertHandler

func (*AlertHandler) CreateAlertRule

func (h *AlertHandler) CreateAlertRule(c *gin.Context)

func (*AlertHandler) DeleteAlertRule

func (h *AlertHandler) DeleteAlertRule(c *gin.Context)

func (*AlertHandler) GetAlertHistory

func (h *AlertHandler) GetAlertHistory(c *gin.Context)

func (*AlertHandler) GetAlertRules

func (h *AlertHandler) GetAlertRules(c *gin.Context)

func (*AlertHandler) UpdateAlertRule

func (h *AlertHandler) UpdateAlertRule(c *gin.Context)

type AnomalyAlert

type AnomalyAlert struct {
	Type           string                 `json:"type"`
	Level          string                 `json:"level"`
	ConversationID uint                   `json:"conversation_id,omitempty"`
	Message        string                 `json:"message"`
	Details        map[string]interface{} `json:"details,omitempty"`
}

AnomalyAlert 异常告警

type AnomalyDetector

type AnomalyDetector struct {
	// contains filtered or unexported fields
}

AnomalyDetector 异常检测器

func NewAnomalyDetector

func NewAnomalyDetector() *AnomalyDetector

NewAnomalyDetector 创建异常检测器

func (*AnomalyDetector) CalculateMessageVariance

func (d *AnomalyDetector) CalculateMessageVariance(conversationID uint) float64

CalculateMessageVariance 计算消息方差(用于判断异常波动)

func (*AnomalyDetector) CheckInactiveGroup

func (d *AnomalyDetector) CheckInactiveGroup(conversationID uint) *AnomalyAlert

CheckInactiveGroup 检测不活跃群组突然活跃

func (*AnomalyDetector) CheckMessageAnomaly

func (d *AnomalyDetector) CheckMessageAnomaly(conversationID uint) *AnomalyAlert

CheckMessageAnomaly 检查消息异常

func (*AnomalyDetector) CheckMessageFrequency

func (d *AnomalyDetector) CheckMessageFrequency(userID uint, conversationID uint) *AnomalyAlert

CheckMessageFrequency 检测单用户消息频率异常

func (*AnomalyDetector) CheckSensitiveContent

func (d *AnomalyDetector) CheckSensitiveContent(content string) *AnomalyAlert

CheckSensitiveContent 检测敏感内容爆发

func (*AnomalyDetector) GetDetectionStats

func (d *AnomalyDetector) GetDetectionStats() map[string]interface{}

GetDetectionStats 获取检测统计信息

func (*AnomalyDetector) RecordMessage

func (d *AnomalyDetector) RecordMessage(conversationID uint)

RecordMessage 记录消息用于检测

func (*AnomalyDetector) SendAlert

func (d *AnomalyDetector) SendAlert(adminID uint, alert *AnomalyAlert)

SendAlert 发送告警通知

func (*AnomalyDetector) UpdateBaseline

func (d *AnomalyDetector) UpdateBaseline()

UpdateBaseline 更新基线数据

type AuthProviderHandler

type AuthProviderHandler struct {
	// contains filtered or unexported fields
}

func NewAuthProviderHandler

func NewAuthProviderHandler() *AuthProviderHandler

func (*AuthProviderHandler) CreateProvider

func (h *AuthProviderHandler) CreateProvider(c *gin.Context)

func (*AuthProviderHandler) DeleteProvider

func (h *AuthProviderHandler) DeleteProvider(c *gin.Context)

func (*AuthProviderHandler) GetProviderLoginURL

func (h *AuthProviderHandler) GetProviderLoginURL(c *gin.Context)

func (*AuthProviderHandler) GetProviders

func (h *AuthProviderHandler) GetProviders(c *gin.Context)

func (*AuthProviderHandler) TestProvider

func (h *AuthProviderHandler) TestProvider(c *gin.Context)

func (*AuthProviderHandler) UpdateProvider

func (h *AuthProviderHandler) UpdateProvider(c *gin.Context)

type AvatarConfigResponse

type AvatarConfigResponse struct {
	ID                 uint                       `json:"id"`
	UserID             uint                       `json:"userId"`
	Name               string                     `json:"name"`
	Enabled            bool                       `json:"enabled"`
	AutoLearnedPersona string                     `json:"autoLearnedPersona"`
	CustomPersonaAddon string                     `json:"customPersonaAddon"`
	PersonaVersion     int                        `json:"personaVersion"`
	LastLearnedAt      *time.Time                 `json:"lastLearnedAt"`
	KnowledgeScope     model.AvatarKnowledgeScope `json:"knowledgeScope"`
	TriggerRules       model.AvatarTriggerRules   `json:"triggerRules"`
	ReplyStrategy      model.AvatarReplyStrategy  `json:"replyStrategy"`
	ModelConfigID      *uint                      `json:"modelConfigId"`
	UseSystemConfig    bool                       `json:"useSystemConfig"`
	TakeoverCooldown   int                        `json:"takeoverCooldown"`
	// 审批相关(从approvals表获取)
	ApprovalStatus         string     `json:"approvalStatus"`
	ApprovalRejectedReason string     `json:"approvalRejectedReason"`
	ApprovalAppliedAt      *time.Time `json:"approvalAppliedAt"`
	ApprovalReviewedAt     *time.Time `json:"approvalReviewedAt"`
	CreatedAt              time.Time  `json:"createdAt"`
	UpdatedAt              time.Time  `json:"updatedAt"`
}

type AvatarHandler

type AvatarHandler struct {
	// contains filtered or unexported fields
}

func NewAvatarHandler

func NewAvatarHandler(db *gorm.DB, avatarService *service.AvatarService, mcpServer *ai.MCPServer, approvalService *service.ApprovalService) *AvatarHandler

func (*AvatarHandler) ApplyForApproval

func (h *AvatarHandler) ApplyForApproval(c *gin.Context)

ApplyForApproval 申请审批

func (*AvatarHandler) BindTool

func (h *AvatarHandler) BindTool(c *gin.Context)

BindTool 绑定工具到分身

func (*AvatarHandler) CancelApplication

func (h *AvatarHandler) CancelApplication(c *gin.Context)

CancelApplication 取消申请

func (*AvatarHandler) CheckTrigger

func (h *AvatarHandler) CheckTrigger(c *gin.Context)

func (*AvatarHandler) ClearLearnedPersona

func (h *AvatarHandler) ClearLearnedPersona(c *gin.Context)

ClearLearnedPersona 清除学习结果

func (*AvatarHandler) CreateConfig

func (h *AvatarHandler) CreateConfig(c *gin.Context)

func (*AvatarHandler) DeleteConfig

func (h *AvatarHandler) DeleteConfig(c *gin.Context)

func (*AvatarHandler) DeleteMemory

func (h *AvatarHandler) DeleteMemory(c *gin.Context)

func (*AvatarHandler) GetAvailableTools

func (h *AvatarHandler) GetAvailableTools(c *gin.Context)

GetAvailableTools 获取可用工具列表

func (*AvatarHandler) GetAvatarTools

func (h *AvatarHandler) GetAvatarTools(c *gin.Context)

GetAvatarTools 获取分身绑定的工具

func (*AvatarHandler) GetConfig

func (h *AvatarHandler) GetConfig(c *gin.Context)

func (*AvatarHandler) GetLearnStatus

func (h *AvatarHandler) GetLearnStatus(c *gin.Context)

GetLearnStatus 获取学习状态

func (*AvatarHandler) GetLearnedPersona

func (h *AvatarHandler) GetLearnedPersona(c *gin.Context)

GetLearnedPersona 获取学习结果

func (*AvatarHandler) GetMemories

func (h *AvatarHandler) GetMemories(c *gin.Context)

func (*AvatarHandler) GetSessions

func (h *AvatarHandler) GetSessions(c *gin.Context)

GetSessions 获取会话分身状态

func (*AvatarHandler) PreviewReply

func (h *AvatarHandler) PreviewReply(c *gin.Context)

PreviewReply 预览回复

func (*AvatarHandler) RegisterRoutes

func (h *AvatarHandler) RegisterRoutes(router *gin.RouterGroup)

func (*AvatarHandler) SearchMemories

func (h *AvatarHandler) SearchMemories(c *gin.Context)

func (*AvatarHandler) SearchNotes

func (h *AvatarHandler) SearchNotes(c *gin.Context)

func (*AvatarHandler) TakeoverSession

func (h *AvatarHandler) TakeoverSession(c *gin.Context)

TakeoverSession 接管分身

func (*AvatarHandler) TriggerLearnPersona

func (h *AvatarHandler) TriggerLearnPersona(c *gin.Context)

TriggerLearnPersona 触发人设学习

func (*AvatarHandler) UnbindTool

func (h *AvatarHandler) UnbindTool(c *gin.Context)

UnbindTool 解绑工具

func (*AvatarHandler) UpdateAvatarTools

func (h *AvatarHandler) UpdateAvatarTools(c *gin.Context)

UpdateAvatarTools 批量更新分身工具配置

func (*AvatarHandler) UpdateConfig

func (h *AvatarHandler) UpdateConfig(c *gin.Context)

func (*AvatarHandler) UpdateSession

func (h *AvatarHandler) UpdateSession(c *gin.Context)

UpdateSession 更新会话分身状态

type AvatarTool

type AvatarTool struct {
	ID          string
	Name        string
	Description string
	Icon        string
}

AvatarTool 工具信息

type CancelUploadRequest

type CancelUploadRequest struct {
	UploadID string `json:"upload_id" binding:"required"`
}

CancelUploadRequest 取消上传请求

type CommandGenerationRequest

type CommandGenerationRequest struct {
	Description string `json:"description" binding:"required"`
	Platform    string `json:"platform"`
	Format      string `json:"format"`
}

CommandGenerationRequest 命令生成请求

type CompleteUploadRequest

type CompleteUploadRequest struct {
	UploadID string `json:"upload_id" binding:"required"`
}

CompleteUploadRequest 完成上传请求

type ConfigResponse

type ConfigResponse struct {
	ID           uint          `json:"id"`
	ConfigName   string        `json:"config_name"`
	Provider     string        `json:"provider"`
	ModelName    string        `json:"model_name"`
	BaseURL      string        `json:"base_url"`
	Temperature  float64       `json:"temperature"`
	MaxTokens    int           `json:"max_tokens"`
	IsVerified   bool          `json:"is_verified"`
	Overrides    []ai.Override `json:"overrides,omitempty"`
	LastTestedAt *time.Time    `json:"last_tested_at"`
	CreatedAt    time.Time     `json:"created_at"`
}

type CrashLogHandler

type CrashLogHandler struct {
	// contains filtered or unexported fields
}

func NewCrashLogHandler

func NewCrashLogHandler(db *gorm.DB) *CrashLogHandler

func (*CrashLogHandler) CreateCrashLog

func (h *CrashLogHandler) CreateCrashLog(c *gin.Context)

func (*CrashLogHandler) GetCrashDetail

func (h *CrashLogHandler) GetCrashDetail(c *gin.Context)

func (*CrashLogHandler) GetCrashLogs

func (h *CrashLogHandler) GetCrashLogs(c *gin.Context)

type CreateAvatarConfigRequest

type CreateAvatarConfigRequest struct {
	Name               string                     `json:"name"`
	UseSystemConfig    bool                       `json:"useSystemConfig"`
	ModelConfigID      *uint                      `json:"modelConfigId"`
	TriggerRules       model.AvatarTriggerRules   `json:"triggerRules"`
	KnowledgeScope     model.AvatarKnowledgeScope `json:"knowledgeScope"`
	ReplyStrategy      model.AvatarReplyStrategy  `json:"replyStrategy"`
	TakeoverCooldown   int                        `json:"takeoverCooldown"`
	CustomPersonaAddon string                     `json:"customPersonaAddon"`
}

type CreateBotRequest

type CreateBotRequest struct {
	Name           string                 `json:"name" binding:"required"`
	Description    string                 `json:"description" binding:"required"`
	Type           string                 `json:"type" binding:"required"` // ai, custom
	Provider       string                 `json:"provider"`
	CustomModelURL string                 `json:"custom_model_url"`
	LobsterURL     string                 `json:"lobster_url"`
	Avatar         string                 `json:"avatar"`
	IsTemplate     bool                   `json:"is_template"`
	Config         map[string]interface{} `json:"config"`
}

CreateBotRequest 创建 Bot 请求体

type CreateConfigRequest

type CreateConfigRequest struct {
	ConfigName string        `json:"config_name" binding:"required"`
	Provider   string        `json:"provider" binding:"required"`
	APIKey     string        `json:"api_key" binding:"required"`
	ModelName  string        `json:"model_name" binding:"required"`
	BaseURL    string        `json:"base_url"`
	Overrides  []ai.Override `json:"overrides,omitempty"`
}

type DBPoolStats

type DBPoolStats struct {
	MaxOpenConnections int           `json:"maxOpenConnections"`
	OpenConnections    int           `json:"openConnections"`
	InUse              int           `json:"inUse"`
	Idle               int           `json:"idle"`
	WaitCount          int64         `json:"waitCount"`
	WaitDuration       time.Duration `json:"waitDuration"`
	MaxIdleClosed      int64         `json:"maxIdleClosed"`
	MaxLifetimeClosed  int64         `json:"maxLifetimeClosed"`
}

type ExecuteToolRequest

type ExecuteToolRequest struct {
	ToolName   string                 `json:"tool_name" binding:"required"`
	Parameters map[string]interface{} `json:"parameters"`
}

ExecuteToolRequest 执行工具请求

type ExtractedTodo

type ExtractedTodo struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Assignee    string `json:"assignee,omitempty"`
	DueDate     string `json:"due_date,omitempty"`
	Priority    string `json:"priority,omitempty"`
}

ExtractedTodo 提取的待办结构

type FeedbackHandler

type FeedbackHandler struct {
	// contains filtered or unexported fields
}

func NewFeedbackHandler

func NewFeedbackHandler(db *gorm.DB) *FeedbackHandler

func (*FeedbackHandler) CreateFeedback

func (h *FeedbackHandler) CreateFeedback(c *gin.Context)

func (*FeedbackHandler) GetFeedbackDetail

func (h *FeedbackHandler) GetFeedbackDetail(c *gin.Context)

func (*FeedbackHandler) GetFeedbacks

func (h *FeedbackHandler) GetFeedbacks(c *gin.Context)

func (*FeedbackHandler) UpdateFeedback

func (h *FeedbackHandler) UpdateFeedback(c *gin.Context)

type FileStatistics

type FileStatistics struct {
	TotalSize int64 `json:"totalSize"`
	UsedSize  int64 `json:"usedSize"`
	FileCount int64 `json:"fileCount"`
	TypeStats []struct {
		Type  string `json:"type"`
		Count int64  `json:"count"`
		Size  int64  `json:"size"`
	} `json:"typeStats"`
}

type GenerateSummaryRequest

type GenerateSummaryRequest struct {
	ConversationID uint       `json:"conversation_id" binding:"required"`
	TimeRange      string     `json:"time_range"` // "1h", "today", "7d", "custom"
	StartTime      *time.Time `json:"start_time"`
	EndTime        *time.Time `json:"end_time"`
}

GenerateSummaryRequest 生成摘要请求

type GetCompletionRequest

type GetCompletionRequest struct {
	Messages []ai.Message `json:"messages" binding:"required"`
}

GetCompletionRequest 获取AI完成请求

type GroupManagementTool

type GroupManagementTool struct{}

GroupManagementTool 群组管理工具

func (*GroupManagementTool) Description

func (t *GroupManagementTool) Description() string

func (*GroupManagementTool) Execute

func (t *GroupManagementTool) Execute(params map[string]interface{}, ctx *ai.CallerContext) (interface{}, error)

func (*GroupManagementTool) Name

func (t *GroupManagementTool) Name() string

func (*GroupManagementTool) Parameters

func (t *GroupManagementTool) Parameters() map[string]interface{}

type GroupSummaryJob

type GroupSummaryJob struct {
	// contains filtered or unexported fields
}

GroupSummaryJob 群聊总结定时任务

func NewGroupSummaryJob

func NewGroupSummaryJob(aiService *ai.AIService) *GroupSummaryJob

NewGroupSummaryJob 创建群聊总结任务

func (*GroupSummaryJob) GenerateDailySummaries

func (j *GroupSummaryJob) GenerateDailySummaries()

GenerateDailySummaries 生成所有群的每日总结

type InitUploadRequest

type InitUploadRequest struct {
	Filename string `json:"filename" binding:"required"`
	FileSize int64  `json:"file_size" binding:"required"`
	FileHash string `json:"file_hash" binding:"required"`
	FolderID *uint  `json:"folder_id"`
}

InitUploadRequest 初始化上传请求

type InitUploadResponse

type InitUploadResponse struct {
	UploadID        string `json:"upload_id"`
	ChunkSize       int64  `json:"chunk_size"`
	TotalChunks     int    `json:"total_chunks"`
	UploadedChunks  []int  `json:"uploaded_chunks"`
	IsInstantUpload bool   `json:"is_quick_upload"`
	FileID          *uint  `json:"file_id,omitempty"`
}

InitUploadResponse 初始化上传响应

type IntelligentAlertRequest

type IntelligentAlertRequest struct {
	AlertContent string `json:"alert_content" binding:"required"`
	Severity     string `json:"severity"`
	Service      string `json:"service"`
}

IntelligentAlertRequest 智能告警处理请求

type IntelligentTroubleshootingRequest

type IntelligentTroubleshootingRequest struct {
	Symptom string `json:"symptom" binding:"required"`
	Server  string `json:"server"`
	Logs    string `json:"logs"`
}

IntelligentTroubleshootingRequest 智能故障排查请求

type KnowledgeGraphQueryRequest

type KnowledgeGraphQueryRequest struct {
	Collection string `json:"collection" binding:"required"`
	Query      string `json:"query"`
	MaxNodes   int    `json:"max_nodes"`
}

KnowledgeGraphQueryRequest 知识图谱查询请求

type KnowledgeResult

type KnowledgeResult struct {
	Note    model.Note `json:"note"`
	Score   float64    `json:"score"`
	Snippet string     `json:"snippet"`
}

KnowledgeResult 知识检索结果

type KnowledgeService

type KnowledgeService struct {
	// contains filtered or unexported fields
}

KnowledgeService 知识库服务

func NewKnowledgeService

func NewKnowledgeService(aiService *ai.AIService) *KnowledgeService

NewKnowledgeService 创建知识库服务

func (*KnowledgeService) AnswerWithKnowledge

func (k *KnowledgeService) AnswerWithKnowledge(query string, userID uint) (string, error)

AnswerWithKnowledge 基于知识库回答问题

func (*KnowledgeService) BuildKnowledgeContext

func (k *KnowledgeService) BuildKnowledgeContext(query string) string

BuildKnowledgeContext 构建知识库上下文,用于注入到 AI prompt 中

func (*KnowledgeService) GetKnowledgeStats

func (k *KnowledgeService) GetKnowledgeStats() map[string]interface{}

GetKnowledgeStats 获取知识库统计信息

func (*KnowledgeService) SearchKnowledge

func (k *KnowledgeService) SearchKnowledge(query string, limit int) []KnowledgeResult

SearchKnowledge 搜索知识库

type LargeFile

type LargeFile struct {
	ID           uint   `json:"id"`
	FileName     string `json:"fileName"`
	FileSize     int64  `json:"fileSize"`
	UploaderID   uint   `json:"uploaderId"`
	UploaderName string `json:"uploaderName"`
	CreatedAt    string `json:"createdAt"`
}

type LogAnalysisRequest

type LogAnalysisRequest struct {
	LogContent string `json:"log_content" binding:"required"`
	Service    string `json:"service"`
	Severity   string `json:"severity"`
}

LogAnalysisRequest 日志分析请求

type MCPToolConfigRequest

type MCPToolConfigRequest struct {
	Enabled *bool `json:"enabled" binding:"required"`
}

MCPToolConfigRequest MCP工具配置请求

type MessageSender

type MessageSender interface {
	SendAIMessage(conversationID uint, content string, assistantName string) error
	SendMessageWithContext(conversationID uint, content string, assistantName string, msg *model.Message) error
	SendStreamingAIMessage(conversationID uint, assistantName string) (func(string) error, func() error, error)
}

type MonitorHandler

type MonitorHandler struct {
	// contains filtered or unexported fields
}

func NewMonitorHandler

func NewMonitorHandler() *MonitorHandler

func (*MonitorHandler) GetServerMetrics

func (h *MonitorHandler) GetServerMetrics(c *gin.Context)

func (*MonitorHandler) GetServerMetricsHistory

func (h *MonitorHandler) GetServerMetricsHistory(c *gin.Context)

func (*MonitorHandler) GetServiceStatus

func (h *MonitorHandler) GetServiceStatus(c *gin.Context)

func (*MonitorHandler) HealthCheck

func (h *MonitorHandler) HealthCheck(c *gin.Context)

type NetworkIO

type NetworkIO struct {
	In  float64 `json:"in"`
	Out float64 `json:"out"`
}

type NoteSearchResult

type NoteSearchResult struct {
	Content string  `json:"content"`
	Score   float64 `json:"score"`
	Title   string  `json:"title"`
	NoteID  string  `json:"note_id"`
}

NoteSearchResult 笔记搜索结果

type NoteSummaryRequest

type NoteSummaryRequest struct {
	Summary string `json:"summary"`
}

type NoteTagsRequest

type NoteTagsRequest struct {
	Tags []string `json:"tags"`
}

type NoteVectorSearchItem

type NoteVectorSearchItem struct {
	Content string  `json:"content"`
	Score   float64 `json:"score"`
	Title   string  `json:"title"`
	NoteID  string  `json:"note_id"`
}

type NoteVectorSearchRequest

type NoteVectorSearchRequest struct {
	Query string `json:"query" binding:"required"`
	TopK  int    `json:"top_k"`
}

type OpsKnowledgeRequest

type OpsKnowledgeRequest struct {
	Question string `json:"question" binding:"required"`
	Category string `json:"category"`
}

OpsKnowledgeRequest 运维知识问答请求

type OrgSyncHandler

type OrgSyncHandler struct {
	// contains filtered or unexported fields
}

func NewOrgSyncHandler

func NewOrgSyncHandler() *OrgSyncHandler

func (*OrgSyncHandler) CreateConfig

func (h *OrgSyncHandler) CreateConfig(c *gin.Context)

func (*OrgSyncHandler) DeleteConfig

func (h *OrgSyncHandler) DeleteConfig(c *gin.Context)

func (*OrgSyncHandler) GetConfigs

func (h *OrgSyncHandler) GetConfigs(c *gin.Context)

func (*OrgSyncHandler) GetLogs

func (h *OrgSyncHandler) GetLogs(c *gin.Context)

func (*OrgSyncHandler) TriggerSync

func (h *OrgSyncHandler) TriggerSync(c *gin.Context)

func (*OrgSyncHandler) UpdateConfig

func (h *OrgSyncHandler) UpdateConfig(c *gin.Context)

type PolishTextRequest

type PolishTextRequest struct {
	Text     string `json:"text" binding:"required"`
	Language string `json:"language"` // zh/en
}

PolishTextRequest 润色请求

type PromptBuilder

type PromptBuilder interface {
	BuildSystemPrompt(ctx *PromptContext) string
}

type PromptContext

type PromptContext struct {
	ConversationID uint
	Conversation   *model.Conversation
	UserID         uint
	Group          *model.Group
	User           *model.User
	Messages       []model.Message
	Tasks          []model.Task
	GroupName      string
}

type RateLimiter

type RateLimiter struct {
	// contains filtered or unexported fields
}

RateLimiter 简易令牌桶限流器

func NewRateLimiter

func NewRateLimiter(interval time.Duration, burst int) *RateLimiter

NewRateLimiter 创建限流器,interval 为两次放行间隔,burst 为突发上限

func (*RateLimiter) Stop

func (rl *RateLimiter) Stop()

Stop 停止限流器

func (*RateLimiter) Wait

func (rl *RateLimiter) Wait()

Wait 阻塞直到获取一个令牌

type RewriteTextRequest

type RewriteTextRequest struct {
	Text  string `json:"text" binding:"required"`
	Style string `json:"style"` // formal/casual/concise/detailed
	Tone  string `json:"tone"`  // professional/friendly/neutral
}

RewriteTextRequest 改写请求

type ServerMetrics

type ServerMetrics struct {
	CPU        float64      `json:"cpu"`
	Memory     float64      `json:"memory"`
	Disk       float64      `json:"disk"`
	Network    NetworkIO    `json:"network"`
	DBPool     *DBPoolStats `json:"dbPool,omitempty"`
	Timestamp  string       `json:"timestamp"`
	Uptime     int64        `json:"uptime"`
	GoRoutines int          `json:"goRoutines"`
}

type ServiceStatus

type ServiceStatus struct {
	Name      string `json:"name"`
	Status    string `json:"status"`
	Message   string `json:"message"`
	LastCheck string `json:"lastCheck"`
	Latency   int64  `json:"latency"`
}

type SmartPromptBuilder

type SmartPromptBuilder struct {
	// contains filtered or unexported fields
}

func NewSmartPromptBuilder

func NewSmartPromptBuilder(knowledgeSvc *KnowledgeService) *SmartPromptBuilder

func (*SmartPromptBuilder) BuildPromptContext

func (b *SmartPromptBuilder) BuildPromptContext(conversationID uint, userID uint) *PromptContext

func (*SmartPromptBuilder) BuildSystemPrompt

func (b *SmartPromptBuilder) BuildSystemPrompt(ctx *PromptContext) string

type SmartReplyEngine

type SmartReplyEngine struct {
	// contains filtered or unexported fields
}

SmartReplyEngine 智能回复引擎

func GetSmartReplyEngine

func GetSmartReplyEngine() *SmartReplyEngine

GetSmartReplyEngine returns the smart reply engine instance

func NewSmartReplyEngine

func NewSmartReplyEngine(aiService *ai.AIService, detector *ai.IntentDetector) *SmartReplyEngine

NewSmartReplyEngine 创建智能回复引擎

func (*SmartReplyEngine) HandleMessage

func (e *SmartReplyEngine) HandleMessage(userID uint, conversationID uint, content string, mentionUserIDs []uint)

func (*SmartReplyEngine) InitSmartReplyGraph

func (e *SmartReplyEngine) InitSmartReplyGraph() error

func (*SmartReplyEngine) SetAvatarWorkerPool

func (e *SmartReplyEngine) SetAvatarWorkerPool(pool *service.AvatarWorkerPool)

SetAvatarWorkerPool 设置分身工作池

func (*SmartReplyEngine) SetMemoryService

func (e *SmartReplyEngine) SetMemoryService(ms *service.AvatarMemoryService)

SetMemoryService sets the avatar memory service for the smart reply engine

func (*SmartReplyEngine) SetUnifiedKnowledge

func (e *SmartReplyEngine) SetUnifiedKnowledge(uk *service.UnifiedKnowledgeService)

SetUnifiedKnowledge 设置统一知识检索服务(向量库+MySQL兜底)

type SystemNotificationTool

type SystemNotificationTool struct{}

SystemNotificationTool 系统通知工具

func (*SystemNotificationTool) Description

func (t *SystemNotificationTool) Description() string

func (*SystemNotificationTool) Execute

func (t *SystemNotificationTool) Execute(params map[string]interface{}, ctx *ai.CallerContext) (interface{}, error)

func (*SystemNotificationTool) Name

func (t *SystemNotificationTool) Name() string

func (*SystemNotificationTool) Parameters

func (t *SystemNotificationTool) Parameters() map[string]interface{}

type TodoExtractor

type TodoExtractor struct {
	// contains filtered or unexported fields
}

TodoExtractor 待办提取引擎

func NewTodoExtractor

func NewTodoExtractor(aiService *ai.AIService) *TodoExtractor

NewTodoExtractor 创建待办提取引擎

func (*TodoExtractor) ExtractAndCreateTodos

func (e *TodoExtractor) ExtractAndCreateTodos(content string, senderID uint, conversationID uint)

ExtractAndCreateTodos 从消息中提取待办并创建

type TranslateImageRequest

type TranslateImageRequest struct {
	ImageURL   string `json:"image_url" binding:"required"`
	TargetLang string `json:"target_lang"` // 默认 zh
}

TranslateImageRequest 图片翻译请求

type TranslateTextRequest

type TranslateTextRequest struct {
	Text       string `json:"text" binding:"required"`
	TargetLang string `json:"target_lang" binding:"required"` // zh/en/ja/ko/fr/de
	SourceLang string `json:"source_lang"`                    // auto/zh/en/...
}

TranslateTextRequest 翻译请求

type UpdateAvatarConfigRequest

type UpdateAvatarConfigRequest struct {
	Name               *string                     `json:"name"`
	Enabled            *bool                       `json:"enabled"`
	UseSystemConfig    *bool                       `json:"useSystemConfig"`
	ModelConfigID      *uint                       `json:"modelConfigId"`
	TriggerRules       *model.AvatarTriggerRules   `json:"triggerRules"`
	KnowledgeScope     *model.AvatarKnowledgeScope `json:"knowledgeScope"`
	ReplyStrategy      *model.AvatarReplyStrategy  `json:"replyStrategy"`
	TakeoverCooldown   *int                        `json:"takeoverCooldown"`
	CustomPersonaAddon *string                     `json:"customPersonaAddon"`
}

type UploadChunkRequest

type UploadChunkRequest struct {
	UploadID   string `form:"upload_id" binding:"required"`
	ChunkIndex int    `form:"chunk_index" binding:"required"`
	ChunkHash  string `form:"chunk_hash" binding:"required"`
}

UploadChunkRequest 上传分片请求(multipart form)

type UserAIConfigHandler

type UserAIConfigHandler struct{}

func NewUserAIConfigHandler

func NewUserAIConfigHandler() *UserAIConfigHandler

func (*UserAIConfigHandler) CreateConfig

func (h *UserAIConfigHandler) CreateConfig(c *gin.Context)

func (*UserAIConfigHandler) DeleteConfig

func (h *UserAIConfigHandler) DeleteConfig(c *gin.Context)

func (*UserAIConfigHandler) ListMyConfigs

func (h *UserAIConfigHandler) ListMyConfigs(c *gin.Context)

func (*UserAIConfigHandler) RegisterRoutes

func (h *UserAIConfigHandler) RegisterRoutes(router *gin.RouterGroup)

func (*UserAIConfigHandler) TestConfig

func (h *UserAIConfigHandler) TestConfig(c *gin.Context)

func (*UserAIConfigHandler) UpdateConfig

func (h *UserAIConfigHandler) UpdateConfig(c *gin.Context)

type UserHandler

type UserHandler struct {
	// contains filtered or unexported fields
}

func NewUserHandler

func NewUserHandler(userService *service.UserService, convService *service.ConversationService) *UserHandler

func (*UserHandler) GetCurrentUser

func (h *UserHandler) GetCurrentUser(c *gin.Context)

func (*UserHandler) SearchUsers

func (h *UserHandler) SearchUsers(c *gin.Context)

func (*UserHandler) UpdateUser

func (h *UserHandler) UpdateUser(c *gin.Context)

type UserManagementTool

type UserManagementTool struct{}

UserManagementTool 用户管理工具

func (*UserManagementTool) Description

func (t *UserManagementTool) Description() string

func (*UserManagementTool) Execute

func (t *UserManagementTool) Execute(params map[string]interface{}, ctx *ai.CallerContext) (interface{}, error)

func (*UserManagementTool) Name

func (t *UserManagementTool) Name() string

func (*UserManagementTool) Parameters

func (t *UserManagementTool) Parameters() map[string]interface{}

type WebSocketMessageSender

type WebSocketMessageSender struct {
	// contains filtered or unexported fields
}

func NewWebSocketMessageSender

func NewWebSocketMessageSender(hub *ws.Hub, userSvc *service.UserService) *WebSocketMessageSender

func (*WebSocketMessageSender) SendAIMessage

func (s *WebSocketMessageSender) SendAIMessage(conversationID uint, content string, assistantName string) error

func (*WebSocketMessageSender) SendMessageWithContext

func (s *WebSocketMessageSender) SendMessageWithContext(conversationID uint, content string, assistantName string, msg *model.Message) error

func (*WebSocketMessageSender) SendStreamingAIMessage

func (s *WebSocketMessageSender) SendStreamingAIMessage(conversationID uint, assistantName string) (func(string) error, func() error, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL