Documentation
¶
Overview ¶
types 包提供 Leros 的核心数据类型定义
该包定义了数字助手、事件、用户、技能等核心领域模型, 以及相关的常量和数据库表名定义。
types 包提供 Leros 的核心数据类型定义
该包定义了数字助手、事件、用户、技能等核心领域模型, 以及相关的常量和数据库表名定义。
types 包提供 Leros 的核心数据类型定义
该包定义了数字助手、事件、用户、技能等核心领域模型, 以及相关的常量和数据库表名定义。
types 包提供 Leros 的核心数据类型定义
该包定义了数字助手、事件、用户、技能等核心领域模型, 以及相关的常量和数据库表名定义。
types 包提供 Leros 的核心数据类型定义
该包定义了数字助手、事件、用户、技能等核心领域模型, 以及相关的常量和数据库表名定义。
types 包提供 Leros 的核心数据类型定义
该包定义了数字助手、事件、用户、技能等核心领域模型, 以及相关的常量和数据库表名定义。
types 包提供 Leros 的核心数据类型定义
该包定义了数字助手、事件、用户、技能等核心领域模型, 以及相关的常量和数据库表名定义。
types 包提供 Leros 的核心数据类型定义
该包定义了数字助手、事件、用户、技能等核心领域模型, 以及相关的常量和数据库表名定义。
Index ¶
- Constants
- type ArtifactSource
- type ArtifactStatus
- type ArtifactType
- type AuthLoginAttempt
- type AuthPhoneVerificationCode
- type AuthRefreshToken
- type AuthState
- type BuiltinSkillMarketplaceItem
- type Caller
- type CallerKind
- type ChannelType
- type DigitalAssistant
- type DigitalAssistantStatus
- type Event
- type EventAction
- type EventType
- type FileUpload
- type Filter
- type IdentityContext
- type KnowledgeType
- type LLMModel
- type LLMModelConfig
- type LLMModelStatus
- type LLMProviderType
- type MemberRole
- type MemberType
- type MemoryType
- type MessageArtifact
- type MessageArtifactSlice
- type MessageAttachment
- type MessageAttachmentSlice
- type MessageChunk
- type MessageChunkSlice
- type MessageResource
- type MessageRole
- type MessageStatus
- type MessageType
- type MessageUsage
- type ObjectMetadata
- type Organization
- type PageQuery
- type Pagination
- type Project
- type ProjectFile
- type ProjectFileResourceType
- type ProjectMember
- type ProjectStatus
- type RuntimeType
- type Session
- type SessionMessage
- type SessionStatus
- type SessionType
- type Skill
- type SkillCategory
- type SkillExecutionLog
- type SkillMarketplaceItem
- type SkillRegistry
- type SkillRegistryStatus
- type SkillStringList
- type SkillType
- type Task
- type TaskStatus
- type TaskType
- type Trace
- type User
- type UserOrg
- type WorkbenchRecentContext
- type WorkerDeployment
- type WorkerDeploymentStatus
Constants ¶
const ( SystemUin uint = 1 SystemOrgID uint = 1 )
const ( // TableNameUser 用户表名 TableNameUser = tablenamePrefix + "user" // TableNameOrganization 组织表名 TableNameOrganization = tablenamePrefix + "organization" // TableNameUserOrg 用户组织关联表名 TableNameUserOrg = tablenamePrefix + "user_org" // TableNameAuthRefreshToken 登录刷新令牌表名 TableNameAuthRefreshToken = tablenamePrefix + "auth_refresh_token" // TableNameAuthLoginAttempt 登录失败尝试表名 TableNameAuthLoginAttempt = tablenamePrefix + "auth_login_attempt" // TableNameAuthPhoneVerificationCode 手机验证码表名 TableNameAuthPhoneVerificationCode = tablenamePrefix + "auth_phone_verification_code" // TableNameDigitalAssistant 数字助手表名 TableNameDigitalAssistant = tablenamePrefix + "digital_assistant" // TableNameDigitalAssistantInstance 数字助手实例表名 TableNameDigitalAssistantInstance = tablenamePrefix + "digital_assistant_instance" // TableNameWorkerDeployment Worker 部署表名 TableNameWorkerDeployment = tablenamePrefix + "worker_deployment" // TableNameEvent 事件表名 TableNameEvent = tablenamePrefix + "event" // TableNameSkill 技能表名 TableNameSkill = tablenamePrefix + "skill" // TableNameSkillLog 技能执行日志表名 TableNameSkillLog = tablenamePrefix + "skill_execution_log" // TableNameSkillRegistry 技能注册表名 TableNameSkillRegistry = tablenamePrefix + "skill_registry" // TableNameSession 会话表名 TableNameSession = tablenamePrefix + "session" // TableNameSessionMessage 会话消息表名 TableNameSessionMessage = tablenamePrefix + "session_message" // TableNameLLMModel LLM模型配置表名 TableNameLLMModel = tablenamePrefix + "llm_model" // TableNameProject 项目表名 TableNameProject = tablenamePrefix + "project" // TableNameProjectMember 项目成员表名 TableNameProjectMember = tablenamePrefix + "project_member" // TableNameTask 任务表名 TableNameTask = tablenamePrefix + "task" // TableNameWorkbenchRecentContext 工作台最近使用上下文表名 TableNameWorkbenchRecentContext = tablenamePrefix + "workbench_recent_context" // TableNameFileUpload 文件上传表名 TableNameFileUpload = tablenamePrefix + "file_upload" // TableNameProjectFile 项目文件关联表名 TableNameProjectFile = tablenamePrefix + "project_file" // TableNameBuiltinSkillMarketplaceItem 内置 Skill 市场条目表名 TableNameBuiltinSkillMarketplaceItem = tablenamePrefix + "builtin_skill_marketplace_item" // TableNameSkillMarketplaceItem Skill 市场记录缓存表名 TableNameSkillMarketplaceItem = tablenamePrefix + "skill_marketplace_item" // TableNameMessageResource 消息资源关联表名 TableNameMessageResource = tablenamePrefix + "message_resource" )
数据库表名常量定义
const ( DefaultPageSize = 10 PageMaxCount = 150 )
分页默认值
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactSource ¶
type ArtifactSource string
ArtifactSource 表示产出物记录来源。
const ( // ArtifactSourceAgentDeclared 表示 Agent 通过 manifest 显式声明的产物。 ArtifactSourceAgentDeclared ArtifactSource = "agent_declared" // ArtifactSourceDiff 表示通过执行前后文件变更自动检测到的产物。 ArtifactSourceDiff ArtifactSource = "diff" )
type ArtifactStatus ¶
type ArtifactStatus string
ArtifactStatus 表示产出物的状态
const ( // ArtifactStatusCompleted 产出物已完成 ArtifactStatusCompleted ArtifactStatus = "completed" )
type ArtifactType ¶
type ArtifactType string
ArtifactType 表示产出物的类型
const ( // ArtifactTypeFile 文件附件(图片、压缩包、二进制) ArtifactTypeFile ArtifactType = "file" )
type AuthLoginAttempt ¶
type AuthLoginAttempt struct {
gorm.Model
Identifier string `gorm:"column:identifier;type:varchar(255);uniqueIndex;not null"`
FailureCount int `gorm:"column:failure_count;type:integer;default:0;not null"`
WindowExpiresAt time.Time `gorm:"column:window_expires_at;index;not null"`
}
AuthLoginAttempt stores failed login counters in a rolling window.
func (AuthLoginAttempt) TableName ¶
func (AuthLoginAttempt) TableName() string
TableName 指定AuthLoginAttempt结构体对应的数据库表名。
type AuthPhoneVerificationCode ¶ added in v0.1.12
type AuthPhoneVerificationCode struct {
gorm.Model
Phone string `gorm:"column:phone;type:varchar(32);index;not null"`
CodeHash string `gorm:"column:code_hash;type:varchar(64);not null"`
ExpiresAt time.Time `gorm:"column:expires_at;index;not null"`
UsedAt *time.Time `gorm:"column:used_at;index"`
}
AuthPhoneVerificationCode stores one-time phone login codes.
func (AuthPhoneVerificationCode) TableName ¶ added in v0.1.12
func (AuthPhoneVerificationCode) TableName() string
TableName 指定AuthPhoneVerificationCode结构体对应的数据库表名。
type AuthRefreshToken ¶
type AuthRefreshToken struct {
gorm.Model
TokenHash string `gorm:"column:token_hash;type:varchar(64);uniqueIndex;not null"`
UserID uint `gorm:"column:user_id;type:bigint;index;not null"`
ExpiresAt time.Time `gorm:"column:expires_at;index;not null"`
RevokedAt *time.Time `gorm:"column:revoked_at;index"`
}
AuthRefreshToken stores a hashed refresh token for local account sessions.
func (AuthRefreshToken) TableName ¶
func (AuthRefreshToken) TableName() string
TableName 指定AuthRefreshToken结构体对应的数据库表名。
type BuiltinSkillMarketplaceItem ¶ added in v0.1.1
type BuiltinSkillMarketplaceItem struct {
gorm.Model
// SkillID 是内置 Skill 的唯一业务编码。
SkillID string `gorm:"column:skill_id;type:varchar(100);not null;uniqueIndex:idx_builtin_skill_id_version" json:"skill_id"`
// Name 是 Skill 在市场页面展示的名称。
Name string `gorm:"column:name;type:varchar(255);not null" json:"name"`
// Description 是 Skill 的简短说明。
Description string `gorm:"column:description;type:text" json:"description"`
// Version 是当前发布版本。
Version string `gorm:"column:version;type:varchar(50);not null;uniqueIndex:idx_builtin_skill_id_version" json:"version"`
// Author 是 Skill 作者或发布方。
Author string `gorm:"column:author;type:varchar(255);not null;default:Leros" json:"author"`
// Category 是 Skill 分类。
Category string `gorm:"column:category;type:varchar(100);not null;index" json:"category"`
// Tags 是 Skill 标签列表。
Tags SkillStringList `gorm:"column:tags;type:jsonb" json:"tags"`
// Icon 是 Skill 图标地址或内置图标标识。
Icon string `gorm:"column:icon;type:varchar(1000)" json:"icon"`
// LocalPath 是内置 Skill 在服务端的本地路径或打包路径。
LocalPath string `gorm:"column:local_path;type:varchar(1000);not null" json:"local_path"`
// PackageSHA256 是内置 Skill 包的 SHA256 校验值。
PackageSHA256 string `gorm:"column:package_sha256;type:char(64)" json:"package_sha256"`
// Verified 表示该 Skill 是否经过官方验证。
Verified bool `gorm:"column:verified;type:boolean;not null;default:true" json:"verified"`
// PublishedAt 是该 Skill 发布到市场的时间。
PublishedAt *time.Time `gorm:"column:published_at" json:"published_at"`
// Installs 是下载量/安装量计数。
Installs int64 `gorm:"column:installs;type:bigint;not null;default:0" json:"installs"`
}
BuiltinSkillMarketplaceItem 内置 Skill 市场条目。
func (BuiltinSkillMarketplaceItem) TableName ¶ added in v0.1.1
func (BuiltinSkillMarketplaceItem) TableName() string
TableName 返回数据库表名。
type Caller ¶
type Caller struct {
Uin uint `json:"uin"`
OrgID uint `json:"org_id"`
WorkerID uint `json:"worker_id,omitempty"`
Kind CallerKind `json:"kind,omitempty"`
State AuthState `json:"state"`
}
Caller 定义了一个执行身份,包含用户 ID、租户 ID 和认证状态。
func SystemIdentity ¶
func SystemIdentity() *Caller
SystemIdentity 返回一个预定义的系统身份,通常用于系统内部调用或没有特定用户上下文的场景。
type CallerKind ¶ added in v0.1.12
type CallerKind string
CallerKind identifies the authenticated principal type.
const ( CallerKindUser CallerKind = "user" CallerKindWorker CallerKind = "worker" CallerKindSystem CallerKind = "system" )
type ChannelType ¶
type ChannelType string
ChannelType 表示渠道类型标识
const ( // ChannelTypeGitHub 表示GitHub渠道 ChannelTypeGitHub ChannelType = "github" // ChannelTypeGitLab 表示GitLab渠道 ChannelTypeGitLab ChannelType = "gitlab" // ChannelTypeWeChat 表示微信渠道 ChannelTypeWeChat ChannelType = "wechat" // ChannelTypeWeWork 表示企业微信渠道 ChannelTypeWeWork ChannelType = "wework" // ChannelTypeFeishu 表示飞书渠道 ChannelTypeFeishu ChannelType = "feishu" )
type DigitalAssistant ¶
type DigitalAssistant struct {
gorm.Model
// digital_assistant - 助手标识符,在组织内唯一标识数字助手,VARCHAR(255),NOT NULL
Code string `gorm:"column:code;type:varchar(255);not null;index"`
// digital_assistant - 所属组织ID,INTEGER,NOT NULL
OrgID uint `gorm:"column:org_id;type:integer;not null;index"`
// digital_assistant - 拥有者ID,INTEGER,NOT NULL
OwnerID uint `gorm:"column:owner_id;type:integer;not null;index"`
// digital_assistant - 数字助手名称,VARCHAR(255),NOT NULL
Name string `gorm:"column:name;type:varchar(255);not null"`
// digital_assistant - 描述信息,TEXT,允许为空
Description string `gorm:"column:description;type:text"`
// digital_assistant - 头像URL地址,VARCHAR(500),允许为空
Avatar string `gorm:"column:avatar;type:varchar(500)"`
// digital_assistant - 状态,表示数字助手当前运行状态,VARCHAR(50),NOT NULL
Status string `gorm:"column:status;type:varchar(50);not null"`
// digital_assistant - 版本号,跟踪配置变动版本,INTEGER,默认值0
Version int `gorm:"column:version;type:integer;default:0"`
// digital_assistant - 系统提示词,定义数字助手的角色和行为,TEXT,允许为空
SystemPrompt string `gorm:"column:system_prompt;type:text"`
}
DigitalAssistant 数字助手结构体定义了AI数字助手的基本信息与配置
func (DigitalAssistant) TableName ¶
func (DigitalAssistant) TableName() string
TableName 指定DigitalAssistant结构体对应的数据库表名
type DigitalAssistantStatus ¶
type DigitalAssistantStatus string
DigitalAssistantStatus 表示数字助手的当前运行状态
const ( // DigitalAssistantStatusActive 表示数字助手处于激活状态 DigitalAssistantStatusActive DigitalAssistantStatus = "active" // DigitalAssistantStatusInactive 表示数字助手处于非激活状态 DigitalAssistantStatusInactive DigitalAssistantStatus = "inactive" // DigitalAssistantStatusPaused 表示数字助手处于暂停状态 DigitalAssistantStatusPaused DigitalAssistantStatus = "paused" // DigitalAssistantStatusError 表示数字助手处于错误状态 DigitalAssistantStatusError DigitalAssistantStatus = "error" )
type Event ¶
type Event struct {
gorm.Model
MessageID string // 消息唯一标识符
TraceID string // 分布式追踪 ID
Source string // 事件来源
Type string // 事件类型(建议使用 types.EventType 定义的常量值)
Action string // 事件动作(建议使用 types.EventAction 定义的常量值)
Actor string // 事件触发者
Target string // 事件目标
Payload map[string]interface{} `gorm:"type:jsonb"` // 事件负载数据
Timestamp int64 // 事件时间戳
}
Event 表示系统中持久化存储的事件记录
该结构用于将事件信息存储到数据库中,包含事件的基本信息、 来源、类型、动作、参与者、目标和负载数据等。
type EventAction ¶
type EventAction string
EventAction 表示事件的动作行为
const ( // EventActionOpened 表示打开或创建事件 EventActionOpened EventAction = "opened" // EventActionClosed 表示关闭或删除事件 EventActionClosed EventAction = "closed" // EventActionUpdated 表示更新事件 EventActionUpdated EventAction = "updated" // EventActionCommented 表示评论事件 EventActionCommented EventAction = "commented" )
type FileUpload ¶ added in v0.1.2
type FileUpload struct {
gorm.Model
PublicID string `gorm:"column:public_id;type:varchar(255);not null;uniqueIndex"`
OrgID uint `gorm:"column:org_id;type:integer;not null;index"`
OwnerID uint `gorm:"column:owner_id;type:integer;not null;index"`
Filename string `gorm:"column:filename;type:varchar(500)"`
OriginalName string `gorm:"column:original_name;type:varchar(500)"`
MimeType string `gorm:"column:mime_type;type:varchar(100)"`
FileSize int64 `gorm:"column:file_size;type:bigint"`
StorageURI string `gorm:"column:storage_uri;type:varchar(500);not null"`
Sha256 string `gorm:"column:sha256;type:varchar(64);index"`
Purpose string `gorm:"column:purpose;type:varchar(50);index"`
Status string `gorm:"column:status;type:varchar(50);not null;default:'active';index"`
Metadata ObjectMetadata `gorm:"column:metadata;type:jsonb"`
}
FileUpload 表示用户上传的文件
func (FileUpload) TableName ¶ added in v0.1.2
func (FileUpload) TableName() string
TableName 指定 FileUpload 结构体对应的数据库表名
type Filter ¶
type Filter struct {
Field string `json:"field"`
Value []string `json:"value"`
ExactMatch bool `json:"exact_match"`
}
Filter 过滤条件
type IdentityContext ¶
IdentityContext 携带执行身份与跟踪信息。
type KnowledgeType ¶
type KnowledgeType string
KnowledgeType 表示知识库类型标识
const ( // KnowledgeTypeVectorStorage 表示向量存储知识库 KnowledgeTypeVectorStorage KnowledgeType = "vector_storage" // KnowledgeTypeDocument 表示文档知识库 KnowledgeTypeDocument KnowledgeType = "document" // KnowledgeTypeDatabase 表示数据库知识库 KnowledgeTypeDatabase KnowledgeType = "database" )
type LLMModel ¶
type LLMModel struct {
gorm.Model
// 模型所属组织ID,用于隔离不同组织的模型配置
OrgID uint `` /* 168-byte string literal not displayed */
// 模型配置编码,在组织内唯一,用于业务配置引用
Code string `gorm:"column:code;type:varchar(128);not null;uniqueIndex:idx_llm_model_org_code"`
// 模型展示名称,用于前端列表和选择器展示
Name string `gorm:"column:name;type:varchar(255);not null"`
// 模型描述,用于记录用途、额度、注意事项等说明
Description string `gorm:"column:description;type:text"`
// 模型供应商标识,例如 openai、anthropic、deepseek、custom
Provider string `gorm:"column:provider;type:varchar(64);not null;index"` // 建议使用 types.LLMProviderType 定义的常量值
// 实际传递给供应商API或CLI的模型名称
ModelName string `gorm:"column:model;type:varchar(255);not null"`
// API基础地址,官方默认地址可为空,自定义网关或兼容接口需填写
BaseURL string `gorm:"column:base_url;type:varchar(500)"`
// 是否已确认基础地址包含 /v1 前缀,记录连通性探测结果。默认 true 以兼容已有数据。
BaseURLHasV1 bool `gorm:"column:base_url_has_v1;type:boolean;default:true"`
// API Key密文,业务读取时需要通过统一密钥服务解密
APIKeyEncrypted string `gorm:"column:api_key_encrypted;type:text"`
// API Key脱敏展示值,仅用于前端展示,禁止用于真实调用
APIKeyMasked string `gorm:"column:api_key_masked;type:varchar(128)"`
// 默认最大输出Token数,运行请求可按需覆盖
MaxTokens int `gorm:"column:max_tokens;type:integer;default:4096"`
// 默认采样温度,运行请求可按需覆盖
Temperature float64 `gorm:"column:temperature;type:decimal(4,3);default:0.7"`
// 默认请求超时时间,单位秒
TimeoutSec int `gorm:"column:timeout_sec;type:integer;default:120"`
// 模型状态,inactive状态下不应被新任务选择
Status string `gorm:"column:status;type:varchar(32);not null;default:active;index"` // 建议使用 types.LLMModelStatus 定义的常量值
// 是否为组织默认模型,业务未显式选择模型时可回退到该模型
IsDefault bool `gorm:"column:is_default;type:boolean;default:false;index"`
// 是否为系统内置配置,内置配置可用于初始化或演示场景
IsSystem bool `gorm:"column:is_system;type:boolean;default:false"`
// 扩展配置,保存能力标记、上下文窗口、价格、额外Header等非核心字段
Config LLMModelConfig `gorm:"column:config;type:jsonb"`
}
LLMModel 定义一个在数据库中持久化的LLM模型配置
该表以“可直接调用的模型配置”为最小管理单元,暂时将供应商、 模型、凭证、默认参数和扩展配置放在同一张表中,便于MVP阶段快速接入多模型配置。
type LLMModelConfig ¶
type LLMModelConfig map[string]interface{}
LLMModelConfig 表示LLM模型配置的扩展JSON字段
func (*LLMModelConfig) Scan ¶
func (c *LLMModelConfig) Scan(value interface{}) error
Scan 实现 sql.Scanner 接口,用于从数据库中读取 JSON 数据
type LLMModelStatus ¶
type LLMModelStatus string
LLMModelStatus 表示LLM模型配置的启用状态
const ( // LLMModelStatusActive 表示模型配置可被业务使用 LLMModelStatusActive LLMModelStatus = "active" // LLMModelStatusInactive 表示模型配置暂不可被业务使用 LLMModelStatusInactive LLMModelStatus = "inactive" )
type LLMProviderType ¶
type LLMProviderType string
LLMProviderType 表示LLM提供商类型标识
const ( // LLMProviderOpenAI 表示OpenAI提供商 LLMProviderOpenAI LLMProviderType = "openai" // LLMProviderAnthropic 表示Anthropic提供商 LLMProviderAnthropic LLMProviderType = "anthropic" // LLMProviderDeepSeek 表示DeepSeek提供商 LLMProviderDeepSeek LLMProviderType = "deepseek" // LLMProviderQwen 表示通义千问提供商 LLMProviderQwen LLMProviderType = "qwen" // LLMProviderGemini 表示Google Gemini提供商 LLMProviderGemini LLMProviderType = "gemini" // LLMProviderArk 表示火山方舟提供商 LLMProviderArk LLMProviderType = "ark" // LLMProviderOpenRouter 表示OpenRouter提供商 LLMProviderOpenRouter LLMProviderType = "openrouter" // LLMProviderCustom 表示自定义提供商 LLMProviderCustom LLMProviderType = "custom" )
type MemberRole ¶
type MemberRole string
MemberRole 成员角色
const ( MemberRoleOwner MemberRole = "owner" MemberRoleAdmin MemberRole = "admin" MemberRoleMember MemberRole = "member" MemberRoleViewer MemberRole = "viewer" )
type MemberType ¶
type MemberType string
MemberType 成员类型
const ( MemberTypeUser MemberType = "user" MemberTypeAssistant MemberType = "assistant" )
type MemoryType ¶
type MemoryType string
MemoryType 表示记忆存储类型标识
const ( // MemoryTypePostgres 表示基于PostgreSQL的记忆存储 MemoryTypePostgres MemoryType = "postgres" // MemoryTypeInMemory 表示内存记忆存储 MemoryTypeInMemory MemoryType = "in_memory" )
type MessageArtifact ¶
type MessageArtifact struct {
ArtifactID string `json:"artifact_id,omitempty"`
Title string `json:"title,omitempty"`
Filename string `json:"filename,omitempty"`
Description string `json:"description,omitempty"`
MimeType string `json:"mime_type,omitempty"`
ArtifactType string `json:"artifact_type,omitempty"`
FileSize int64 `json:"file_size,omitempty"`
StorageURI string `json:"storage_uri,omitempty"`
Sha256 string `json:"sha256,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
MessageArtifact stores one lightweight artifact reference for a session message.
type MessageArtifactSlice ¶
type MessageArtifactSlice []MessageArtifact
MessageArtifactSlice stores artifact references in JSONB.
func (*MessageArtifactSlice) Scan ¶
func (m *MessageArtifactSlice) Scan(value interface{}) error
Scan implements sql.Scanner.
type MessageAttachment ¶ added in v0.1.2
type MessageAttachmentSlice ¶ added in v0.1.2
type MessageAttachmentSlice []MessageAttachment
func (*MessageAttachmentSlice) Scan ¶ added in v0.1.2
func (m *MessageAttachmentSlice) Scan(value interface{}) error
type MessageChunk ¶
type MessageChunk struct {
Seq int64 `json:"seq,omitempty"`
LastSeq int64 `json:"last_seq,omitempty"`
Type string `json:"type"`
Timestamp int64 `json:"timestamp,omitempty"`
Payload json.RawMessage `json:"payload,omitempty" swaggertype:"object"`
}
MessageChunk stores one archived runtime event for a completed session message.
type MessageChunkSlice ¶
type MessageChunkSlice []MessageChunk
MessageChunkSlice stores structured message chunks in JSONB.
func (*MessageChunkSlice) Scan ¶
func (m *MessageChunkSlice) Scan(value interface{}) error
Scan 实现 sql.Scanner 接口
type MessageResource ¶ added in v0.1.15
type MessageResource struct {
gorm.Model
ResourceID string `gorm:"column:resource_id;type:varchar(255);not null;index"` // DB primary key of the resource (empty if not found)
MessageID uint `gorm:"column:message_id;type:bigint;not null;index"` // FK to leros_session_message.id
SessionID uint `gorm:"column:session_id;type:bigint;not null;index"` // FK to leros_session.id
OrgID uint `gorm:"column:org_id;type:integer;not null;default:0;index"` // org isolation
Uin uint `gorm:"column:uin;type:bigint;default:0;index"` // user isolation
ResourceType string `gorm:"column:resource_type;type:varchar(50);not null;index"` // skill / MCP / tool / ...
ResourceKey string `gorm:"column:resource_key;type:varchar(255);not null;index"` // {source}:{skill_id} composite key
ResourceName string `gorm:"column:resource_name;type:varchar(255);not null"` // resource display name
InvokeType string `gorm:"column:invoke_type;type:varchar(50);not null"` // slash_command / mention / auto / ...
Seq int `gorm:"column:seq;type:integer;not null;default:0"` // order within the same message
}
MessageResource records which resource (skill/MCP/tool/etc.) a message used.
func (MessageResource) TableName ¶ added in v0.1.15
func (MessageResource) TableName() string
TableName specifies the database table name for MessageResource.
type MessageRole ¶
type MessageRole string
MessageRole 消息角色常量
const ( MessageRoleUser MessageRole = "user" MessageRoleAssistant MessageRole = "assistant" MessageRoleSystem MessageRole = "system" MessageRoleTool MessageRole = "tool" )
type MessageStatus ¶
type MessageStatus string
MessageStatus 消息状态常量
const ( MessageStatusPending MessageStatus = "pending" MessageStatusProcessing MessageStatus = "processing" MessageStatusCompleted MessageStatus = "completed" MessageStatusFailed MessageStatus = "failed" MessageStatusCancelled MessageStatus = "cancelled" )
type MessageType ¶
type MessageType string
MessageType 消息类型常量
const ( MessageTypeText MessageType = "text" MessageTypeImage MessageType = "image" MessageTypeCode MessageType = "code" MessageTypeFile MessageType = "file" )
type MessageUsage ¶
type MessageUsage struct {
InputTokens int `json:"input_tokens,omitempty"`
OutputTokens int `json:"output_tokens,omitempty"`
TotalTokens int `json:"total_tokens,omitempty"`
}
MessageUsage stores model token usage for a session message.
func (*MessageUsage) Scan ¶
func (mu *MessageUsage) Scan(value interface{}) error
Scan 瀹炵幇 sql.Scanner 鎺ュ彛
type ObjectMetadata ¶
type ObjectMetadata struct {
// 元数据 - 项目标签
Tags []string `json:"tags,omitempty"`
// 元数据 - 项目类型/模板标识
Type string `json:"type,omitempty"`
// 元数据 - 对象存储桶
Bucket string `json:"bucket,omitempty"`
// 元数据 - 对象存储键
Key string `json:"key,omitempty"`
// 元数据 - 其他扩展字段
Extra map[string]interface{} `json:"extra,omitempty"`
}
ObjectMetadata 项目元数据结构
func (*ObjectMetadata) Scan ¶
func (pm *ObjectMetadata) Scan(value interface{}) error
Scan 实现 sql.Scanner 接口
type Organization ¶
type Organization struct {
gorm.Model
PublicID string `gorm:"column:public_id;type:varchar(64);uniqueIndex;not null;default:''"` // 组织公开ID
Type string `gorm:"column:type;type:varchar(50);default:'company'"` // 组织类型: company/team/project
Code string `gorm:"column:code;type:varchar(255);unique_index;not null"` // 组织代码(唯一)
Name string `gorm:"column:name;type:varchar(255);not null"` // 组织名称
Status string `gorm:"column:status;type:varchar(20);default:'active'"` // 状态: active/inactive
}
Organization 表示系统中的组织/企业信息
组织是系统中的顶级实体,可以代表公司、团队或项目。 多个用户可以关联到同一个组织。
type PageQuery ¶
type PageQuery struct {
Filters []Filter `json:"filters,omitempty"`
OrderBy []string `json:"order_by,omitempty"`
Caller `json:"-"`
Pagination `json:",inline"`
}
PageQuery 通用分页查询参数
func NewPageQuery ¶
NewPageQuery 快速创建 PageQuery,接受 Caller 和分页参数。
func (*PageQuery) AddExactFilter ¶
AddExactFilter 链式添加精确过滤条件。
type Pagination ¶
type Pagination struct {
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
ListAll bool `json:"list_all,omitempty"`
}
Pagination pagination request base
type Project ¶
type Project struct {
gorm.Model
// project - 项目唯一标识,格式如:prj_xxx,VARCHAR(255),NOT NULL,UNIQUE
PublicID string `gorm:"column:public_id;type:varchar(255);not null;uniqueIndex"`
// project - 所属组织ID,INTEGER,NOT NULL,INDEX
OrgID uint `gorm:"column:org_id;type:integer;not null;index"`
// project - 创建者用户ID,INTEGER,NOT NULL,INDEX
OwnerID uint `gorm:"column:owner_id;type:integer;not null;index"`
// project - 项目名称,VARCHAR(255),NOT NULL
Name string `gorm:"column:name;type:varchar(255);not null"`
// project - 项目描述,TEXT,允许为空
Description string `gorm:"column:description;type:text"`
// project - 项目目标,TEXT,允许为空
Objective string `gorm:"column:objective;type:text"`
// project - 项目状态,VARCHAR(50),NOT NULL,DEFAULT 'active'
Status string `gorm:"column:status;type:varchar(50);not null;default:'active';index"`
// project - gitea 仓库全名(格式:org/repo_name),VARCHAR(255)
GiteaRepoFullName string `gorm:"column:gitea_repo_full_name;type:varchar(255)"`
// project - gitea 内部仓库 ID,BIGINT
GiteaRepoID int64 `gorm:"column:gitea_repo_id;type:bigint"`
// project - gitea 仓库默认分支名,VARCHAR(128),DEFAULT 'main'
GiteaDefaultBranch string `gorm:"column:gitea_default_branch;type:varchar(128);default:'main'"`
// project - 元数据(JSON格式存储标签等扩展信息),JSONB,允许为空
Metadata ObjectMetadata `gorm:"column:metadata;type:jsonb"`
}
Project 表示系统中的项目
项目是长期工作的核心容器,承载会话、任务、AI队友、知识库和项目资产。 项目提供了长期上下文和协作空间。
type ProjectFile ¶ added in v0.1.17
type ProjectFile struct {
gorm.Model
FilePublicID string `gorm:"column:file_public_id;type:varchar(255);not null;uniqueIndex"`
OrgID uint `gorm:"column:org_id;type:integer;not null;index"`
ProjectID uint `gorm:"column:project_id;type:bigint;not null;index"`
TaskID uint `gorm:"column:task_id;type:bigint;index"`
ResourceID uint `gorm:"column:resource_id;type:bigint;not null;index"`
ResourceType ProjectFileResourceType `gorm:"column:resource_type;type:varchar(50);not null;index"`
Uin uint `gorm:"column:uin;type:bigint;index"`
}
ProjectFile 项目文件关联表,记录项目/任务/资源之间的映射关系
func (ProjectFile) TableName ¶ added in v0.1.17
func (ProjectFile) TableName() string
type ProjectFileResourceType ¶ added in v0.1.17
type ProjectFileResourceType string
ProjectFileResourceType 项目文件关联的资源类型
const ( ProjectFileResourceTypeUserUpload ProjectFileResourceType = "user_upload" // 用户上传 ProjectFileResourceTypeArtifact ProjectFileResourceType = "artifact" // 工作产物 ProjectFileResourceTypePlan ProjectFileResourceType = "plan" // 计划文件 )
type ProjectMember ¶
type ProjectMember struct {
gorm.Model
// project_member - 关联项目ID,BIGINT,NOT NULL,INDEX
ProjectID uint `gorm:"column:project_id;type:bigint;not null;index"`
// project_member - 成员ID(用户ID或数字助手ID),BIGINT,NOT NULL,INDEX
MemberID uint `gorm:"column:member_id;type:bigint;not null;index"`
// project_member - 成员类型(user/assistant),VARCHAR(50),NOT NULL
MemberType MemberType `gorm:"column:member_type;type:varchar(50);not null;default:'user'"`
// project_member - 成员角色(owner/admin/member/viewer),VARCHAR(50),NOT NULL
MemberRole MemberRole `gorm:"column:member_role;type:varchar(50);not null;default:'member'"`
// project_member - 加入时间,TIMESTAMP,NOT NULL
JoinedAt time.Time `gorm:"column:joined_at;not null;default:CURRENT_TIMESTAMP"`
}
ProjectMember 项目成员关联表
关联项目与用户或数字助手,定义项目中的成员类型和角色。
func (ProjectMember) TableName ¶
func (ProjectMember) TableName() string
TableName 指定ProjectMember结构体对应的数据库表名
type ProjectStatus ¶
type ProjectStatus string
ProjectStatus 项目生命周期状态
const ( ProjectStatusActive ProjectStatus = "active" ProjectStatusPaused ProjectStatus = "paused" ProjectStatusCompleted ProjectStatus = "completed" ProjectStatusArchived ProjectStatus = "archived" )
type RuntimeType ¶
type RuntimeType string
RuntimeType 表示运行时环境类型标识
const ( // RuntimeTypeDocker 表示Docker容器运行时 RuntimeTypeDocker RuntimeType = "docker" // RuntimeTypeProcess 表示进程运行时 RuntimeTypeProcess RuntimeType = "process" )
type Session ¶
type Session struct {
gorm.Model
// session - 会话对外唯一标识,格式如:sess_xxx,VARCHAR(255),NOT NULL,UNIQUE
PublicID string `gorm:"column:public_id;type:varchar(255);not null;uniqueIndex"`
// session - 会话类型,VARCHAR(50),NOT NULL
Type SessionType `gorm:"column:type;type:varchar(50);not null"`
// session - 关联用户UIN,0表示不关联,BIGINT,DEFAULT 0
Uin uint `gorm:"column:uin;type:bigint;default:0;index"`
// session - 所属组织ID,0表示未设置,INTEGER,NOT NULL,DEFAULT 0
OrgID uint `gorm:"column:org_id;type:integer;default:0;not null;index"`
// session - 关联数字助手ID,0表示不关联,BIGINT,DEFAULT 0
AssistantID uint `gorm:"column:assistant_id;type:bigint;default:0;index"`
// session - 分配的数字员工ID,0表示未分配,BIGINT,DEFAULT 0
AllocatedAssistantID uint `gorm:"column:allocated_assistant_id;type:bigint;default:0;index"`
// session - 关联任务ID,允许为空,BIGINT,INDEX(scope=task时绑定)
TaskID *uint `gorm:"column:task_id;type:bigint;uniqueIndex:uni_session_project_task"`
// session - 关联项目ID,允许为空,BIGINT,INDEX(scope=project时绑定)
ProjectID *uint `gorm:"column:project_id;type:bigint;uniqueIndex:uni_session_project_task"`
// session - 会话状态,VARCHAR(50),NOT NULL,DEFAULT 'active'
Status string `gorm:"column:status;type:varchar(50);not null;default:'active'"`
// session - 会话标题,VARCHAR(500),允许为空
Title string `gorm:"column:title;type:varchar(500)"`
// session - 用户是否手动修改过标题
TitleManuallySet bool `gorm:"column:title_manually_set;type:boolean;default:false;not null"`
// session - 元数据,JSON格式存储额外信息,JSONB,允许为空
Metadata ObjectMetadata `gorm:"column:metadata;type:jsonb"`
// session - 消息数量,INTEGER,DEFAULT 0
MessageCount int `gorm:"column:message_count;type:integer;default:0"`
// session - 最后消息时间,TIMESTAMP,允许为空
LastMessageAt *time.Time `gorm:"column:last_message_at"`
// session - 过期时间,TIMESTAMP,允许为空
ExpiredAt *time.Time `gorm:"column:expired_at;index"`
}
Session 会话结构体定义了用户与数字助手之间的会话信息
type SessionMessage ¶
type SessionMessage struct {
gorm.Model
// session_message - 关联会话ID(FK -> Session.ID),BIGINT,NOT NULL,INDEX
SessionID uint `gorm:"column:session_id;type:bigint;not null;index"`
// session_message - 消息角色(user/assistant/system/tool),VARCHAR(50),NOT NULL
Role string `gorm:"column:role;type:varchar(50);not null"`
// session_message - 消息内容,TEXT,NOT NULL
Content string `gorm:"column:content;type:text;not null"`
// session_message - 错误详情,TEXT,允许为空
ErrorMsg string `gorm:"column:error_msg;type:text"`
// session_message - 消息类型(text/image/code/file),VARCHAR(50),DEFAULT 'text'
MessageType string `gorm:"column:message_type;type:varchar(50);default:'text'"`
// session_message - 消息状态(sending/streaming/complete/error),VARCHAR(50),DEFAULT 'complete'
Status string `gorm:"column:status;type:varchar(50);default:'complete'"`
// session_message - 流式片段(JSON数组),JSONB,允许为空
Chunks MessageChunkSlice `gorm:"column:chunks;type:jsonb"`
// session_message - assistant message artifact references.
Artifacts MessageArtifactSlice `gorm:"column:artifacts;type:jsonb"`
// session_message - file attachment references.
Attachments MessageAttachmentSlice `gorm:"column:attachments;type:jsonb"`
// session_message - 消息元数据,JSONB,允许为空
Metadata ObjectMetadata `gorm:"column:metadata;type:jsonb"`
Usage MessageUsage `gorm:"column:usage;type:jsonb"`
// session_message - 消息序号(用于排序),BIGINT,NOT NULL
Sequence int64 `gorm:"column:sequence;type:bigint;not null;index"`
// session_message - 时间戳(Unix毫秒),BIGINT,允许为空
Timestamp int64 `gorm:"column:timestamp;type:bigint"`
}
SessionMessage 会话消息结构体
func (SessionMessage) TableName ¶
func (SessionMessage) TableName() string
TableName 指定SessionMessage结构体对应的数据库表名
type SessionStatus ¶
type SessionStatus string
SessionStatus 会话状态常量
const ( SessionStatusActive SessionStatus = "active" SessionStatusPaused SessionStatus = "paused" SessionStatusEnded SessionStatus = "ended" SessionStatusExpired SessionStatus = "expired" )
type SessionType ¶
type SessionType string
SessionType 会话类型常量
const ( SessionTypeUserChat SessionType = "chat" SessionTypeTask SessionType = "task" SessionTypeProject SessionType = "project" )
type Skill ¶
type Skill struct {
gorm.Model
// 技能唯一标识符,与技能实现相关联的ID
Code string `gorm:"column:code;type:varchar(255);not null;uniqueIndex"`
// 技能所属组织ID
OrgID uint `gorm:"column:org_id;type:integer;not null;index"`
// 技能拥有者ID
OwnerID uint `gorm:"column:owner_id;type:integer;not null;index"`
// 技能名称
Name string `gorm:"column:name;type:varchar(255);not null"`
// 技能描述
Description string `gorm:"column:description;type:text"`
// 技能图标URL
Icon string `gorm:"column:icon;type:varchar(500)"`
// 技能版本号
Version string `gorm:"column:version;type:varchar(50);not null"`
// 技能类别(例如:"integration","tool","workflow","ai"等)
Category string `gorm:"column:category;type:varchar(100);not null;index"` // 建议使用 types.SkillCategory 定义的常量值
// 技能类型(本地技能或远程技能)
SkillType string `gorm:"column:skill_type;type:varchar(50);not null"` // 建议使用 types.SkillType 定义的常量值
// 技能作者
Author string `gorm:"column:author;type:varchar(255)"`
// 输入参数Schema定义
InputSchema map[string]interface{} `gorm:"column:input_schema;type:jsonb"`
// 输出参数Schema定义
OutputSchema map[string]interface{} `gorm:"column:output_schema;type:jsonb"`
// 技能所需权限
Permissions []interface{} `gorm:"column:permissions;type:jsonb"`
// 技能配置
Config map[string]interface{} `gorm:"column:config;type:jsonb"`
// 是否为系统内置技能
IsSystem bool `gorm:"column:is_system;type:boolean;default:false"`
}
Skill 定义一个在数据库中持久化的技能实体
type SkillCategory ¶
type SkillCategory string
SkillCategory 表示技能的类别(如 integration, tool, workflow, ai 等)
const ( // SkillCategoryIntegration 表示集成类技能 SkillCategoryIntegration SkillCategory = "integration" // SkillCategoryTool 表示工具类技能 SkillCategoryTool SkillCategory = "tool" // SkillCategoryWorkflow 表示工作流技能 SkillCategoryWorkflow SkillCategory = "workflow" // SkillCategoryAI 表示AI类技能 SkillCategoryAI SkillCategory = "ai" )
type SkillExecutionLog ¶
type SkillExecutionLog struct {
gorm.Model
// 关联的技能ID
SkillID uint `gorm:"column:skill_id;type:integer;not null;index"`
// 执行会话ID
SessionID string `gorm:"column:session_id;type:varchar(255);index"`
// 用户UIN
Uin string `gorm:"column:uin;type:varchar(255);index"`
// 数字助手ID
AssistantID string `gorm:"column:assistant_id;type:varchar(255);index"`
// 输入参数
Input map[string]interface{} `gorm:"column:input;type:jsonb"`
// 输出结果
Output map[string]interface{} `gorm:"column:output;type:jsonb"`
// 是否成功
Success bool `gorm:"column:success;type:boolean"`
// 错误信息
ErrorMsg string `gorm:"column:error_msg;type:text"`
// 执行耗时(毫秒)
Duration int64 `gorm:"column:duration;type:bigint"`
}
SkillExecutionLog 记录技能执行日志
func (SkillExecutionLog) TableName ¶
func (SkillExecutionLog) TableName() string
TableName 指定SkillExecutionLog对应的数据库表名
type SkillMarketplaceItem ¶ added in v0.1.13
type SkillMarketplaceItem struct {
gorm.Model
// SkillID 是 Skill 的唯一业务编码。
SkillID string `gorm:"column:skill_id;type:varchar(100);not null;uniqueIndex:idx_marketplace_item_source_skill_version" json:"skill_id"`
// Name 是 Skill 在市场页面展示的名称。
Name string `gorm:"column:name;type:varchar(255);not null" json:"name"`
// TranslatedName 是模型根据名称和描述生成的中文展示名。
TranslatedName string `gorm:"column:translated_name;type:varchar(255)" json:"translated_name"`
// Source 是数据来源,例如 Leros、ClawHub。
Source string `gorm:"column:source;type:varchar(50);not null;uniqueIndex:idx_marketplace_item_source_skill_version" json:"source"`
// Description 是原始描述(通常是英文)。
Description string `gorm:"column:description;type:text" json:"description"`
// TranslatedDescription 是模型翻译后的中文描述。
TranslatedDescription string `gorm:"column:translated_description;type:text" json:"translated_description"`
// Author 是 Skill 作者或发布方。
Author string `gorm:"column:author;type:varchar(255);not null" json:"author"`
// Installs 是下载量/安装量计数。
Installs int64 `gorm:"column:installs;type:bigint;not null;default:0" json:"installs"`
// Version 是当前版本。
Version string `gorm:"column:version;type:varchar(50);not null;uniqueIndex:idx_marketplace_item_source_skill_version" json:"version"`
// Category 是 Skill 分类。
Category string `gorm:"column:category;type:varchar(100);not null;index" json:"category"`
// Tags 是 Skill 标签列表。
Tags SkillStringList `gorm:"column:tags;type:jsonb" json:"tags"`
// PackageStoragePath 是缓存到 storage-go 的标准化 zip 包 URI,由 server 在获取详情后异步写入。
// 格式为 storage-go URI,例如 "s3://bucket/skills/marketplace/{source}/{skill_id}/{version}/skill/package.zip"。
// 空表示尚未缓存。Worker 安装时优先从此路径读取。
PackageStoragePath string `gorm:"column:package_storage_path;type:varchar(500)" json:"package_storage_path"`
}
SkillMarketplaceItem 市场搜索结果缓存表,用于缓存 Skill 元数据和中文翻译描述。
func (SkillMarketplaceItem) TableName ¶ added in v0.1.13
func (SkillMarketplaceItem) TableName() string
TableName 返回数据库表名。
type SkillRegistry ¶
type SkillRegistry struct {
gorm.Model
// 关联的技能ID
SkillID uint `gorm:"column:skill_id;type:integer;not null;uniqueIndex"`
// 技能服务地址(如果是远程技能)
ServiceEndpoint string `gorm:"column:service_endpoint;type:varchar(500)"`
// 技能执行路径
ExecutionPath string `gorm:"column:execution_path;type:varchar(500)"`
// 技能认证令牌
Token string `gorm:"column:token;type:varchar(255)"`
// 注册状态(registered, unregistered, unhealthy等)
Status string `gorm:"column:status;type:varchar(50);not null;default:registered"` // 建议使用 types.SkillRegistryStatus 定义的常量值
// 最后心跳时间
LastHeartbeat string `gorm:"column:last_heartbeat;type:timestamp"`
// 健康状态
IsHealthy bool `gorm:"column:is_healthy;type:boolean;default:true"`
}
SkillRegistry 记录技能在系统中的注册信息
func (SkillRegistry) TableName ¶
func (SkillRegistry) TableName() string
TableName 指定SkillRegistry对应的数据库表名
type SkillRegistryStatus ¶
type SkillRegistryStatus string
SkillRegistryStatus 表示技能注册状态
const ( // SkillRegistryStatusRegistered 表示已注册 SkillRegistryStatusRegistered SkillRegistryStatus = "registered" // SkillRegistryStatusUnregistered 表示未注册 SkillRegistryStatusUnregistered SkillRegistryStatus = "unregistered" // SkillRegistryStatusUnhealthy 表示不健康 SkillRegistryStatusUnhealthy SkillRegistryStatus = "unhealthy" )
type SkillStringList ¶ added in v0.1.1
type SkillStringList []string
SkillStringList 是 []string 的 JSONB 存储类型。
func (*SkillStringList) Scan ¶ added in v0.1.1
func (s *SkillStringList) Scan(value interface{}) error
Scan 实现 sql.Scanner 接口。
type Task ¶
type Task struct {
gorm.Model
PublicID string `gorm:"column:public_id;type:varchar(255);not null;uniqueIndex"`
OrgID uint `gorm:"column:org_id;type:integer;not null;index"`
OwnerID uint `gorm:"column:owner_id;type:integer;not null;index"`
ProjectID uint `gorm:"column:project_id;type:bigint;not null;index"`
SessionID *uint `gorm:"column:session_id;type:bigint;index"`
// TaskType 任务类型(如:general/general、cron/定时任务等),VARCHAR(16),NOT NULL,DEFAULT 'general'
TaskType TaskType `gorm:"column:task_type;type:varchar(16);not null;default:'general';index"`
AssigneeID *uint `gorm:"column:assignee_id;type:bigint;index"`
Title string `gorm:"column:title;type:varchar(500);not null"`
Description string `gorm:"column:description;type:text"`
Status string `gorm:"column:status;type:varchar(50);not null;default:'created';index"`
Deadline *time.Time `gorm:"column:deadline;index"`
Metadata ObjectMetadata `gorm:"column:metadata;type:jsonb"`
}
Task 表示系统中的任务
任务是项目中的最小执行单元,由 AI 队友(DigitalAssistant)执行, 支持子任务拆分(通过 ParentTaskID 自引用)和状态生命周期管理。
type TaskStatus ¶
type TaskStatus string
TaskStatus 表示任务的当前状态
const ( TaskStatusCreated TaskStatus = "created" TaskStatusPendingAssignment TaskStatus = "pending_assignment" TaskStatusInProgress TaskStatus = "in_progress" TaskStatusPendingApproval TaskStatus = "pending_approval" TaskStatusCompleted TaskStatus = "completed" TaskStatusFailed TaskStatus = "failed" TaskStatusCancelled TaskStatus = "cancelled" TaskStatusPaused TaskStatus = "paused" )
type Trace ¶
type Trace struct {
RequestID string `json:"request_id"`
TraceID string `json:"trace_id"`
SpanID []string `json:"span_id"`
}
Trace 定义了一个跟踪信息结构体,用于在请求链路中传递跟踪标识符,帮助进行分布式追踪和日志关联。
type User ¶
type User struct {
gorm.Model
PublicID string `gorm:"column:public_id;type:varchar(64);uniqueIndex;not null;default:''"` // 用户公开ID
GithubID int64 `gorm:"column:github_id;type:bigint;unique_index"` // GitHub 用户 ID
GithubLogin string `gorm:"column:github_login;type:varchar(255);not null;unique_index"` // GitHub 登录名
Password string `gorm:"column:password;type:varchar(255)"` // 密码(本地认证用)
Name string `gorm:"column:name;type:varchar(255)"` // 用户姓名
Email string `gorm:"column:email;type:varchar(255)"` // 用户邮箱
Phone string `gorm:"column:phone;type:varchar(32);uniqueIndex"` // 手机号
AvatarURL string `gorm:"column:avatar_url;type:varchar(500)"` // 头像 URL
Bio string `gorm:"column:bio;type:text"` // 个人简介
Company string `gorm:"column:company;type:varchar(255)"` // 公司信息
Location string `gorm:"column:location;type:varchar(255)"` // 地理位置
PublicRepos int `gorm:"column:public_repos;type:integer"` // 公开仓库数量
Followers int `gorm:"column:followers;type:integer"` // 关注者数量
}
User 表示系统中的用户信息
该结构存储用户的基本信息,包括 GitHub 关联信息、 个人资料、头像等。
type UserOrg ¶
type UserOrg struct {
gorm.Model
Uin uint `gorm:"column:uin;type:bigint;unique_index;not null"` // 关联ID,JWT中的Uin
UserID uint `gorm:"column:user_id;type:bigint;index;not null"` // 用户ID
OrgID uint `gorm:"column:org_id;type:bigint;index;not null"` // 组织ID
IsDefault bool `gorm:"column:is_default;type:boolean;default:false"` // 是否为默认组织
}
UserOrg 表示用户与组织的关联关系
该表是多对多关系的中间表,用于关联用户和组织。 每个用户可以关联多个组织,其中一个可以标记为默认组织。
type WorkbenchRecentContext ¶ added in v0.1.21
type WorkbenchRecentContext struct {
gorm.Model
OrgID uint `gorm:"column:org_id;type:integer;not null;uniqueIndex:uni_workbench_recent_context"`
Uin uint `gorm:"column:uin;type:integer;not null;uniqueIndex:uni_workbench_recent_context"`
ProjectID uint `gorm:"column:project_id;type:bigint;not null;index"`
TaskID *uint `gorm:"column:task_id;type:bigint;index"`
UsedAt time.Time `gorm:"column:used_at;not null;index"`
}
WorkbenchRecentContext 记录用户在首页工作台最近明确使用的项目/任务上下文。
func (WorkbenchRecentContext) TableName ¶ added in v0.1.21
func (WorkbenchRecentContext) TableName() string
TableName 指定 WorkbenchRecentContext 对应的数据库表名。
type WorkerDeployment ¶ added in v0.1.12
type WorkerDeployment struct {
gorm.Model
OrgID uint `gorm:"column:org_id;type:bigint;not null;index;uniqueIndex:idx_worker_deploy_org_worker"`
DigitalAssistantID uint `gorm:"column:digital_assistant_id;type:bigint;not null;uniqueIndex;index"`
WorkerID uint `gorm:"column:worker_id;type:bigint;not null;uniqueIndex:idx_worker_deploy_org_worker"`
DeploymentName string `gorm:"column:deployment_name;type:varchar(255);not null;uniqueIndex"`
Namespace string `gorm:"column:namespace;type:varchar(255);not null;default:''"`
Status string `gorm:"column:status;type:varchar(50);not null;default:'pending';index"`
BootstrapTokenHash string `gorm:"column:bootstrap_token_hash;type:varchar(64);not null;default:''"`
WorkspacePath string `gorm:"column:workspace_path;type:varchar(1000);not null;default:''"`
LastError string `gorm:"column:last_error;type:text"`
LastStartedAt *time.Time `gorm:"column:last_started_at;index"`
LastReconciledAt *time.Time `gorm:"column:last_reconciled_at;index"`
}
WorkerDeployment binds an AI teammate to an org-scoped worker runtime.
func (WorkerDeployment) TableName ¶ added in v0.1.12
func (WorkerDeployment) TableName() string
TableName 指定 WorkerDeployment 结构体对应的数据库表名。
type WorkerDeploymentStatus ¶ added in v0.1.12
type WorkerDeploymentStatus string
const ( WorkerDeploymentStatusPending WorkerDeploymentStatus = "pending" WorkerDeploymentStatusProvisioning WorkerDeploymentStatus = "provisioning" WorkerDeploymentStatusReady WorkerDeploymentStatus = "ready" WorkerDeploymentStatusFailed WorkerDeploymentStatus = "failed" WorkerDeploymentStatusStopped WorkerDeploymentStatus = "stopped" )
Source Files
¶
- auth.go
- builtin_skill_marketplace_item.go
- constants.go
- digital_assistant.go
- event.go
- file_upload.go
- llm_model.go
- message_resource.go
- organization.go
- project.go
- project_file.go
- session.go
- skill.go
- skill_execution_log.go
- skill_marketplace_item.go
- skill_registry.go
- tables.go
- task.go
- user.go
- user_org.go
- util.go
- workbench_recent_context.go
- worker_deployment.go