feat: 新增 Agent、Memory、Skill 模块
- handler: agent_handler, memory_handler, skill_handler - model: agent.go, skill.go - repository: agent_repo, skill_repo - service: agent_service, memory_service, skill_service - 新增 migrations 目录 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
28
server/internal/model/skill.go
Normal file
28
server/internal/model/skill.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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 string `json:"status" gorm:"size:20;default:'active'"`
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user