Documentation
¶
Index ¶
- Constants
- type Build
- type CICDConfig
- type ChatLog
- type Conversation
- type Database
- type DatabaseList
- type IMConfig
- type Instance
- type InstanceList
- type JSONMap
- type Job
- type JobList
- type LLMConfig
- type ListResponse
- type MCPLog
- type MCPServer
- type MCPTool
- type OSSBucket
- type OSSBucketList
- type PageInfo
- type ProviderAccount
- type Response
- type StringArray
- type SystemConfig
- type TimeRange
- type User
Constants ¶
View Source
const ( ConfigKeyServerHTTPEnabled = "server.http.enabled" ConfigKeyServerHTTPPort = "server.http.port" ConfigKeyServerMCPEnabled = "server.mcp.enabled" ConfigKeyServerMCPPort = "server.mcp.port" ConfigKeyServerMCPAutoRegisterExternalTools = "server.mcp.auto_register_external_tools" ConfigKeyServerMCPToolNameFormat = "server.mcp.tool_name_format" ConfigKeyAuthEnabled = "auth.enabled" ConfigKeyAuthType = "auth.type" ConfigKeyAuthTokens = "auth.tokens" ConfigKeyCacheEnabled = "cache.enabled" ConfigKeyCacheType = "cache.type" ConfigKeyCacheTTL = "cache.ttl" )
系统配置键常量
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct {
Number int `json:"number"`
Status string `json:"status"`
Result string `json:"result"`
Timestamp time.Time `json:"timestamp"`
Duration int64 `json:"duration"` // 毫秒
URL string `json:"url"`
}
Build 构建模型
type CICDConfig ¶ added in v0.2.0
type CICDConfig struct {
ID uint `gorm:"primaryKey" json:"id"`
Platform string `gorm:"size:50;not null;uniqueIndex" json:"platform"` // jenkins
Enabled bool `gorm:"default:true" json:"enabled"`
URL string `gorm:"type:text;not null" json:"url"`
Username string `gorm:"size:100" json:"username"`
Token string `gorm:"type:text" json:"token"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
CICDConfig CICD配置模型
type ChatLog ¶ added in v0.2.0
type ChatLog struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at" gorm:"index"`
Username string `json:"username" gorm:"index;size:100"`
Source string `json:"source" gorm:"size:50"` // "私聊" | "群聊"
ChatType int `json:"chat_type" gorm:"index"` // 1=用户提问, 2=AI回答
ParentContent uint `json:"parent_content"` // 父消息ID
ConversationID uint `json:"conversation_id" gorm:"index"` // 所属会话ID
Content string `json:"content" gorm:"type:text"`
}
ChatLog 对话记录模型
type Conversation ¶ added in v0.2.0
type Conversation struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at" gorm:"index"`
Username string `json:"username" gorm:"index;size:100"` // 所属用户
Title string `json:"title" gorm:"size:255"` // 会话标题
LastMessageAt time.Time `json:"last_message_at" gorm:"index"` // 最后消息时间,用于排序
}
Conversation 会话模型
func (Conversation) TableName ¶ added in v0.2.0
func (Conversation) TableName() string
TableName 指定表名
type Database ¶
type Database struct {
ID string `json:"id"`
Name string `json:"name"`
Provider string `json:"provider"`
Region string `json:"region"`
Engine string `json:"engine"` // mysql, postgresql, redis
EngineVersion string `json:"engine_version"`
Status string `json:"status"`
Endpoint string `json:"endpoint"`
Port int `json:"port"`
CreatedAt time.Time `json:"created_at"`
Tags map[string]string `json:"tags"`
ConsoleURL string `json:"console_url"` // 控制台跳转地址
}
Database 数据库模型
type DatabaseList ¶
type DatabaseList struct {
Items []*Database `json:"items"`
PageInfo *PageInfo `json:"page_info,omitempty"`
}
DatabaseList 数据库列表
type IMConfig ¶ added in v0.2.0
type IMConfig struct {
ID uint `gorm:"primaryKey" json:"id"`
Platform string `gorm:"size:50;not null;uniqueIndex" json:"platform"` // dingtalk, feishu, wecom
Enabled bool `gorm:"default:false" json:"enabled"`
AppID string `gorm:"column:app_id;size:200" json:"app_id"` // 应用ID
AppKey string `gorm:"column:app_key;size:200" json:"app_key"` // 应用Key/Secret
AgentID string `gorm:"column:agent_id;size:200" json:"agent_id"` // Agent ID
TemplateID string `gorm:"column:template_id;size:200" json:"template_id"` // 模板ID
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
IMConfig IM配置模型 (钉钉/飞书/企微)
type Instance ¶
type Instance struct {
ID string `json:"id"`
Name string `json:"name"`
Provider string `json:"provider"` // 提供商: aliyun, tencent
Region string `json:"region"` // 区域
Zone string `json:"zone"` // 可用区
InstanceType string `json:"instance_type"` // 实例规格
Status string `json:"status"` // 状态
PrivateIP []string `json:"private_ip"`
PublicIP []string `json:"public_ip"`
CPU int `json:"cpu"`
Memory int `json:"memory"` // MB
OSType string `json:"os_type"`
OSName string `json:"os_name"`
CreatedAt time.Time `json:"created_at"`
ExpiredAt *time.Time `json:"expired_at,omitempty"`
Tags map[string]string `json:"tags"`
Metadata map[string]any `json:"metadata"` // 扩展字段
ConsoleURL string `json:"console_url"` // 控制台跳转地址
}
Instance 统一的实例模型 (跨云平台)
type InstanceList ¶
type InstanceList struct {
Items []*Instance `json:"items"`
PageInfo *PageInfo `json:"page_info,omitempty"`
}
InstanceList 实例列表
type JSONMap ¶ added in v0.2.0
type JSONMap map[string]interface{}
JSONMap JSON对象类型
type Job ¶
type Job struct {
Name string `json:"name"`
DisplayName string `json:"display_name"`
URL string `json:"url"`
Description string `json:"description"`
Buildable bool `json:"buildable"`
LastBuild *Build `json:"last_build,omitempty"`
}
Job Jenkins 任务模型
type LLMConfig ¶ added in v0.2.0
type LLMConfig struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"size:100;not null" json:"name"`
Enabled bool `gorm:"default:true" json:"enabled"`
Provider string `gorm:"size:50;not null" json:"provider"` // "openai" | "anthropic" | "deepseek" | etc.
Model string `gorm:"size:100;not null" json:"model"`
APIKey string `gorm:"size:500" json:"api_key"`
BaseURL string `gorm:"size:500" json:"base_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
LLMConfig LLM配置模型 - 每条记录代表一个LLM实例
type ListResponse ¶
type ListResponse struct {
Items any `json:"items"`
PageInfo *PageInfo `json:"page_info,omitempty"`
}
ListResponse 列表响应
type MCPLog ¶ added in v0.2.0
type MCPLog struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
Timestamp time.Time `json:"timestamp" gorm:"index"`
ServerName string `json:"server_name" gorm:"index;size:100"`
ToolName string `json:"tool_name" gorm:"index;size:100"`
Status string `json:"status" gorm:"size:20;index"` // "success" | "error"
Latency int64 `json:"latency"` // 延迟(毫秒)
Username string `json:"username" gorm:"index;size:100"` // 调用用户
Source string `json:"source" gorm:"size:50"` // 调用来源: "admin_test", "dingtalk", "feishu", "wecom", "llm"
ChatLogID uint `json:"chat_log_id" gorm:"index"` // 关联的对话记录ID(如果是从LLM调用)
Request string `json:"request" gorm:"type:text"` // 请求参数 JSON
Response string `json:"response" gorm:"type:text"` // 响应结果 JSON
ErrorMessage string `json:"error_message" gorm:"type:text"` // 错误信息(如果失败)
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
MCPLog MCP 调用日志
type MCPServer ¶ added in v0.2.0
type MCPServer struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"size:100;not null;uniqueIndex" json:"name"`
IsActive bool `gorm:"default:false" json:"is_active"`
Type string `gorm:"size:50;not null" json:"type"` // stdio, sse, streamableHttp
Description string `gorm:"type:text" json:"description"`
BaseURL string `gorm:"type:text" json:"base_url"`
Command string `gorm:"type:text" json:"command"`
Args StringArray `gorm:"type:text" json:"args"`
Env JSONMap `gorm:"type:text" json:"env"`
Headers JSONMap `gorm:"type:text" json:"headers"`
LongRunning bool `gorm:"default:true" json:"long_running"`
Timeout int `gorm:"default:300" json:"timeout"`
InstallSource string `gorm:"size:50" json:"install_source"`
ToolPrefix string `gorm:"size:50" json:"tool_prefix"`
AutoRegister bool `gorm:"default:true" json:"auto_register"`
Provider string `gorm:"size:100" json:"provider"`
ProviderURL string `gorm:"type:text" json:"provider_url"`
LogoURL string `gorm:"type:text" json:"logo_url"`
Tags StringArray `gorm:"type:text" json:"tags"`
Tools []MCPTool `gorm:"foreignKey:ServerID" json:"tools"` // 关联的工具列表
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
MCPServer MCP服务器配置模型
type MCPTool ¶ added in v0.2.0
type MCPTool struct {
ID uint `gorm:"primaryKey" json:"id"`
ServerID uint `json:"server_id" gorm:"index;uniqueIndex:idx_server_tool"`
Name string `json:"name" gorm:"not null;size:100;uniqueIndex:idx_server_tool"`
Description string `json:"description" gorm:"type:text"`
IsEnabled bool `json:"isEnabled" gorm:"default:true"`
InputSchema map[string]interface{} `json:"inputSchema" gorm:"serializer:json;type:text"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
MCPTool MCP 工具模型
type OSSBucket ¶ added in v0.1.1
type OSSBucket struct {
Name string `json:"name"`
Provider string `json:"provider"` // 提供商: aliyun, tencent
Region string `json:"region"` // 区域
StorageClass string `json:"storage_class"` // 存储类型
ACL string `json:"acl"` // 访问控制
CreatedAt string `json:"created_at"`
Metadata map[string]any `json:"metadata"` // 扩展字段
ConsoleURL string `json:"console_url"` // 控制台跳转地址
}
OSSBucket 统一的 OSS Bucket 模型 (跨云平台)
type OSSBucketList ¶ added in v0.1.1
type OSSBucketList struct {
Items []*OSSBucket `json:"items"`
PageInfo *PageInfo `json:"page_info,omitempty"`
}
OSSBucketList Bucket 列表
type PageInfo ¶
type PageInfo struct {
PageNum int `json:"page_num"`
PageSize int `json:"page_size"`
Total int `json:"total"`
TotalPage int `json:"total_page"`
}
PageInfo 分页信息
type ProviderAccount ¶ added in v0.2.0
type ProviderAccount struct {
ID uint `gorm:"primaryKey" json:"id"`
Provider string `gorm:"size:50;not null;index:idx_provider_name" json:"provider"` // aliyun, tencent
Name string `gorm:"size:100;not null;index:idx_provider_name" json:"name"`
Enabled bool `gorm:"default:true" json:"enabled"`
AccessKey string `gorm:"type:text;not null" json:"access_key"`
SecretKey string `gorm:"type:text;not null" json:"secret_key"`
Regions StringArray `gorm:"type:text" json:"regions"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ProviderAccount 云厂商账号配置模型
func (ProviderAccount) TableName ¶ added in v0.2.0
func (ProviderAccount) TableName() string
TableName 指定表名
type Response ¶
type Response struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
Response 通用响应结构
type StringArray ¶ added in v0.2.0
type StringArray []string
StringArray 字符串数组类型,用于存储 regions
func (*StringArray) Scan ¶ added in v0.2.0
func (sa *StringArray) Scan(value interface{}) error
Scan 实现 sql.Scanner 接口
type SystemConfig ¶ added in v0.2.0
type SystemConfig struct {
ID uint `gorm:"primaryKey" json:"id"`
ConfigKey string `gorm:"size:100;not null;uniqueIndex" json:"config_key"`
ConfigValue string `gorm:"type:text" json:"config_value"`
Description string `gorm:"type:text" json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
SystemConfig 系统配置模型
func (SystemConfig) TableName ¶ added in v0.2.0
func (SystemConfig) TableName() string
TableName 指定表名
type TimeRange ¶
type TimeRange struct {
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
TimeRange 时间范围
type User ¶ added in v0.2.0
type User struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
Username string `gorm:"uniqueIndex;not null;size:50" json:"username"`
Password string `gorm:"not null;size:255" json:"-"` // 不在 JSON 中返回密码
Nickname string `gorm:"size:100" json:"nickname"`
Email string `gorm:"size:100" json:"email"`
Avatar string `gorm:"size:255" json:"avatar,omitempty"`
Roles string `gorm:"size:255;default:'user'" json:"roles"` // 角色列表,逗号分隔
Enabled bool `gorm:"default:true" json:"enabled"`
}
User 用户模型
func (*User) CheckPassword ¶ added in v0.2.0
CheckPassword 验证密码
func (*User) SetPassword ¶ added in v0.2.0
SetPassword 设置密码(加密)
Click to show internal directories.
Click to hide internal directories.