Files
X-Agents/server/internal/model/agent.go
DESKTOP-72TV0V4\caoxiaozhu b2bc9988a9 feat: 重构前后端架构,添加Go后端和Python Agent服务
- 新增 Go 语言后端服务(server/),包含用户认证、Agent管理、数据库连接等API
- 新增 Python Agent 服务(agent/),实现Agent核心逻辑和工具集
- 前端从原生HTML迁移到Vue.js框架(web/src/)
- 添加 Docker Compose 支持(docker-compose.yml)
- 添加项目架构文档(docs/ARCHITECTURE.md)
- 添加环境变量示例(.env.example)和本地启动脚本(start-local.ps1)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 16:39:42 +08:00

54 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import (
"time"
)
// SecurityLevel 安全等级
type SecurityLevel string
const (
SecurityLevelSafe SecurityLevel = "safe"
SecurityLevelReview SecurityLevel = "review"
SecurityLevelDanger SecurityLevel = "danger"
)
// 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"`
// 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秒
// 安全配置
SecurityLevel SecurityLevel `json:"security_level" gorm:"size:20;default:'safe'"`
AllowDangerousTools bool `json:"allow_dangerous_tools" gorm:"default:false"`
// 状态
IsActive bool `json:"is_active" gorm:"default:true"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// AgentRequest 聊天请求
type AgentRequest struct {
AgentID string `json:"agent_id" binding:"required"`
Message string `json:"message" binding:"required"`
SessionID string `json:"session_id"`
Context map[string]interface{} `json:"context"`
}
// AgentResponse 聊天响应
type AgentResponse struct {
Reply string `json:"reply"`
SessionID string `json:"session_id"`
ToolsUsed []string `json:"tools_used"`
Metadata map[string]interface{} `json:"metadata"`
}