Merge remote-tracking branch 'upstream/main' into main (保留常驻通知与顺延迁移版本)

This commit is contained in:
✨await
2026-09-17 23:25:50 +08:00
120 changed files with 9314 additions and 1625 deletions

View File

@@ -0,0 +1,34 @@
package model
import "time"
const (
AgentLessonStatusPending = "pending"
AgentLessonStatusApproved = "approved"
AgentLessonStatusRejected = "rejected"
)
// AgentLessonStep 是一条记忆路线里的一步。
type AgentLessonStep struct {
Tool string `json:"tool"`
Action string `json:"action"`
Note string `json:"note,omitempty"`
}
// AgentLesson 是用户私有的 Agent 记忆。只有该用户批准后才会注入自己的会话。
type AgentLesson struct {
ID string `json:"id" gorm:"primaryKey;size:36"`
Topic string `json:"topic" gorm:"size:120;index"`
Category string `json:"category" gorm:"size:32;index"`
Situation string `json:"situation" gorm:"type:text"`
Lesson string `json:"lesson" gorm:"type:text"`
Source string `json:"source" gorm:"size:200"`
StepsJSON string `json:"-" gorm:"column:steps_json;type:text"`
Status string `json:"status" gorm:"size:16;index:idx_agent_lessons_author_status,priority:2;index"`
AuthorUserID string `json:"-" gorm:"size:36;index:idx_agent_lessons_author_status,priority:1;index"`
Hits int64 `json:"hits"`
Injected int64 `json:"injected"`
LastVerifiedAt *time.Time `json:"lastVerifiedAt,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

View File

@@ -0,0 +1,34 @@
package model
import "time"
const (
AgentMemoryCompactIntervalOff = "off"
AgentMemoryCompactIntervalDaily = "daily"
AgentMemoryCompactIntervalWeekly = "weekly"
AgentMemoryCompactIntervalMonthly = "monthly"
AgentMemoryCompactStatusIdle = "idle"
AgentMemoryCompactStatusQueued = "queued"
AgentMemoryCompactStatusRunning = "running"
AgentMemoryCompactStatusSucceeded = "succeeded"
AgentMemoryCompactStatusFailed = "failed"
)
// AgentMemorySetting 是用户私有的记忆压缩偏好与最近一次压缩状态。
type AgentMemorySetting struct {
UserID string `json:"userId" gorm:"primaryKey;size:36"`
CompactInterval string `json:"compactInterval" gorm:"size:16;index"`
LogicalModelID string `json:"logicalModelId" gorm:"size:36"`
ChannelID string `json:"channelId" gorm:"size:36"`
ChannelModelKey string `json:"channelModelKey" gorm:"size:160"`
Model string `json:"model" gorm:"size:240"`
LastCompactAt *time.Time `json:"lastCompactAt,omitempty"`
CompactStartedAt *time.Time `json:"compactStartedAt,omitempty"`
CompactTaskID string `json:"compactTaskId,omitempty" gorm:"size:36;index"`
LastStatus string `json:"lastStatus" gorm:"size:16;index"`
LastSummaryJSON string `json:"-" gorm:"type:text"`
LastError string `json:"lastError,omitempty" gorm:"type:text"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}