feat: 后端工具和 MCP 模块更新

- main.go: 更新工作空间目录,添加 MCP 模型迁移
- tool.go: 添加 description_cn 字段
- auth_service, tool_service: 优化
- 更新 Swagger 文档

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 14:45:49 +08:00
parent cab6488d71
commit 298ff7c79d
7 changed files with 1573 additions and 13 deletions

View File

@@ -11,15 +11,22 @@ import (
type Tool struct {
ID string `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"uniqueIndex;size:100;not null"`
Description string `json:"description" gorm:"type:text"`
Description string `json:"description" gorm:"type:text"` // 英文描述
DescriptionCN string `json:"description_cn" gorm:"type:text"` // 中文描述
Category string `json:"category" gorm:"size:50;not null"`
Provider string `json:"provider" gorm:"size:100"`
SecurityLevel string `json:"security_level" gorm:"size:20;default:'safe'"`
RequireApproval bool `json:"require_approval" gorm:"default:false"`
Parameters string `json:"parameters" gorm:"type:text"` // JSON格式存储
Status string `json:"status" gorm:"size:20;default:'active'"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// MCP 特有字段
Transport string `json:"transport" gorm:"size:20;default:'stdio'"` // stdio, http, sse
Command string `json:"command" gorm:"size:500"` // 启动命令
Args string `json:"args" gorm:"type:text"` // 参数JSON数组格式
Env string `json:"env" gorm:"type:text"` // 环境变量JSON对象格式
// 状态
Status string `json:"status" gorm:"size:20;default:'active'"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// BeforeCreate 创建前自动生成ID