Files
X-Agents/server/internal/model/skill.go
DESKTOP-72TV0V4\caoxiaozhu 5dc2e403e9 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>
2026-03-12 23:18:46 +08:00

30 lines
890 B
Go

package model
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
// Skill 技能
type Skill struct {
ID string `json:"id" gorm:"primaryKey"`
SkillName string `json:"skill_name" gorm:"size:200;not null"`
SkillType string `json:"skill_type" gorm:"size:20;not null"` // system / user
SkillDesc string `json:"skill_desc" gorm:"type:text"`
Path string `json:"path" gorm:"size:500"` // skill 文件路径
Status int `json:"status" gorm:"default:1"` // 1: active, 0: inactive
CreatedBy string `json:"created_by" gorm:"size:100"` // 创建者用户名
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// BeforeCreate 创建前自动生成ID
func (s *Skill) BeforeCreate(tx *gorm.DB) error {
if s.ID == "" {
s.ID = uuid.New().String()
}
return nil
}