feat: 更新后端服务

- agent_handler.go: 新增agent管理接口
- agent_service.go: 扩展agent服务逻辑
- skill_handler.go: 更新skill接口
- chat_service.go: 更新chat服务
- model相关: 新增model仓库和服务
- main.go: 更新路由配置

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 23:18:46 +08:00
parent 5b50d6ff9a
commit 5dc2e403e9
11 changed files with 335 additions and 109 deletions

View File

@@ -15,24 +15,18 @@ const (
// Agent 智能体
type Agent struct {
ID string `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"size:100;not null"`
Description string `json:"description" gorm:"type:text"`
OwnerID string `json:"owner_id" gorm:"size:50;not null;index"`
ID string `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"size:100;not null"`
Description string `json:"description" gorm:"type:text"`
OwnerID string `json:"owner_id" gorm:"size:50;not null;index"`
// Agent能力配置
Capabilities []string `json:"capabilities" gorm:"type:text"` // JSON数组可用工具列表
MemoryLimit int64 `json:"memory_limit" gorm:"default:134217728"` // 128MB
Timeout int `json:"timeout" gorm:"default:60"` // 60秒
// 技能列表(JSON数组)
Skills []string `json:"skills" gorm:"type:text;serializer:json"`
// 安全配置
SecurityLevel SecurityLevel `json:"security_level" gorm:"size:20;default:'safe'"`
AllowDangerousTools bool `json:"allow_dangerous_tools" gorm:"default:false"`
// 扩展字段:角色描述和模型配置
// 角色描述和模型配置
RoleDescription string `json:"role_description" gorm:"type:text"` // 角色描述 (System Prompt)
ModelProvider string `json:"model_provider" gorm:"size:50"` // 模型提供商: openai/anthropic
ModelName string `json:"model_name" gorm:"size:100"` // 模型名称
ModelProvider string `json:"model_provider" gorm:"size:50"` // 模型提供商: openai/anthropic
ModelName string `json:"model_name" gorm:"size:100"` // 模型名称
// 协作模式
IsSupervisor bool `json:"is_supervisor" gorm:"default:false"` // 是否为主智能体